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

/* ============================================
   AVIATION BACKGROUND
   ============================================ */
body {
  font-family: system-ui, -apple-system, sans-serif;
  color: #e2e8f0;
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  background: linear-gradient(180deg, #0a1929 0%, #0f172a 40%, #1e293b 100%);
}

/* Starfield layer */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 20% 15%, rgba(255,255,255,0.7), transparent),
    radial-gradient(1px 1px at 60% 8%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 80% 25%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 35% 40%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1px 1px at 75% 55%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 10% 65%, rgba(255,255,255,0.3), transparent),
    radial-gradient(1px 1px at 90% 80%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1px 1px at 45% 90%, rgba(255,255,255,0.5), transparent);
  background-size: 100% 100%;
  pointer-events: none;
  z-index: 0;
  animation: twinkle 8s ease-in-out infinite alternate;
}

@keyframes twinkle {
  0% { opacity: 0.6; }
  100% { opacity: 1; }
}

/* Animated aircraft flying across */
body::after {
  content: '✈';
  position: fixed;
  top: 12%;
  left: -60px;
  font-size: 2rem;
  color: rgba(56, 189, 248, 0.4);
  z-index: 1;
  pointer-events: none;
  animation: flyAcross 28s linear infinite;
  text-shadow: 0 0 12px rgba(56, 189, 248, 0.5);
}

@keyframes flyAcross {
  0% {
    transform: translateX(0) translateY(0) rotate(0deg);
    opacity: 0;
  }
  10% { opacity: 0.8; }
  50% {
    transform: translateX(50vw) translateY(-30px) rotate(-8deg);
    opacity: 0.8;
  }
  90% { opacity: 0.8; }
  100% {
    transform: translateX(105vw) translateY(-60px) rotate(-12deg);
    opacity: 0;
  }
}

/* Second aircraft flying opposite direction */
.flight-bg {
  position: fixed;
  top: 40%;
  right: -60px;
  font-size: 1.4rem;
  color: rgba(148, 163, 184, 0.3);
  z-index: 1;
  pointer-events: none;
  animation: flyAcrossReverse 35s linear infinite;
  animation-delay: 5s;
}

@keyframes flyAcrossReverse {
  0% {
    transform: translateX(0) translateY(0) rotate(180deg);
    opacity: 0;
  }
  10% { opacity: 0.7; }
  50% {
    transform: translateX(-50vw) translateY(20px) rotate(172deg);
    opacity: 0.7;
  }
  90% { opacity: 0.7; }
  100% {
    transform: translateX(-105vw) translateY(40px) rotate(168deg);
    opacity: 0;
  }
}

/* Clouds / horizon glow */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
  position: relative;
  z-index: 2;
}

body:has(.container:only-child) .container {
  max-width: 420px;
  margin-top: 80px;
}

/* ============================================
   GLASS CARDS
   ============================================ */
.card {
  background: rgba(30, 41, 59, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 14px;
  padding: 28px;
  margin-bottom: 20px;
  border: 1px solid rgba(56, 189, 248, 0.15);
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(56, 189, 248, 0.05) inset;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.4), transparent);
}

.card:hover {
  border-color: rgba(56, 189, 248, 0.3);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(56, 189, 248, 0.1) inset;
}

h1 {
  color: #38bdf8;
  font-size: 1.6rem;
  margin-bottom: 6px;
  text-shadow: 0 0 20px rgba(56, 189, 248, 0.3);
  letter-spacing: -0.02em;
}

h2 {
  color: #38bdf8;
  font-size: 1.2rem;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

.subtitle {
  color: #94a3b8;
  margin-bottom: 20px;
}

.muted {
  color: #64748b;
  font-size: 0.9rem;
}

/* ============================================
   FORM FIELDS
   ============================================ */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 0.85rem;
  color: #94a3b8;
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}
.field input, .field select {
  width: 100%;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(51, 65, 85, 0.8);
  border-radius: 8px;
  color: #e2e8f0;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

/* ============================================
   BUTTONS
   ============================================ */
button {
  background: linear-gradient(180deg, #38bdf8 0%, #0ea5e9 100%);
  color: #0f172a;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.95rem;
  margin-top: 8px;
  transition: transform 0.1s, box-shadow 0.2s, filter 0.2s;
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.25);
}
button:hover {
  filter: brightness(1.08);
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.4);
}
button:active { transform: translateY(1px); }
button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.5);
  box-shadow: none;
}

.btn-secondary {
  background: rgba(51, 65, 85, 0.9);
  color: #e2e8f0;
  box-shadow: none;
}
.btn-secondary:hover {
  background: rgba(71, 85, 105, 0.95);
  filter: none;
}

.btn-danger {
  background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}
