/* =========================================================
   STUDYGUARD AI - MODERN DESIGN SYSTEM & STYLESHEET
   ========================================================= */

:root {
  /* Core Color Palette */
  --bg-main: #070a13;
  --bg-card: rgba(14, 22, 38, 0.75);
  --bg-card-hover: rgba(20, 31, 53, 0.85);
  --bg-glass: rgba(16, 26, 46, 0.6);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-glow: rgba(0, 242, 254, 0.3);

  /* Neon & Accent Colors */
  --neon-cyan: #00f2fe;
  --neon-blue: #4facfe;
  --neon-emerald: #10b981;
  --neon-rose: #f43f5e;
  --neon-amber: #f59e0b;
  --neon-purple: #8b5cf6;

  /* Text Colors */
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  --text-inverse: #030712;

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

  /* Shadow & Glows */
  --glow-cyan: 0 0 20px rgba(0, 242, 254, 0.35);
  --glow-rose: 0 0 25px rgba(244, 63, 94, 0.45);
  --glow-emerald: 0 0 20px rgba(16, 185, 129, 0.35);
  --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.6);

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

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

html, body {
  min-height: 100vh;
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(0, 242, 254, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(139, 92, 246, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(15, 23, 42, 0.6) 0%, transparent 80%);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-primary);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(10, 16, 28, 0.6);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--neon-cyan);
}

/* Layout App Wrapper */
.app-wrapper {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  gap: 1.5rem;
}

/* =========================================================
   HEADER
   ========================================================= */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
}

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

.brand-icon-wrapper {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(0, 242, 254, 0.2), rgba(79, 172, 254, 0.2));
  border: 1px solid var(--border-glass-glow);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-icon {
  font-size: 1.35rem;
  color: var(--neon-cyan);
  filter: drop-shadow(0 0 8px rgba(0, 242, 254, 0.6));
}

.pulse-ring {
  position: absolute;
  inset: -3px;
  border-radius: 14px;
  border: 1.5px solid var(--neon-cyan);
  opacity: 0;
  animation: pulseEffect 2.5s infinite;
}

@keyframes pulseEffect {
  0% { transform: scale(0.95); opacity: 0.8; }
  70% { transform: scale(1.25); opacity: 0; }
  100% { transform: scale(1.25); opacity: 0; }
}

.brand-text h1 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #ffffff, #d8f5ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.badge-ai {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-blue));
  color: var(--text-inverse);
  -webkit-text-fill-color: var(--text-inverse);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.4);
}

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

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

.status-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--border-glass);
  background: rgba(10, 16, 30, 0.5);
  transition: var(--transition-normal);
}

.status-chip.loading {
  color: var(--neon-amber);
  border-color: rgba(245, 158, 11, 0.3);
}
.status-chip.loading .status-dot {
  background: var(--neon-amber);
  box-shadow: 0 0 8px var(--neon-amber);
  animation: blinkDot 1s infinite alternate;
}

.status-chip.ready {
  color: var(--neon-emerald);
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.08);
}
.status-chip.ready .status-dot {
  background: var(--neon-emerald);
  box-shadow: 0 0 8px var(--neon-emerald);
}

.status-chip.error {
  color: var(--neon-rose);
  border-color: rgba(244, 63, 94, 0.3);
}
.status-chip.error .status-dot {
  background: var(--neon-rose);
  box-shadow: 0 0 8px var(--neon-rose);
}

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

@keyframes blinkDot {
  from { opacity: 0.3; }
  to { opacity: 1; }
}

/* =========================================================
   BUTTONS & UI CONTROLS
   ========================================================= */
button {
  font-family: var(--font-primary);
  cursor: pointer;
  border: none;
  outline: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  transition: var(--transition-fast);
}

.btn-primary {
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-blue));
  color: var(--text-inverse);
  padding: 0.65rem 1.25rem;
  border-radius: 10px;
  font-size: 0.9rem;
  box-shadow: 0 4px 15px rgba(0, 242, 254, 0.3);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 242, 254, 0.45);
}
.btn-primary:active {
  transform: translateY(0);
}
.btn-primary.btn-danger {
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(244, 63, 94, 0.35);
}
.btn-primary.btn-danger:hover {
  box-shadow: 0 6px 20px rgba(244, 63, 94, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid var(--border-glass);
  padding: 0.65rem 1.1rem;
  border-radius: 10px;
  font-size: 0.9rem;
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  font-size: 1rem;
}
.btn-icon:hover {
  color: var(--neon-cyan);
  background: rgba(0, 242, 254, 0.1);
  border-color: var(--border-glass-glow);
}

.btn-text-sm {
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border-glass);
}
.btn-text-sm:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

