/* ==========================================================================
   Currio - Modern Automotive Driving School Tracking & Error System
   ========================================================================== */

:root {
  --bg-main: #0B0F19;
  --bg-card: #151D2E;
  --bg-card-hover: #1E293B;
  --bg-input: #1E293B;
  --border-color: #2D3748;
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --text-dim: #64748B;
  
  --color-primary: #3B82F6;
  --color-primary-hover: #2563EB;
  --color-success: #10B981;
  --color-danger: #EF4444;
  --color-danger-hover: #DC2626;
  --color-warning: #F59E0B;
  --color-info: #06B6D4;
  --color-purple: #8B5CF6;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.6);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Allow scrolling on standalone pages like student portal */
body.scrollable-body, html.scrollable-html {
  height: auto !important;
  min-height: 100% !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch !important;
}

/* --------------------------------------------------------------------------
   Top Navigation Bar
   -------------------------------------------------------------------------- */
.app-header {
  height: 56px;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  flex-shrink: 0;
}

.brand-logo {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--text-main);
  line-height: 1.1;
}

.brand-by-author {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #60A5FA;
  margin-top: 1px;
  text-transform: uppercase;
}

.auth-creator-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #60A5FA;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  margin-top: 4px;
}

.brand-badge {
  background: linear-gradient(135deg, #EF4444, #3B82F6);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: var(--radius-full);
}

.nav-tabs {
  display: flex;
  gap: 6px;
  background-color: var(--bg-main);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.nav-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-tab-btn.active {
  background-color: var(--color-primary);
  color: #FFFFFF;
  box-shadow: var(--shadow-sm);
}

.header-status {
  display: flex;
  align-items: center;
  gap: 12px;
}

.gps-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background-color: var(--bg-main);
  border: 1px solid var(--border-color);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-dim);
}

.status-dot.green { background-color: var(--color-success); box-shadow: 0 0 8px var(--color-success); }
.status-dot.yellow { background-color: var(--color-warning); }
.status-dot.red { background-color: var(--color-danger); }

/* --------------------------------------------------------------------------
   App View Layouts
   -------------------------------------------------------------------------- */
.app-content {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.tab-view {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  overflow: hidden;
}

.tab-view.active {
  display: flex;
}

/* --------------------------------------------------------------------------
   1. LIVE COCKPIT VIEW
   -------------------------------------------------------------------------- */
.cockpit-container {
  display: flex;
  flex: 1;
  height: 100%;
  width: 100%;
  position: relative;
}

.map-wrapper {
  flex: 1;
  height: 100%;
  position: relative;
}

#cockpit-map, #review-map {
  width: 100%;
  height: 100%;
  background-color: #1E293B;
}

/* Live HUD Overlay (Speed, Time, Distance) */
.cockpit-hud-overlay {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  z-index: 500;
}

.hud-panel {
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  display: flex;
  gap: 18px;
  pointer-events: auto;
  box-shadow: var(--shadow-md);
}

.hud-item {
  display: flex;
  flex-direction: column;
}

.hud-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
}

.hud-val {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}

.hud-val.speed-val {
  color: #38BDF8;
  transition: color 0.2s ease;
}

/* German StVO Speed Limit Sign (Zeichen 274) */
.speed-sign {
  width: 32px;
  height: 32px;
  background-color: #FFFFFF;
  border: 3.5px solid #EF4444;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  flex-shrink: 0;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.speed-sign span {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 13px;
  font-weight: 900;
  color: #111827;
  line-height: 1;
  letter-spacing: -0.5px;
}

/* Overspeed Warning States */
.speed-warning {
  color: #F59E0B !important;
  text-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

.speed-critical {
  color: #EF4444 !important;
  text-shadow: 0 0 14px rgba(239, 68, 68, 0.8);
  animation: speedPulseAlert 0.8s infinite alternate ease-in-out;
}

.speed-sign-overspeed {
  border-color: #DC2626 !important;
  animation: signVibrateAlert 0.4s infinite ease-in-out;
}

@keyframes speedPulseAlert {
  0% { transform: scale(1); }
  100% { transform: scale(1.06); }
}

@keyframes signVibrateAlert {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-4deg); }
  75% { transform: rotate(4deg); }
}

.hud-val.error-count {
  color: #F87171;
}

/* Right HUD Panel & 1-Tap Speed Signs Bar */
.hud-panel-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hud-speed-signs-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
}