.btn-danger:hover {
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

/* ============================================
   TOP BAR
   ============================================ */
.topbar {
  background: rgba(30, 41, 59, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(56, 189, 248, 0.15);
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  color: #38bdf8;
  font-weight: 700;
  font-size: 1.1rem;
  text-shadow: 0 0 16px rgba(56, 189, 248, 0.4);
  letter-spacing: -0.01em;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ============================================
   BADGES
   ============================================ */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-admin {
  background: linear-gradient(180deg, #ef4444, #b91c1c);
  color: white;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}
.badge-instructor {
  background: linear-gradient(180deg, #f59e0b, #d97706);
  color: #0f172a;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}
.badge-student {
  background: linear-gradient(180deg, #10b981, #059669);
  color: white;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

/* ============================================
   STATS
   ============================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
}
.stat-box {
  background: rgba(15, 23, 42, 0.7);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  border: 1px solid rgba(56, 189, 248, 0.15);
  transition: transform 0.2s, border-color 0.2s;
}
.stat-box:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.4);
}
.stat-num {
  font-size: 1.8rem;
  font-weight: 700;
  color: #38bdf8;
  text-shadow: 0 0 16px rgba(56, 189, 248, 0.4);
  line-height: 1.1;
}
.stat-label {
  font-size: 0.75rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 4px;
}

/* ============================================
   LISTS & TABLES
   ============================================ */
.list-item {
  padding: 12px 0;
  border-bottom: 1px solid rgba(51, 65, 85, 0.6);
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.list-item:last-child { border-bottom: none; }
.list-item a {
  color: #38bdf8;
  margin-left: auto;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}
.list-item a:hover { color: #7dd3fc; }

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 0.9rem;
}
.table th, .table td {
  padding: 10px;
  text-align: left;
  border-bottom: 1px solid rgba(51, 65, 85, 0.6);
}
.table th {
  color: #94a3b8;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.table tbody tr {
  transition: background 0.15s;
}
.table tbody tr:hover {
  background: rgba(56, 189, 248, 0.05);
}

/* ============================================
   STOPWATCH
   ============================================ */
.stopwatch {
  font-size: 3rem;
  font-weight: 700;
  text-align: center;
  color: #38bdf8;
  font-family: 'Courier New', ui-monospace, monospace;
  padding: 24px;
  background:
    radial-gradient(ellipse at center, rgba(56, 189, 248, 0.15) 0%, transparent 70%),
    rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 12px;
  margin: 12px 0;
  letter-spacing: 0.08em;
  text-shadow:
    0 0 20px rgba(56, 189, 248, 0.6),
    0 0 40px rgba(56, 189, 248, 0.3);
  position: relative;
}

.stopwatch::before {
  content: '⬤ LIVE';
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 0.65rem;
  color: #64748b;
  letter-spacing: 0.1em;
  font-family: system-ui, sans-serif;
  opacity: 0.7;
}

.stopwatch-controls {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* ============================================
   MESSAGES
   ============================================ */
.message {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  min-height: 0;
  backdrop-filter: blur(8px);
  animation: slideIn 0.2s ease;
}
.message:empty { display: none; }
.message.error {
  background: rgba(127, 29, 29, 0.6);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fecaca;
}
.message.success {
  background: rgba(6, 78, 59, 0.6);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
}
.message.info {
  background: rgba(30, 58, 138, 0.6);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #bfdbfe;
}

@keyframes slideIn {
  from { transform: translateY(-6px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ============================================
   MISC
   ============================================ */
hr {
  border: none;
  border-top: 1px solid rgba(51, 65, 85, 0.6);
  margin: 20px 0;
}

/* Login page — extra aviation flair */
body:has(.container:only-child) .card {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.25);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.6),
    0 0 40px rgba(56, 189, 248, 0.15);
}

body:has(.container:only-child) .card::after {
  content: '✈';
  position: absolute;
  bottom: 12px;
  right: 16px;
  font-size: 3rem;
  color: rgba(56, 189, 248, 0.08);
  pointer-events: none;
  transform: rotate(-15deg);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 640px) {
  .stopwatch { font-size: 2rem; }
  .field-row { grid-template-columns: 1fr; }
  body::after { font-size: 1.4rem; }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  body::before,
  body::after,
  .flight-bg {
    animation: none;
  }
  * {
    transition-duration: 0.01ms !important;
  }
/* ============================================
   SAAA LOGO — TOP BAR BRAND
   ============================================ */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow:
    0 0 0 2px rgba(56, 189, 248, 0.3),
    0 4px 12px rgba(0, 0, 0, 0.4);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.brand:hover .brand-logo {
  transform: rotate(360deg);
  box-shadow:
    0 0 0 2px rgba(56, 189, 248, 0.6),
    0 4px 20px rgba(56, 189, 248, 0.5);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-text .brand-title {
  color: #38bdf8;
  font-weight: 700;
  font-size: 1rem;
  text-shadow: 0 0 16px rgba(56, 189, 248, 0.4);
  letter-spacing: -0.01em;
}

.brand-text .brand-subtitle {
  color: #64748b;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
}

/* ============================================
   SAAA LOGO — LOGIN PAGE HERO
   ============================================ */
.login-logo {
  display: block;
  width: 110px;
  height: 110px;
  margin: 0 auto 20px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow:
    0 0 0 4px rgba(56, 189, 248, 0.15),
    0 0 40px rgba(56, 189, 248, 0.35),
    0 12px 40px rgba(0, 0, 0, 0.5);
  animation: logoPulse 4s ease-in-out infinite;
}

@keyframes logoPulse {
  0%, 100% {
    box-shadow:
      0 0 0 4px rgba(56, 189, 248, 0.15),
      0 0 40px rgba(56, 189, 248, 0.35),
      0 12px 40px rgba(0, 0, 0, 0.5);
  }
  50% {
    box-shadow:
      0 0 0 6px rgba(56, 189, 248, 0.25),
      0 0 60px rgba(56, 189, 248, 0.55),
      0 12px 40px rgba(0, 0, 0, 0.5);
  }
}

/* Login page main title alignment */
body:has(.container:only-child) h1 {
  text-align: center;
  font-size: 1.45rem;
}

body:has(.container:only-child) .subtitle {
  text-align: center;
}

/* ============================================
   SAAA LOGO — BACKGROUND WATERMARK
   ============================================ */
body:has(.container:only-child) .card::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('saaa-logo.png');
  background-repeat: no-repeat;
  background-position: center;
  background-size: 65%;
  opacity: 0.04;
  pointer-events: none;
  z-index: 0;
}

body:has(.container:only-child) .card > * {
  position: relative;
  z-index: 1;
}