.w-full {
  width: 100%;
}

/* =========================================================
   MAIN GRID LAYOUT
   ========================================================= */
.main-layout {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 1.5rem;
  align-items: start;
}

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

/* =========================================================
   VIEWPORT & CAMERA SECTION
   ========================================================= */
.viewport-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.viewport-tabs {
  display: flex;
  gap: 0.5rem;
  background: rgba(14, 22, 38, 0.6);
  padding: 0.35rem;
  border-radius: 12px;
  border: 1px solid var(--border-glass);
  width: fit-content;
}

.tab-btn {
  padding: 0.55rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: transparent;
}
.tab-btn:hover {
  color: var(--text-main);
}
.tab-btn.active {
  background: linear-gradient(135deg, rgba(0, 242, 254, 0.15), rgba(79, 172, 254, 0.15));
  color: var(--neon-cyan);
  border: 1px solid var(--border-glass-glow);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.15);
}

/* Video Canvas Box */
.video-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  max-height: 520px;
  background: #020409;
  border-radius: 18px;
  overflow: hidden;
  border: 1.5px solid var(--border-glass);
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-container.state-sleep {
  border-color: var(--neon-rose);
  box-shadow: var(--glow-rose);
  animation: alertPulseBorder 1s infinite alternate;
}

@keyframes alertPulseBorder {
  from { border-color: rgba(244, 63, 94, 0.5); }
  to { border-color: rgba(244, 63, 94, 1); box-shadow: 0 0 35px rgba(244, 63, 94, 0.7); }
}

#webcamVideo,
#uploadedImage,
#uploadedVideo,
#displayCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* Mirror webcam */
}

#displayCanvas {
  pointer-events: none;
  z-index: 2;
}

#uploadedImage, #uploadedVideo {
  transform: none; /* Do not mirror uploaded media */
}

/* Cyber Scanning Grid Overlay */
.cyber-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-size: 30px 30px;
  background-image: 
    linear-gradient(to right, rgba(0, 242, 254, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 242, 254, 0.03) 1px, transparent 1px);
  z-index: 3;
}

.scanner-laser {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--neon-cyan), transparent);
  box-shadow: 0 0 15px var(--neon-cyan);
  opacity: 0;
  z-index: 4;
  pointer-events: none;
}

.video-container.active-scan .scanner-laser {
  opacity: 0.85;
  animation: scanSweep 3s ease-in-out infinite alternate;
}

@keyframes scanSweep {
  0% { top: 0%; }
  100% { top: 98%; }
}

/* Viewport Placeholder */
.viewport-placeholder {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  padding: 2rem;
  text-align: center;
  background: radial-gradient(circle at center, rgba(14, 22, 38, 0.95), rgba(7, 10, 19, 0.98));
}

.placeholder-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(0, 242, 254, 0.1);
  border: 1px solid var(--border-glass-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  color: var(--neon-cyan);
}

.viewport-placeholder h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
}
.viewport-placeholder p {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 380px;
}

/* Upload Dropzone */
.upload-dropzone {
  position: absolute;
  inset: 12px;
  z-index: 6;
  border: 2px dashed rgba(0, 242, 254, 0.4);
  border-radius: 14px;
  background: rgba(10, 16, 28, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-normal);
  cursor: pointer;
}
.upload-dropzone.dragover {
  border-color: var(--neon-cyan);
  background: rgba(0, 242, 254, 0.08);
  transform: scale(0.99);
}

.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  text-align: center;
  padding: 1.5rem;
}

.dropzone-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: rgba(0, 242, 254, 0.12);
  color: var(--neon-cyan);
  font-size: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-input-hidden {
  display: none;
}

/* Floating HUD */
.camera-hud {
  position: absolute;
  z-index: 7;
  display: flex;
  gap: 0.65rem;
  pointer-events: none;
}

.top-hud {
  top: 14px;
  left: 14px;
  right: 14px;
  justify-content: space-between;
}

.bottom-hud {
  bottom: 14px;
  left: 14px;
}

.hud-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  background: rgba(3, 7, 18, 0.75);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-main);
}