.hud-mini-speed-sign {
  width: 34px;
  height: 34px;
  background-color: #FFFFFF;
  border: 3.5px solid #EF4444;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  padding: 0;
  transition: transform 0.1s ease, box-shadow 0.1s ease, border-color 0.1s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.hud-mini-speed-sign span {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 11px;
  font-weight: 900;
  color: #111827;
  line-height: 1;
  letter-spacing: -0.5px;
}

.hud-mini-speed-sign:active {
  transform: scale(0.86);
  border-color: #DC2626;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.9);
}

@keyframes signClickFlash {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.9); }
  50% { transform: scale(1.15); box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.flash-sign {
  animation: signClickFlash 0.35s ease-out;
}

/* Recenter Button */
.btn-recenter {
  position: absolute;
  right: 14px;
  bottom: 180px;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  z-index: 500;
  box-shadow: var(--shadow-md);
}

/* Floating Action Bottom Bar in Live Cockpit */
.cockpit-action-bar {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Uniform Cockpit Action Buttons Grid (8x2 on Desktop, 4x4 on Mobile) */
.cockpit-buttons-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  width: 100%;
}

/* On phones/tablets, a 4x4 grid eats half the screen and hides the map.
   Use one horizontally scrollable row instead, so the map stays dominant
   like on desktop and the button bar is just a thin strip. */
@media (max-width: 900px) {
  .cockpit-buttons-grid {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    gap: 6px;
  }

  .btn-quick-cat {
    flex: 0 0 72px;
    scroll-snap-align: start;
  }
}

.btn-quick-cat {
  height: 52px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 800;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  color: #FFFFFF !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  transition: transform 0.1s ease, filter 0.1s ease;
  user-select: none;
}

.btn-quick-cat:active {
  transform: scale(0.94);
  filter: brightness(1.25);
}

.btn-quick-cat span:first-child {
  font-size: 17px;
  line-height: 1;
}

.btn-quick-cat span:last-child {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.3px;
  line-height: 1;
}

/* 1. RvL: Pure Signal Red */
.btn-cat-rvl {
  background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
  border-color: #FCA5A5;
}

/* 2. !RvL: Vibrant Warning Orange */
.btn-cat-not-rvl {
  background: linear-gradient(135deg, #F97316 0%, #EA580C 100%);
  border-color: #FDBA74;
}

/* 3. Fehler: Dark Red / Crimson */
.btn-cat-fehler {
  background: linear-gradient(135deg, #DC2626 0%, #991B1B 100%);
  border-color: #F87171;
}

/* 4. Orientierung: Cyan / Sky Blue */
.btn-cat-orientierung, .btn-cat-beobachtung {
  background: linear-gradient(135deg, #0EA5E9 0%, #0284C7 100%);
  border-color: #38BDF8;
}

/* 5. Schulterblick: Deep Purple / Indigo */
.btn-cat-schulterblick, .btn-cat-blick {
  background: linear-gradient(135deg, #6366F1 0%, #4338CA 100%);
  border-color: #818CF8;
}

/* 6. Blink: Bright Amber / Warning Gold */
.btn-cat-blink {
  background: linear-gradient(135deg, #D97706 0%, #B45309 100%);
  border-color: #FBBF24;
}

/* 7. Stopp: Pure Stop-Sign Red */
.btn-cat-stopp {
  background: linear-gradient(135deg, #E11D48 0%, #9F1239 100%);
  border-color: #FB7185;
}

/* 8. Ampel: Signal Red/Amber Alert */
.btn-cat-ampel {
  background: linear-gradient(135deg, #E11D48 0%, #B91C1C 100%);
  border-color: #FCA5A5;
}

/* 9. Spur: Deep Violet */
.btn-cat-spur {
  background: linear-gradient(135deg, #8B5CF6 0%, #6D28D9 100%);
  border-color: #A78BFA;
}

/* 10. Seitenabstand: Ocean Cyan / Teal */
.btn-cat-abstand {
  background: linear-gradient(135deg, #0891B2 0%, #0E7490 100%);
  border-color: #22D3EE;
}

/* 11. Durchfahrt verboten: Burgundy / Crimson */
.btn-cat-durchfahrt {
  background: linear-gradient(135deg, #BE123C 0%, #881337 100%);
  border-color: #FB7185;
}

/* 12. Fußgänger: Royal Indigo / Blue */
.btn-cat-fussgaenger {
  background: linear-gradient(135deg, #4F46E5 0%, #3730A3 100%);
  border-color: #A5B4FC;
}

/* 13. Blickrichtung rückwärts: Deep Teal / Emerald */
.btn-cat-rueckwaerts, .btn-cat-parken {
  background: linear-gradient(135deg, #0D9488 0%, #0F766E 100%);
  border-color: #2DD4BF;
}

/* 14. Zögern: Warm Amber / Gold */
.btn-cat-zoegern {
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  border-color: #FCD34D;
}

/* 15. Lob: Emerald Success Green */
.btn-cat-lob {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  border-color: #34D399;
}

/* 16. Ende: Dark Slate / Charcoal */
.btn-cat-end {
  background: linear-gradient(135deg, #475569 0%, #334155 100%);
  border-color: #94A3B8;
}

.btn-start-drive {
  background: linear-gradient(135deg, #10B981, #059669);
  color: white;
  border: none;
  font-size: 18px;
  font-weight: 800;
  height: 64px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
}

/* --------------------------------------------------------------------------
   2. START DRIVE OVERLAY / FORM
   -------------------------------------------------------------------------- */
.cockpit-start-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(11, 15, 25, 0.94);
  backdrop-filter: blur(16px);
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.start-drive-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: var(--shadow-lg);
}

.start-drive-card h2 {
  font-size: 22px;
  font-weight: 800;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.form-input, .form-select {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  outline: none;
}

.form-input:focus, .form-select:focus {
  border-color: var(--color-primary);
}

/* --------------------------------------------------------------------------
   3. DEBRIEFING & REVIEW VIEW
   -------------------------------------------------------------------------- */
.review-layout {
  display: flex;
  width: 100%;
  height: 100%;
}

.review-sidebar {
  width: 380px;
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
}

.review-sidebar-header {
  padding: 18px;
  border-bottom: 1px solid var(--border-color);
}

.review-session-selector {
  margin-top: 10px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
}

.kpi-card {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
}

.kpi-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
}

.kpi-value {
  font-size: 20px;
  font-weight: 800;
  margin-top: 4px;
}

.kpi-card.kpi-rvl {
  border-left: 4px solid var(--color-danger);
}

.kpi-card.kpi-rvl .kpi-value {
  color: var(--color-danger);
}

.mistake-list-section {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}

.section-subtitle {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.mistake-item {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.1s ease;
}

.mistake-item:hover {
  border-color: var(--color-primary);
}

.mistake-action-links {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.btn-streetview-link {
  display: inline-flex !important;
  align-items: center;
  gap: 4px;
  background: rgba(239, 68, 68, 0.25) !important;
  color: #FCA5A5 !important;
  border: 1px solid rgba(239, 68, 68, 0.6) !important;
  border-radius: 6px;
  padding: 6px 12px !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  text-decoration: none !important;
  cursor: pointer !important;
  transition: all 0.15s ease;
}

.btn-streetview-link:hover {
  background: rgba(239, 68, 68, 0.45) !important;
  color: #FFFFFF !important;
  border-color: #EF4444 !important;
  transform: translateY(-1px);
}

.btn-maps-link {
  display: inline-flex !important;
  align-items: center;
  gap: 4px;
  background: rgba(59, 130, 246, 0.25) !important;
  color: #93C5FD !important;
  border: 1px solid rgba(59, 130, 246, 0.6) !important;
  border-radius: 6px;
  padding: 6px 12px !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  text-decoration: none !important;
  cursor: pointer !important;
  transition: all 0.15s ease;
}

.btn-maps-link:hover {
  background: rgba(59, 130, 246, 0.45) !important;
  color: #FFFFFF !important;
  border-color: #3B82F6 !important;
  transform: translateY(-1px);
}

.mistake-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 700;
}

.mistake-time {
  font-size: 12px;
  color: var(--text-dim);
}

.mistake-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.tag-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   4. STUDENTS VIEW
   -------------------------------------------------------------------------- */
.students-container {
  flex: 1;
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  overflow-y: auto;
}

.students-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.students-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.student-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.student-card:hover {
  transform: translateY(-2px);
  border-color: var(--color-primary);
}

.student-header-info {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.student-name {
  font-size: 18px;
  font-weight: 800;
}

.license-pill {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #60A5FA;
  font-size: 12px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.student-stats-row {
  display: flex;
  justify-content: space-between;
  background: var(--bg-main);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-size: 12px;
}

/* --------------------------------------------------------------------------
   Buttons & Common Components
   -------------------------------------------------------------------------- */
.btn-primary {
  background: var(--color-primary);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s;
}

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

.btn-secondary {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-xs {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 4px;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   Modal Dialogs
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 800;
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* --------------------------------------------------------------------------
   Leaflet Custom Elements (Vehicle, Pins, Popups)
   -------------------------------------------------------------------------- */
.vehicle-marker-wrapper {
  position: relative;
}

.vehicle-pulsing-dot {
  width: 36px;
  height: 36px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vehicle-center-dot {
  width: 16px;
  height: 16px;
  background-color: #38BDF8;
  border: 3px solid #FFFFFF;
  border-radius: 50%;
  box-shadow: 0 0 14px #38BDF8;
  z-index: 2;
}

.vehicle-heading-arrow {
  position: absolute;
  top: -6px;
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 12px solid #38BDF8;
  transform-origin: 50% 24px;
  display: none;
  z-index: 1;
}

.currio-pin {
  width: 32px;
  height: 32px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  border: 2px solid #FFFFFF;
}

.currio-pin .pin-code {
  transform: rotate(45deg);
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 800;
}

.currio-pin-rvl {
  background-color: #EF4444 !important;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.8) !important;
}

.route-terminal-pin {
  display: flex;
  align-items: center;
  justify-content: center;
}

.pin-badge {
  background: #10B981;
  color: white;
  font-size: 10px;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

.end-pin .pin-badge {
  background: #3B82F6;
}

.marker-popup-card {
  padding: 4px;
  min-width: 180px;
  color: #0F172A;
}

.popup-header {
  padding-left: 8px;
  margin-bottom: 6px;
}

.popup-time {
  font-size: 11px;
  color: #64748B;
  display: block;
}

.popup-note {
  font-size: 12px;
  margin: 6px 0;
  padding: 6px;
  background: #F1F5F9;
  border-radius: 4px;
}

.leaflet-popup-content-wrapper {
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
}

/* Ripple Flash Effect on RvL Button Tap */
@keyframes rvlPulseFlash {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.8); }
  70% { transform: scale(1.02); box-shadow: 0 0 0 30px rgba(239, 68, 68, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.flash-rvl {
  animation: rvlPulseFlash 0.4s ease-out;
}

/* --------------------------------------------------------------------------
   Responsive adjustments for Mobile & Tablet Cockpit
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .app-header {
    padding: 0 12px;
    height: 52px;
  }
  
  .brand-title-wrap {
    font-size: 16px;
  }
  
  .brand-by-author {
    font-size: 9px;
  }

  .nav-tabs {
    gap: 4px;
    padding: 2px;
  }

  .nav-tab-btn {
    padding: 5px 8px;
    font-size: 12px;
    gap: 4px;
  }

  .nav-tab-btn span:last-child {
    font-size: 11px;
  }

  .gps-badge {
    padding: 3px 8px;
    font-size: 11px;
  }

  /* Cockpit Mobile */
  .cockpit-hud-overlay {
    top: 10px;
    left: 10px;
    right: 10px;
    gap: 6px;
  }

  .hud-panel {
    padding: 6px 10px;
    gap: 10px;
    flex-shrink: 0;
  }

  .hud-val {
    font-size: 16px;
  }

  .hud-label {
    font-size: 9px;
  }

  /* Keep RvL-count + speed-sign row on the same line as the left HUD panel
     instead of wrapping (a wrapped second line collides with the button
     grid below). Let the sign row scroll sideways when it doesn't fit. */
  .hud-panel-right {
    min-width: 0;
    flex-shrink: 1;
  }

  .hud-speed-signs-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 34vw;
    padding-left: 6px;
  }

  .hud-mini-speed-sign {
    width: 26px;
    height: 26px;
  }

  .hud-mini-speed-sign span {
    font-size: 9px;
  }

  /* Pinch-to-zoom works natively on touch screens; the on-map zoom buttons
     only collide with the action button grid on small screens. */
  .leaflet-control-zoom {
    display: none;
  }

  .cockpit-action-bar {
    bottom: 10px;
    left: 8px;
    right: 8px;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .btn-quick-cat {
    height: 46px;
    font-size: 11px;
  }

  .btn-quick-cat span:first-child {
    font-size: 15px;
  }

  .btn-recenter {
    bottom: 76px;
  }

  /* Review / Debriefing Mobile */
  .review-layout {
    flex-direction: column-reverse;
  }

  .map-wrapper {
    height: 40vh;
    min-height: 220px;
    flex-shrink: 0;
  }

  .review-sidebar {
    width: 100%;
    height: calc(60vh - 52px);
    border-right: none;
    border-top: 1px solid var(--border-color);
    padding: 12px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .kpi-card {
    padding: 8px 10px;
  }

  .kpi-value {
    font-size: 16px;
  }

  .mistake-item {
    padding: 10px;
  }

  .students-container {
    padding: 12px;
  }

  .students-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .nav-tab-btn span:last-child {
    display: none;
  }
  
  .nav-tab-btn {
    padding: 6px 10px;
    font-size: 16px;
  }
  
  .brand-badge {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   Auth & Login Screen Overlay
   -------------------------------------------------------------------------- */
.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: var(--bg-main);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.auth-icon {
  font-size: 40px;
  display: block;
  margin-bottom: 6px;
}

.auth-brand h1 {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 1px;
}

.auth-brand p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-submit-btn {
  width: 100%;
  height: 48px;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  margin-top: 4px;
}

.auth-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #FCA5A5;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  text-align: center;
  font-weight: 600;
}

.form-group-checkbox {
  display: flex;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}

.form-group-checkbox label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
