/* ==========================================================================
   VIGILANCE AI - DRIVER DROWSINESS DETECTION HUD
   Futuristic Cyberpunk / Automotive Cockpit Interface
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;600;700;900&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  /* Color Palette */
  --bg-primary: #060913;
  --bg-secondary: #0c1222;
  --bg-card: rgba(14, 23, 42, 0.75);
  --bg-card-hover: rgba(20, 32, 58, 0.85);
  --bg-glass: rgba(15, 23, 42, 0.65);
  
  /* Borders & Accents */
  --border-subtle: rgba(56, 189, 248, 0.15);
  --border-glow: rgba(0, 242, 254, 0.4);
  --border-critical: rgba(239, 68, 68, 0.5);
  
  /* Cyber / HUD Accents */
  --cyan-main: #00f2fe;
  --cyan-glow: rgba(0, 242, 254, 0.35);
  --blue-accent: #3b82f6;
  --emerald-safe: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.35);
  --amber-warning: #f59e0b;
  --amber-glow: rgba(245, 158, 11, 0.4);
  --red-critical: #ef4444;
  --red-glow: rgba(239, 68, 68, 0.55);
  --purple-accent: #a855f7;
  
  /* Text */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  /* Typography */
  --font-hud: 'Orbitron', -apple-system, sans-serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  /* Transitions & Radii */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reset & Base Setup */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  min-height: 100vh;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Futuristic Grid Background */
body {
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(0, 242, 254, 0.08) 0%, transparent 60%),
    radial-gradient(circle at 10% 90%, rgba(59, 130, 246, 0.05) 0%, transparent 40%),
    linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 40px 40px, 40px 40px;
  position: relative;
}

/* Critical Alert Fullscreen Flash Overlay */
#alertFlashOverlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

#alertFlashOverlay.flash-critical {
  opacity: 1;
  background: radial-gradient(circle at center, rgba(239, 68, 68, 0.25) 0%, rgba(239, 68, 68, 0.7) 100%);
  animation: criticalPulse 0.45s infinite alternate;
}

#alertFlashOverlay.flash-warning {
  opacity: 1;
  background: radial-gradient(circle at center, rgba(245, 158, 11, 0.15) 0%, rgba(245, 158, 11, 0.45) 100%);
  animation: warningPulse 0.8s infinite alternate;
}

@keyframes criticalPulse {
  0% { opacity: 0.3; }
  100% { opacity: 0.85; }
}

@keyframes warningPulse {
  0% { opacity: 0.2; }
  100% { opacity: 0.6; }
}

/* Layout Container */
.app-container {
  max-width: 1540px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-height: 100vh;
}

/* ==========================================================================
   HEADER HUD
   ========================================================================== */
.hud-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  position: relative;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.hud-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 2rem;
  right: 2rem;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan-main), transparent);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-icon-wrapper {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, rgba(0, 242, 254, 0.15), rgba(59, 130, 246, 0.25));
  border: 1px solid var(--cyan-main);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  color: var(--cyan-main);
  font-size: 1.5rem;
  box-shadow: 0 0 15px var(--cyan-glow);
  position: relative;
}

.brand-icon-wrapper::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 11px;
  border: 1px dashed var(--cyan-main);
  opacity: 0.4;
  animation: rotateGlow 20s linear infinite;
}

@keyframes rotateGlow {
  100% { transform: rotate(360deg); }
}

.brand-title {
  font-family: var(--font-hud);
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(90deg, #ffffff, var(--cyan-main));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  letter-spacing: 1px;
}

/* System Status Ribbon in Header */
.header-telemetry {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1rem;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid var(--emerald-safe);
  border-radius: var(--radius-full);
  color: var(--emerald-safe);
  font-family: var(--font-hud);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 1px;
  box-shadow: 0 0 12px var(--emerald-glow);
  transition: all var(--transition-smooth);
}

.status-badge.warning {
  background: rgba(245, 158, 11, 0.12);
  border-color: var(--amber-warning);
  color: var(--amber-warning);
  box-shadow: 0 0 15px var(--amber-glow);
}

.status-badge.critical {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--red-critical);
  color: var(--red-critical);
  box-shadow: 0 0 20px var(--red-glow);
  animation: badgeBlink 0.6s infinite alternate;
}

