/* ==========================================================================
   EduGuard Vision AI - Modern Glassmorphism Stylesheet
   ========================================================================== */

:root {
  /* Color Palette */
  --bg-base: #070b14;
  --bg-surface: rgba(15, 23, 42, 0.72);
  --bg-surface-elevated: rgba(30, 41, 59, 0.8);
  --bg-card: rgba(17, 24, 39, 0.65);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(99, 102, 241, 0.4);
  --border-danger: rgba(244, 63, 94, 0.5);

  /* Brand Accents */
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-glow: rgba(99, 102, 241, 0.35);
  --cyan: #06b6d4;
  --cyan-glow: rgba(6, 182, 212, 0.3);
  --emerald: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.3);
  --amber: #f59e0b;
  --rose: #f43f5e;
  --rose-glow: rgba(244, 63, 94, 0.4);

  /* Typography */
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Text Colors */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* Dimensions & Radius */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 0.18s ease;
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  background-color: var(--bg-base);
  color: var(--text-main);
  font-family: var(--font-main);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* Ambient Background Orbs */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.45;
  animation: floatOrb 18s ease-in-out infinite alternate;
}

.bg-glow-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #4338ca, #312e81 40%, transparent 70%);
  top: -100px;
  left: -100px;
}

.bg-glow-2 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, #0e7490, #164e63 40%, transparent 70%);
  bottom: 50px;
  right: -50px;
  animation-duration: 22s;
  animation-delay: -5s;
}

.bg-glow-3 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, #be123c, #881337 40%, transparent 70%);
  top: 40%;
  left: 45%;
  opacity: 0.2;
  animation-duration: 25s;
}

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, 30px) scale(1.08); }
  100% { transform: translate(-30px, 50px) scale(0.95); }
}

/* Glassmorphism Panel Standard */
.glass-panel {
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  position: relative;
  z-index: 1;
}

/* Application Layout */
.app-wrapper {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  position: relative;
  z-index: 2;
}

/* ==========================================================================
   Header Section
   ========================================================================== */
.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.5rem;
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  gap: 1rem;
}

.header-left .logo-wrapper {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: #fff;
  position: relative;
  box-shadow: 0 0 16px var(--primary-glow);
}

.pulse-ring {
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  border: 2px solid var(--cyan);
  opacity: 0.6;
  animation: ringPulse 2.5s infinite;
}

@keyframes ringPulse {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.25); opacity: 0; }
}

.logo-text h1 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.gradient-text {
  background: linear-gradient(135deg, #a5b4fc, #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tagline {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.class-badge {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--border-subtle);
  padding: 0.45rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.class-badge i {
  color: var(--cyan);
}

.live-dot {
  width: 8px;
  height: 8px;
  background-color: var(--emerald);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--emerald);
  animation: liveBlink 1.5s infinite ease-in-out;
}

@keyframes liveBlink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Model Status Pill */
.model-status-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  font-family: var(--font-mono);
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
}

.model-status-pill.loading .status-indicator {
  background: var(--amber);
  animation: liveBlink 0.8s infinite;
}

.model-status-pill.ready .status-indicator {
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
}

.model-status-pill.error .status-indicator {
  background: var(--rose);
  box-shadow: 0 0 8px var(--rose);
}

/* Buttons & Icons */
.btn-icon {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-icon:hover {
  color: #fff;
  background: rgba(49, 65, 96, 0.8);
  border-color: var(--primary-light);
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.65rem 1.35rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: var(--transition-fast);
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  box-shadow: 0 6px 20px var(--primary-glow);
  transform: translateY(-2px);
}

.btn-secondary {
  background: rgba(30, 41, 59, 0.8);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  padding: 0.6rem 1.15rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-secondary:hover {
  background: rgba(51, 65, 85, 0.9);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger-subtle {
  color: #fca5a5;
}

.btn-danger-subtle:hover {
  background: rgba(225, 29, 72, 0.2);
  border-color: var(--rose);
  color: #fff;
}

/* ==========================================================================
   Violation Alert Banner
   ========================================================================== */
.violation-banner {
  background: linear-gradient(90deg, rgba(225, 29, 72, 0.9), rgba(159, 18, 57, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 8px 24px var(--rose-glow);
  animation: bannerShake 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
  z-index: 10;
}

.violation-banner.hidden {
  display: none !important;
}

@keyframes bannerShake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-3px, 0, 0); }
  40%, 60% { transform: translate3d(3px, 0, 0); }
}

.banner-content {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.warning-icon {
  font-size: 1.5rem;
  color: #fff;
  animation: alertPulse 1s infinite alternate;
}

@keyframes alertPulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.15); }
}