.hud-state .hud-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
}
.hud-state.state-awake {
  border-color: rgba(16, 185, 129, 0.4);
  color: var(--neon-emerald);
}
.hud-state.state-awake .hud-dot {
  background: var(--neon-emerald);
  box-shadow: 0 0 8px var(--neon-emerald);
}

.hud-state.state-drowsy {
  border-color: rgba(244, 63, 94, 0.6);
  color: var(--neon-rose);
  background: rgba(244, 63, 94, 0.15);
}
.hud-state.state-drowsy .hud-dot {
  background: var(--neon-rose);
  box-shadow: 0 0 8px var(--neon-rose);
  animation: blinkDot 0.4s infinite alternate;
}

.hud-drowsy-timer {
  background: rgba(244, 63, 94, 0.25);
  border-color: var(--neon-rose);
  color: #ff859e;
}

/* Viewport Toolbar */
.viewport-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* AI Prediction Metrics Card */
.ai-metrics-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  padding: 1rem 1.25rem;
  backdrop-filter: blur(12px);
  box-shadow: var(--card-shadow);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.85rem;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.card-title i {
  color: var(--neon-cyan);
}
.card-title h4 {
  font-size: 0.95rem;
  font-weight: 700;
}

.model-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border-glass);
}

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

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

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

.pred-pct {
  font-family: var(--font-mono);
  font-weight: 700;
}

.progress-track {
  height: 9px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
  position: relative;
}

.progress-bar {
  height: 100%;
  border-radius: 6px;
  transition: width 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.bar-awake {
  background: linear-gradient(90deg, #00f2fe, #10b981);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.bar-sleep {
  background: linear-gradient(90deg, #f59e0b, #f43f5e);
  box-shadow: 0 0 10px rgba(244, 63, 94, 0.5);
}

.text-cyan { color: var(--neon-cyan); }
.text-rose { color: var(--neon-rose); }
.text-emerald { color: var(--neon-emerald); }
.text-amber { color: var(--neon-amber); }

/* =========================================================
   RIGHT SIDEBAR DASHBOARD
   ========================================================= */
.dashboard-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.dash-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 1.25rem;
  backdrop-filter: blur(14px);
  box-shadow: var(--card-shadow);
}

/* Pomodoro Widget */
.pomodoro-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pomodoro-cycle {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: rgba(0, 242, 254, 0.1);
  color: var(--neon-cyan);
  border: 1px solid var(--border-glass-glow);
}

.pomodoro-modes {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.35rem;
  background: rgba(10, 16, 28, 0.6);
  padding: 0.25rem;
  border-radius: 10px;
}

.pomo-tab {
  padding: 0.45rem 0.2rem;
  border-radius: 7px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  text-align: center;
}
.pomo-tab.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.timer-display-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.5rem 0;
}

.timer-circle-svg-wrap {
  position: relative;
  width: 170px;
  height: 170px;
}

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

.timer-circle-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.05);
  stroke-width: 6;
}

.timer-circle-progress {
  fill: none;
  stroke: var(--neon-cyan);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 276.46;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke 0.3s ease;
  filter: drop-shadow(0 0 6px rgba(0, 242, 254, 0.5));
}

.timer-text-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.timer-digits {
  font-family: var(--font-mono);
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #ffffff;
}

.timer-status-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

.pomodoro-actions {
  display: flex;
  gap: 0.5rem;
}

.pomo-btn-main {
  flex: 1;
}

/* Stats Summary */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.stat-box {
  background: rgba(10, 16, 28, 0.55);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: var(--transition-fast);
}
.stat-box:hover {
  background: rgba(20, 31, 53, 0.6);
  border-color: rgba(255, 255, 255, 0.15);
}

.stat-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}
.icon-cyan { background: rgba(0, 242, 254, 0.12); color: var(--neon-cyan); }
.icon-rose { background: rgba(244, 63, 94, 0.12); color: var(--neon-rose); }
.icon-emerald { background: rgba(16, 185, 129, 0.12); color: var(--neon-emerald); }
.icon-amber { background: rgba(245, 158, 11, 0.12); color: var(--neon-amber); }

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

.stat-val {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
}

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

/* Logs & History */
.logs-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.log-actions {
  display: flex;
  gap: 0.35rem;
}

.logs-container {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.empty-log-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-subtle);
  gap: 0.5rem;
}
.empty-log-state i {
  font-size: 2rem;
  color: rgba(16, 185, 129, 0.3);
}
.empty-log-state p {
  font-size: 0.8rem;
}