@keyframes badgeBlink {
  from { opacity: 0.7; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1.02); }
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: pulseDot 1.5s infinite;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.6; }
}

.header-clock {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--cyan-main);
  background: rgba(0, 242, 254, 0.05);
  border: 1px solid rgba(0, 242, 254, 0.2);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* ==========================================================================
   BUTTONS & CONTROLS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  font-family: var(--font-hud);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 1px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  outline: none;
  user-select: none;
}

.btn-primary {
  background: linear-gradient(135deg, #00c6ff, #0072ff);
  color: #ffffff;
  border-color: rgba(0, 242, 254, 0.6);
  box-shadow: 0 4px 15px rgba(0, 114, 255, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 198, 255, 0.6);
  filter: brightness(1.1);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #ffffff;
  border-color: rgba(239, 68, 68, 0.6);
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(239, 68, 68, 0.7);
}

.btn-glass {
  background: rgba(30, 41, 59, 0.6);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(8px);
}

.btn-glass:hover {
  background: rgba(51, 65, 85, 0.8);
  border-color: var(--cyan-main);
  color: var(--cyan-main);
  transform: translateY(-2px);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
}

/* ==========================================================================
   MAIN DASHBOARD GRID LAYOUT
   ========================================================================== */
.hud-dashboard {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 1100px) {
  .hud-dashboard {
    grid-template-columns: 1fr;
  }
}

/* Panel Card Base */
.hud-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  position: relative;
  overflow: hidden;
}

.hud-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 12px;
  height: 12px;
  border-top: 2px solid var(--cyan-main);
  border-left: 2px solid var(--cyan-main);
}

.hud-panel::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border-bottom: 2px solid var(--cyan-main);
  border-right: 2px solid var(--cyan-main);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.2rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.panel-title {
  font-family: var(--font-hud);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.panel-title i {
  color: var(--cyan-main);
  font-size: 1.1rem;
}

.panel-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--cyan-main);
  background: rgba(0, 242, 254, 0.1);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(0, 242, 254, 0.25);
}

/* ==========================================================================
   CAMERA & AI HUD VIEWPORT (LEFT COLUMN)
   ========================================================================== */
.camera-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.viewport-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #020408;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(0, 242, 254, 0.3);
  box-shadow: 0 0 35px rgba(0, 0, 0, 0.8), inset 0 0 20px rgba(0, 242, 254, 0.15);
}

.viewport-container.alert-mode-critical {
  border-color: var(--red-critical);
  box-shadow: 0 0 40px var(--red-glow), inset 0 0 30px var(--red-glow);
  animation: borderSiren 0.5s infinite alternate;
}

@keyframes borderSiren {
  0% { border-color: var(--red-critical); }
  100% { border-color: #ffffff; }
}

/* Webcam Element */
#webcamVideo, #webcamCanvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scaleX(-1); /* Mirror view for natural driver look */
}

/* Camera Placeholder / Off State */
.camera-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: linear-gradient(180deg, #090e1c 0%, #03060c 100%);
  z-index: 5;
  transition: opacity var(--transition-smooth);
}

.camera-placeholder.hidden {
  opacity: 0;
  pointer-events: none;
}

.radar-sweep {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  border: 1px solid rgba(0, 242, 254, 0.3);
  position: relative;
  display: grid;
  place-items: center;
  box-shadow: 0 0 20px rgba(0, 242, 254, 0.15);
}

.radar-sweep::before {
  content: '';
  position: absolute;
  inset: 15px;
  border-radius: 50%;
  border: 1px dashed rgba(0, 242, 254, 0.2);
}

.radar-sweep::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 70%, rgba(0, 242, 254, 0.6) 100%);
  animation: radarSpin 2.5s linear infinite;
}

@keyframes radarSpin {
  100% { transform: rotate(360deg); }
}

.placeholder-icon {
  font-size: 2.2rem;
  color: var(--cyan-main);
  z-index: 2;
}

.placeholder-text {
  font-family: var(--font-hud);
  font-size: 1rem;
  letter-spacing: 2px;
  color: var(--text-secondary);
}

/* HUD Overlay Layers (Targeting Reticles, Corner Marks, Telemetry) */
.hud-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.25rem;
}

/* Scanning Laser Line */
.scanner-line {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--cyan-main), #ffffff, var(--cyan-main), transparent);
  box-shadow: 0 0 15px var(--cyan-main);
  opacity: 0;
  transition: opacity 0.3s;
}