.banner-text {
  display: flex;
  flex-direction: column;
  font-size: 0.9rem;
}

.banner-text strong {
  color: #fff;
  letter-spacing: 0.03em;
}

.banner-text span {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.82rem;
}

.banner-dismiss {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.3rem;
  opacity: 0.8;
  transition: var(--transition-fast);
}

.banner-dismiss:hover {
  opacity: 1;
  transform: scale(1.1);
}

/* ==========================================================================
   Dashboard Grid
   ========================================================================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 1.25rem;
}

/* Vision Card / Viewport Area */
.vision-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.4);
}

.mode-tabs {
  display: flex;
  background: rgba(30, 41, 59, 0.6);
  padding: 0.25rem;
  border-radius: var(--radius-md);
  gap: 0.25rem;
  border: 1px solid var(--border-subtle);
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.82rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition-fast);
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.vision-telemetry {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.telemetry-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.telemetry-badge.status-safe {
  color: var(--emerald);
  border-color: rgba(16, 185, 129, 0.3);
}

.telemetry-badge.status-danger {
  color: var(--rose);
  background: rgba(225, 29, 72, 0.2);
  border-color: var(--rose);
  animation: liveBlink 1s infinite;
}

/* Viewport Area */
.viewport-area {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 420px;
}

.view-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
}

.view-panel.hidden {
  display: none !important;
}

/* Video Container & HUD Overlays */
.video-container {
  position: relative;
  width: 100%;
  min-height: 360px;
  background: #030712;
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.08);
  transition: border-color var(--transition-normal);
}

.video-container.violation-active {
  border-color: var(--rose);
  box-shadow: 0 0 25px var(--rose-glow), inset 0 0 35px rgba(225, 29, 72, 0.3);
}

.camera-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2.5rem 1.5rem;
  gap: 0.85rem;
  max-width: 380px;
}

.placeholder-icon {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid var(--border-active);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: var(--primary-light);
}

.camera-placeholder h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
}

.camera-placeholder p {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

/* AI HUD Cyber Overlays */
.ai-corner {
  position: absolute;
  width: 20px;
  height: 20px;
  border-color: var(--cyan);
  pointer-events: none;
  z-index: 5;
  opacity: 0.7;
}

.ai-corner.tl { top: 12px; left: 12px; border-top: 2px solid; border-left: 2px solid; }
.ai-corner.tr { top: 12px; right: 12px; border-top: 2px solid; border-right: 2px solid; }
.ai-corner.bl { bottom: 12px; left: 12px; border-bottom: 2px solid; border-left: 2px solid; }
.ai-corner.br { bottom: 12px; right: 12px; border-bottom: 2px solid; border-right: 2px solid; }

.ai-scanline {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--cyan), #fff, var(--cyan), transparent);
  box-shadow: 0 0 12px var(--cyan);
  opacity: 0;
  pointer-events: none;
  z-index: 6;
}

.scanning .ai-scanline {
  opacity: 0.85;
  animation: scanMove 3s ease-in-out infinite;
}

@keyframes scanMove {
  0% { top: 2%; }
  50% { top: 96%; }
  100% { top: 2%; }
}

.ai-target-reticle {
  position: absolute;
  width: 140px;
  height: 140px;
  border: 1px dashed rgba(6, 182, 212, 0.4);
  border-radius: 50%;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  transition: var(--transition-fast);
}

.scanning .ai-target-reticle {
  opacity: 0.6;
  animation: rotateReticle 12s linear infinite;
}

@keyframes rotateReticle {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.webcam-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.webcam-wrapper.hidden {
  display: none !important;
}

#webcamCanvasContainer canvas {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  display: block;
  object-fit: cover;
}

/* Viewport Controls */
.viewport-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.btn-control {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: var(--transition-fast);
}

.btn-control:hover:not(:disabled) {
  background: rgba(51, 65, 85, 0.9);
  border-color: var(--border-active);
}

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

