/**
 * HamCation Security - Shared Styles
 */

:root {
  --primary: #1a56db;
  --primary-dark: #1e429f;
  --success: #059669;
  --success-light: #d1fae5;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, sans-serif;
  background: var(--gray-100);
  color: var(--gray-900);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

.container-narrow {
  max-width: 600px;
  margin: 0 auto;
  padding: 1rem;
}

/* Header */
header {
  background: var(--primary);
  color: white;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h1 {
  font-size: 1.25rem;
  font-weight: 600;
}

header .user-info {
  font-size: 0.875rem;
  opacity: 0.9;
}

/* Navigation */
nav {
  background: var(--primary-dark);
  padding: 0.5rem 1rem;
}

nav a {
  color: white;
  text-decoration: none;
  padding: 0.5rem 1rem;
  margin-right: 0.5rem;
  border-radius: 0.25rem;
  display: inline-block;
}

nav a:hover,
nav a.active {
  background: rgba(255, 255, 255, 0.1);
}

nav.hidden {
  display: none;
}

/* Cards */
.card {
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.card-header {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--gray-200);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0.375rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.25rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--gray-700);
}

.form-input,
.form-select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: 0.375rem;
  font-size: 1rem;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
}

.table th {
  background: var(--gray-50);
  font-weight: 600;
  color: var(--gray-700);
}

.table tr:hover {
  background: var(--gray-50);
}

/* Status badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-success {
  background: var(--success-light);
  color: var(--success);
}

.badge-danger {
  background: var(--danger-light);
  color: var(--danger);
}

.badge-warning {
  background: var(--warning-light);
  color: var(--warning);
}

.badge-gray {
  background: var(--gray-200);
  color: var(--gray-700);
}

/* Scanner-specific styles */
.scanner-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.gate-indicator {
  background: var(--primary);
  color: white;
  padding: 1rem;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 600;
}

.scan-view {
  flex: 1;
  background: #000;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scan-view video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 280px;
  height: 180px;
  border: 3px solid rgba(255, 255, 255, 0.5);
  border-radius: 0.5rem;
  pointer-events: none;
}

/* Result card */
.result-card {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  z-index: 10;
}

.result-card.hidden {
  display: none;
}

.result-card.allowed {
  background: var(--success);
  color: white;
}

.result-card.not-found {
  background: var(--danger);
  color: white;
}

.result-card.queued {
  background: var(--warning);
  color: white;
}

.result-card.error {
  background: var(--gray-700);
  color: white;
}

.result-status {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.result-person {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.result-badge {
  font-size: 1rem;
  opacity: 0.8;
}

.result-dismiss {
  margin-top: 2rem;
  padding: 1rem 2rem;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid white;
  border-radius: 0.5rem;
  color: white;
  font-size: 1.25rem;
  cursor: pointer;
}

/* Scanner footer */
.scanner-footer {
  background: var(--gray-900);
  color: white;
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
}

.scanner-footer .queue-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.queue-count {
  background: var(--warning);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-weight: 600;
}

.queue-count.synced {
  background: var(--success);
}

.sync-time {
  opacity: 0.7;
}

/* Access denied */
.access-denied {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  text-align: center;
  padding: 2rem;
}

.access-denied h1 {
  color: var(--danger);
  margin-bottom: 1rem;
}

.access-denied p {
  color: var(--gray-500);
  max-width: 400px;
}

/* Loading state */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Responsive */
@media (max-width: 640px) {
  .container {
    padding: 0.5rem;
  }

  .card {
    padding: 1rem;
  }

  .table th,
  .table td {
    padding: 0.5rem;
    font-size: 0.875rem;
  }
}

/* Utility classes */
.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.mt-1 {
  margin-top: 0.5rem;
}

.mt-2 {
  margin-top: 1rem;
}

.mt-4 {
  margin-top: 2rem;
}

.mb-2 {
  margin-bottom: 1rem;
}

.mb-4 {
  margin-bottom: 2rem;
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-2 {
  gap: 0.5rem;
}

.gap-4 {
  gap: 1rem;
}