.scanning-active .scanner-line {
  opacity: 0.85;
  animation: scanMove 3s ease-in-out infinite alternate;
}

@keyframes scanMove {
  0% { top: 5%; }
  100% { top: 92%; }
}

/* HUD Viewport Top Bar */
.hud-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hud-rec-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.6);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 8px #ef4444;
  animation: recBlink 1s infinite;
}

@keyframes recBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

.hud-ai-badge {
  font-family: var(--font-hud);
  font-size: 0.75rem;
  color: var(--cyan-main);
  background: rgba(0, 242, 254, 0.15);
  border: 1px solid var(--cyan-main);
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-sm);
  letter-spacing: 1px;
  box-shadow: 0 0 10px var(--cyan-glow);
}

/* Face Target Reticle Center */
.hud-target-reticle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 220px;
  height: 260px;
  border: 1px solid rgba(0, 242, 254, 0.25);
  border-radius: 40px;
  transition: all var(--transition-fast);
}

.hud-target-reticle::before,
.hud-target-reticle::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-color: var(--cyan-main);
  border-style: solid;
}

.hud-target-reticle::before {
  top: -2px;
  left: -2px;
  border-width: 3px 0 0 3px;
  border-top-left-radius: 12px;
}

.hud-target-reticle::after {
  bottom: -2px;
  right: -2px;
  border-width: 0 3px 3px 0;
  border-bottom-right-radius: 12px;
}

.reticle-corner-tr {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  border-top: 3px solid var(--cyan-main);
  border-right: 3px solid var(--cyan-main);
  border-top-right-radius: 12px;
}

.reticle-corner-bl {
  position: absolute;
  bottom: -2px;
  left: -2px;
  width: 20px;
  height: 20px;
  border-bottom: 3px solid var(--cyan-main);
  border-left: 3px solid var(--cyan-main);
  border-bottom-left-radius: 12px;
}

.reticle-crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
}

.reticle-crosshair::before, .reticle-crosshair::after {
  content: '';
  position: absolute;
  background: rgba(0, 242, 254, 0.4);
}

.reticle-crosshair::before {
  top: 7px; left: 0; right: 0; height: 2px;
}
.reticle-crosshair::after {
  left: 7px; top: 0; bottom: 0; width: 2px;
}

/* Reticle state changes */
.state-sleepy .hud-target-reticle {
  border-color: var(--red-critical);
  box-shadow: 0 0 25px var(--red-glow);
}
.state-sleepy .hud-target-reticle::before,
.state-sleepy .hud-target-reticle::after,
.state-sleepy .reticle-corner-tr,
.state-sleepy .reticle-corner-bl {
  border-color: var(--red-critical);
}

/* Floating Status Banner Inside Viewport */
.hud-alert-banner {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--emerald-safe);
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  transition: all var(--transition-fast);
}

.hud-alert-banner.state-warning {
  border-color: var(--amber-warning);
  background: rgba(30, 20, 5, 0.9);
}

.hud-alert-banner.state-critical {
  border-color: var(--red-critical);
  background: rgba(45, 10, 10, 0.92);
  box-shadow: 0 0 25px var(--red-glow);
  animation: bannerShake 0.4s infinite;
}

@keyframes bannerShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

.banner-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.banner-icon {
  font-size: 1.4rem;
  color: var(--emerald-safe);
}

.state-warning .banner-icon { color: var(--amber-warning); }
.state-critical .banner-icon { color: var(--red-critical); }