.btn-control.btn-danger {
  color: #fda4af;
}

.btn-control.btn-danger:hover:not(:disabled) {
  background: rgba(225, 29, 72, 0.25);
  border-color: var(--rose);
}

/* Upload Panel Styles */
.upload-dropzone {
  position: relative;
  width: 100%;
  min-height: 330px;
  border: 2px dashed rgba(99, 102, 241, 0.35);
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: var(--transition-normal);
}

.upload-dropzone:hover, .upload-dropzone.dragover {
  border-color: var(--cyan);
  background: rgba(6, 182, 212, 0.08);
}

.file-input-hidden {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 10;
}

.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2rem 1.5rem;
  gap: 0.6rem;
  pointer-events: none;
}

.upload-icon-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: var(--cyan);
  margin-bottom: 0.4rem;
}

.browse-link {
  color: var(--cyan);
  text-decoration: underline;
  font-weight: 600;
}

.file-support-text {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Image Preview in Upload Mode */
.image-preview-container {
  position: relative;
  width: 100%;
  height: 100%;
  max-height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  z-index: 15;
}

.image-preview-container.hidden {
  display: none !important;
}

.image-preview-container img {
  max-width: 100%;
  max-height: 360px;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.close-preview-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  z-index: 20;
}

.sample-images-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.5rem;
  background: rgba(15, 23, 42, 0.4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.sample-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-sample {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.75rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition-fast);
}

.btn-sample:hover {
  background: rgba(99, 102, 241, 0.25);
  border-color: var(--primary-light);
  color: #fff;
}

/* ==========================================================================
   Analysis Column & AI Telemetry
   ========================================================================== */
.analysis-column {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.hud-card {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

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

.hud-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.hud-title i {
  color: var(--primary-light);
  font-size: 1.1rem;
}

.hud-title h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
}

.confidence-badge {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.25rem 0.65rem;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid var(--border-active);
  color: var(--primary-light);
  border-radius: var(--radius-sm);
}

/* Decision Status Box */
.decision-status-box {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: rgba(30, 41, 59, 0.5);
  transition: var(--transition-normal);
}

.decision-status-box.status-idle {
  border-color: var(--border-subtle);
}

.decision-status-box.status-safe {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(6, 78, 59, 0.25));
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 4px 18px var(--emerald-glow);
}

.decision-status-box.status-safe .status-icon {
  background: rgba(16, 185, 129, 0.2);
  color: var(--emerald);
  border-color: var(--emerald);
}

.decision-status-box.status-safe .status-text {
  color: var(--emerald);
}

.decision-status-box.status-danger {
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.18), rgba(159, 18, 57, 0.35));
  border-color: var(--rose);
  box-shadow: 0 4px 20px var(--rose-glow);
  animation: dangerPulse 1.2s infinite alternate;
}

@keyframes dangerPulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.015); box-shadow: 0 6px 26px var(--rose-glow); }
}

.decision-status-box.status-danger .status-icon {
  background: rgba(244, 63, 94, 0.25);
  color: var(--rose);
  border-color: var(--rose);
}

.decision-status-box.status-danger .status-text {
  color: #ff6b81;
}

.status-icon {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.status-info {
  display: flex;
  flex-direction: column;
}

.status-caption {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--text-dim);
}

.status-text {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.2;
}

.status-subtext {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Dynamic Probability Bars */
.probabilities-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.probabilities-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

.model-name-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--cyan);
}

.prediction-bars-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.prediction-bar-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.bar-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 600;
}

.class-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.class-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.bar-percentage {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
}

.progress-track {
  height: 9px;
  background: rgba(30, 41, 59, 0.8);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border-subtle);
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  width: 0%;
  transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1), background 0.2s ease;
  box-shadow: 0 0 10px currentColor;
}

/* Skeleton Loading */
.skeleton-bar {
  height: 38px;
  background: linear-gradient(90deg, rgba(30, 41, 59, 0.4), rgba(51, 65, 85, 0.4), rgba(30, 41, 59, 0.4));
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Real-time Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
}