.log-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  background: rgba(10, 16, 28, 0.5);
  border: 1px solid var(--border-glass);
  border-left: 3px solid var(--neon-rose);
  border-radius: 8px;
  gap: 0.5rem;
  animation: slideInLog 0.3s ease;
}

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

.log-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.log-thumb {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--border-glass);
  cursor: pointer;
  transition: var(--transition-fast);
}
.log-thumb:hover {
  transform: scale(1.08);
  border-color: var(--neon-cyan);
}

.log-meta {
  display: flex;
  flex-direction: column;
}
.log-time {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-main);
}
.log-dur {
  font-size: 0.7rem;
  color: var(--neon-rose);
}

.log-type-tag {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: rgba(244, 63, 94, 0.15);
  color: var(--neon-rose);
  font-weight: 600;
}

/* =========================================================
   FLASHING VISUAL ALARM OVERLAY
   ========================================================= */
.alarm-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(244, 63, 94, 0.2);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  animation: strobeRed 0.6s infinite alternate;
}

.alarm-overlay.active {
  opacity: 1;
  pointer-events: all;
}

@keyframes strobeRed {
  0% { background: rgba(244, 63, 94, 0.15); }
  100% { background: rgba(244, 63, 94, 0.35); }
}

.alarm-banner {
  background: #110508;
  border: 2px solid var(--neon-rose);
  box-shadow: 0 0 40px rgba(244, 63, 94, 0.8);
  border-radius: 16px;
  padding: 1.25rem 1.75rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  max-width: 600px;
  width: 90%;
  animation: bannerBounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes bannerBounce {
  from { transform: translateY(-30px) scale(0.9); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.alarm-banner i.fa-triangle-exclamation {
  font-size: 2.2rem;
  color: var(--neon-rose);
  animation: shakeIcon 0.5s infinite;
}

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

.alarm-banner-text h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.alarm-banner-text p {
  font-size: 0.85rem;
  color: #ffb4c3;
}

.btn-dismiss-alarm {
  background: var(--neon-rose);
  color: #ffffff;
  padding: 0.65rem 1.1rem;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 0 15px rgba(244, 63, 94, 0.5);
}
.btn-dismiss-alarm:hover {
  background: #e11d48;
  transform: scale(1.03);
}

/* =========================================================
   SETTINGS MODAL & LIGHTBOX
   ========================================================= */
.modal-overlay, .lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.8);
  backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-overlay.open, .lightbox-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal-card {
  background: #0b101c;
  border: 1px solid var(--border-glass-glow);
  border-radius: 20px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
  transform: scale(0.95);
  transition: transform var(--transition-bounce);
}

.modal-overlay.open .modal-card {
  transform: scale(1);
}

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

.modal-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.modal-title i {
  color: var(--neon-cyan);
}
.modal-title h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.btn-icon-close {
  background: transparent;
  color: var(--text-muted);
  font-size: 1.15rem;
  padding: 0.35rem;
}
.btn-icon-close:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

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

.label-with-val {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.val-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  background: rgba(0, 242, 254, 0.1);
  color: var(--neon-cyan);
  border-radius: 6px;
  font-weight: 700;
}

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

.form-input, .form-select {
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  font-family: var(--font-primary);
  font-size: 0.85rem;
  outline: none;
  transition: var(--transition-fast);
}
.form-input:focus, .form-select:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.2);
}

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

/* Range Slider */
.range-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
}
.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--neon-cyan);
  cursor: pointer;
  box-shadow: 0 0 10px var(--neon-cyan);
  transition: transform 0.1s ease;
}
.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Toggle Switches */
.toggle-group {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  transition: var(--transition-fast);
}
.switch-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: var(--transition-fast);
}
.switch input:checked + .switch-slider {
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-blue));
}
.switch input:checked + .switch-slider:before {
  transform: translateX(20px);
}

.modal-footer {
  padding: 1rem 1.5rem 1.25rem;
  border-top: 1px solid var(--border-glass);
}

/* Lightbox Content */
.lightbox-content {
  position: relative;
  max-width: 650px;
  width: 100%;
  background: #0b101c;
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.lightbox-content img {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  background: #000000;
}

.lightbox-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #ffffff;
  font-size: 1rem;
}

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

/* Footer */
.app-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border-glass);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-subtle);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.footer-links a {
  color: var(--neon-cyan);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.footer-links a:hover {
  text-decoration: underline;
}

.hidden-element {
  display: none !important;
}