.banner-text-main {
  font-family: var(--font-hud);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.banner-text-sub {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.banner-timer {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.4);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
}

/* Viewport Controls Bar */
.viewport-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.controls-left, .controls-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   TELEMETRY & AI GAUGES (RIGHT COLUMN & PANELS)
   ========================================================================== */
.telemetry-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* AI Classification Probability Card */
.ai-probability-panel {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.prob-meter-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.prob-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.prob-label {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.prob-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
}

.prob-progress-track {
  width: 100%;
  height: 14px;
  background: rgba(15, 23, 42, 0.8);
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 2px;
  position: relative;
}

.prob-progress-bar {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.prob-progress-bar.sleepy {
  background: linear-gradient(90deg, #f59e0b, #ef4444);
  box-shadow: 0 0 14px var(--red-glow);
}

.prob-progress-bar.non-sleepy {
  background: linear-gradient(90deg, #00f2fe, #10b981);
  box-shadow: 0 0 14px var(--emerald-glow);
}

/* Multi-Metric Quick Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
}

.metric-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: all var(--transition-fast);
}

.metric-card:hover {
  background: rgba(20, 32, 58, 0.7);
  border-color: rgba(0, 242, 254, 0.3);
}

.metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-value {
  font-family: var(--font-hud);
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: 1px;
}

.metric-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Fatigue Index Circular Dial / Bar */
.fatigue-meter-container {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 1rem;
}

.fatigue-dial-wrapper {
  width: 80px;
  height: 80px;
  position: relative;
  flex-shrink: 0;
}

.fatigue-dial-wrapper svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.fatigue-dial-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 6;
}

.fatigue-dial-fill {
  fill: none;
  stroke: var(--cyan-main);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 220;
  stroke-dashoffset: 220;
  transition: stroke-dashoffset 0.4s ease, stroke 0.3s ease;
}

.fatigue-dial-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-hud);
  font-size: 0.95rem;
  font-weight: 700;
}

.fatigue-details {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.fatigue-title {
  font-size: 0.85rem;
  font-weight: 600;
}

.fatigue-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   EVENT LOGS & INCIDENT HISTORY (BOTTOM FULL WIDTH PANEL)
   ========================================================================== */
.logs-section {
  display: grid;
  grid-template-columns: 1.8fr 1fr;
  gap: 1.25rem;
}

@media (max-width: 992px) {
  .logs-section {
    grid-template-columns: 1fr;
  }
}

.log-table-container {
  max-height: 230px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--cyan-main) rgba(15, 23, 42, 0.8);
}

.log-table-container::-webkit-scrollbar {
  width: 6px;
}

.log-table-container::-webkit-scrollbar-thumb {
  background: rgba(0, 242, 254, 0.3);
  border-radius: 4px;
}

.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  font-family: var(--font-sans);
}

.log-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  z-index: 2;
}

.log-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.log-row-critical {
  background: rgba(239, 68, 68, 0.08);
  color: #fca5a5;
}

.log-row-warning {
  background: rgba(245, 158, 11, 0.08);
  color: #fde68a;
}

.log-row-info {
  color: var(--text-secondary);
}

.log-tag {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.log-tag.critical {
  background: rgba(239, 68, 68, 0.2);
  color: var(--red-critical);
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.log-tag.warning {
  background: rgba(245, 158, 11, 0.2);
  color: var(--amber-warning);
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.log-tag.info {
  background: rgba(0, 242, 254, 0.15);
  color: var(--cyan-main);
  border: 1px solid rgba(0, 242, 254, 0.3);
}

/* Quick Driver Actions Card */
.driver-action-card {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.action-btn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.action-card-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 0.75rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.action-card-btn:hover {
  background: rgba(30, 41, 59, 0.9);
  border-color: var(--cyan-main);
  transform: translateY(-2px);
  color: var(--cyan-main);
  box-shadow: 0 4px 15px rgba(0, 242, 254, 0.2);
}

.action-card-btn i {
  font-size: 1.4rem;
}

.action-card-btn span {
  font-size: 0.75rem;
  font-weight: 600;
}

/* ==========================================================================
   MODAL DIALOGS (SETTINGS, CALIBRATION)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 12, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-smooth);
  padding: 1.5rem;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  width: 100%;
  max-width: 580px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px var(--cyan-glow);
  transform: scale(0.95);
  transition: transform var(--transition-smooth);
}

.modal-backdrop.active .modal-content {
  transform: scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.setting-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.setting-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 600;
}

.setting-slider {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.setting-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--cyan-main);
  box-shadow: 0 0 10px var(--cyan-main);
  cursor: pointer;
}

.setting-select, .setting-input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  outline: none;
}

.setting-select:focus, .setting-input:focus {
  border-color: var(--cyan-main);
  box-shadow: 0 0 10px var(--cyan-glow);
}

/* ==========================================================================
   TOAST NOTIFICATION
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--cyan-main);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6), 0 0 15px var(--cyan-glow);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-primary);
  font-size: 0.85rem;
  animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toastSlideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Footer Info */
.hud-footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  padding-top: 1rem;
}