.stat-card {
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.icon-blue { background: rgba(99, 102, 241, 0.15); color: var(--primary-light); }
.icon-rose { background: rgba(244, 63, 94, 0.15); color: var(--rose); }
.icon-emerald { background: rgba(16, 185, 129, 0.15); color: var(--emerald); }

.stat-details {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.1;
}

/* Quick Settings Panel */
.quick-settings-panel {
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.setting-info {
  display: flex;
  flex-direction: column;
}

.setting-title {
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.setting-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.threshold-slider-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

input[type="range"] {
  accent-color: var(--cyan);
  cursor: pointer;
}

.slider-val {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--cyan);
  min-width: 36px;
}

.setting-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.toggle-control {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  user-select: none;
}

.toggle-control input {
  display: none;
}

.toggle-slider {
  width: 38px;
  height: 20px;
  background: rgba(51, 65, 85, 0.8);
  border-radius: var(--radius-full);
  position: relative;
  transition: var(--transition-fast);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: var(--transition-fast);
}

.toggle-control input:checked + .toggle-slider {
  background: var(--primary);
}

.toggle-control input:checked + .toggle-slider::before {
  transform: translateX(18px);
}

/* ==========================================================================
   Incident Log & History Section
   ========================================================================== */
.history-section {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.section-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.section-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid var(--border-active);
  color: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.section-title-wrap h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.section-title-wrap p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

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

.search-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-subtle);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-md);
}

.search-box i {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.search-box input {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 0.82rem;
  outline: none;
  width: 160px;
}

.search-box input::placeholder {
  color: var(--text-dim);
}

/* Incident Table */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.4);
}

.log-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.82rem;
}

.log-table th {
  background: rgba(30, 41, 59, 0.7);
  padding: 0.75rem 1rem;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

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

.log-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.log-thumb-wrapper {
  width: 54px;
  height: 40px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  transition: var(--transition-fast);
}

.log-thumb-wrapper:hover {
  transform: scale(1.1);
  border-color: var(--cyan);
}

.log-thumb-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.log-badge-danger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #fda4af;
  font-weight: 600;
  font-size: 0.75rem;
}

.log-badge-safe {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
  font-weight: 600;
  font-size: 0.75rem;
}

.time-stamp {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 0.78rem;
}

.confidence-val {
  font-family: var(--font-mono);
  font-weight: 700;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
  gap: 0.5rem;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 2.2rem;
  color: var(--emerald);
  opacity: 0.8;
}

.empty-state h4 {
  font-size: 1rem;
  color: var(--text-main);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.app-footer {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-dim);
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.model-credit a {
  color: var(--cyan);
  text-decoration: none;
}

.model-credit a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Modals
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.75);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}

.modal-backdrop.hidden {
  display: none !important;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  width: 100%;
  max-width: 540px;
  background: #0f172a;
  border: 1px solid var(--border-active);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.modal-title i {
  color: var(--cyan);
}

.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  max-height: 70vh;
  overflow-y: auto;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-group input[type="text"],
.form-group input[type="number"] {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition-fast);
}

.form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

.input-with-button {
  display: flex;
  gap: 0.5rem;
}

.input-with-button input {
  flex: 1;
}

.form-hint {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.test-sound-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(30, 41, 59, 0.5);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  border: 1px solid var(--border-subtle);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.6);
}

/* Image Zoom Modal */
.zoom-modal-card {
  max-width: 720px;
  width: 100%;
  background: #0b1120;
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

.zoom-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.zoom-modal-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

.zoom-modal-body img {
  max-width: 100%;
  max-height: 60vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.zoom-details {
  display: flex;
  gap: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  justify-content: center;
}

/* Toast Container */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  z-index: 1000;
}

.toast {
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--border-subtle);
  color: #fff;
  padding: 0.75rem 1.15rem;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: toastSlideIn 0.3s ease;
  min-width: 250px;
}

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

.toast.toast-success { border-color: var(--emerald); }
.toast.toast-success i { color: var(--emerald); }
.toast.toast-warning { border-color: var(--amber); }
.toast.toast-warning i { color: var(--amber); }
.toast.toast-error { border-color: var(--rose); }
.toast.toast-error i { color: var(--rose); }

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-wrapper {
    padding: 0.75rem;
  }

  .main-header {
    flex-direction: column;
    align-items: stretch;
  }

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

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

  .form-row {
    grid-template-columns: 1fr;
  }
}
