/* ==========================================================================
   SMART AI ALARM - MODERN DARK MODE DESIGN SYSTEM
   ========================================================================== */

:root {
  /* Color Palette */
  --bg-main: #090d16;
  --bg-surface: rgba(17, 24, 39, 0.75);
  --bg-surface-elevated: rgba(30, 41, 59, 0.8);
  --bg-surface-hover: rgba(51, 65, 85, 0.6);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.6);

  /* Brand Accents */
  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-primary-glow: rgba(99, 102, 241, 0.35);
  
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.3);
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-rose-glow: rgba(244, 63, 94, 0.4);

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

  /* Text Colors */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0f172a;

  /* Shadows & Glass */
  --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5), 0 0 1px 1px rgba(255, 255, 255, 0.05);
  --glass-blur: blur(16px);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

/* Ambient Background Lights */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.45;
  transition: background 1s ease, opacity 0.5s ease;
}

.glow-1 {
  top: -10%;
  left: -5%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #4338ca, transparent 70%);
}

.glow-2 {
  bottom: 0%;
  right: -5%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #0e7490, transparent 70%);
}

.grid-overlay {
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: 0;
}

/* Ringing Screen Overlay (Pulsing Red) */
.ringing-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99;
  opacity: 0;
  box-shadow: inset 0 0 100px 30px rgba(239, 68, 68, 0.5);
  transition: opacity 0.3s ease;
}

body.alarm-active .ringing-overlay {
  opacity: 1;
  animation: pulseAlarmGlow 1s infinite alternate cubic-bezier(0.4, 0, 0.6, 1);
}

body.alarm-active .glow-1 {
  background: radial-gradient(circle, #e11d48, transparent 70%);
  opacity: 0.7;
}
body.alarm-active .glow-2 {
  background: radial-gradient(circle, #be123c, transparent 70%);
  opacity: 0.6;
}

@keyframes pulseAlarmGlow {
  0% { box-shadow: inset 0 0 70px 20px rgba(239, 68, 68, 0.4); }
  100% { box-shadow: inset 0 0 140px 60px rgba(239, 68, 68, 0.85); }
}

/* App Wrapper Layout */
.app-wrapper {
  position: relative;
  z-index: 1;
  max-width: 1360px;
  margin: 0 auto;
  padding: 1.5rem 2rem 2.5rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  gap: 1.5rem;
}

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

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

.brand-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 15px var(--accent-primary-glow);
  transition: transform var(--transition-normal);
}

body.alarm-active .brand-icon {
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  box-shadow: 0 0 25px rgba(244, 63, 94, 0.7);
  animation: shakeAlarm 0.5s infinite;
}

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

.brand-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #ffffff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-tagline {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Status Badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  background: rgba(15, 23, 42, 0.6);
  transition: all var(--transition-normal);
}

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

.status-idle .status-dot { background: var(--text-muted); }
.status-armed {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
}
.status-armed .status-dot {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulseDot 1.5s infinite;
}

.status-ringing {
  border-color: rgba(244, 63, 94, 0.5);
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
}
.status-ringing .status-dot {
  background: #f43f5e;
  box-shadow: 0 0 12px #f43f5e;
  animation: pulseDot 0.6s infinite;
}

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

/* ==========================================================================
   DASHBOARD GRID
   ========================================================================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 390px 1fr;
  gap: 1.5rem;
  align-items: start;
}

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

/* Generic Glass Card */
.glass-card {
  background: var(--bg-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  box-shadow: var(--card-shadow);
  transition: transform var(--transition-normal), border-color var(--transition-normal);
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

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

.card-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.card-title svg {
  color: var(--accent-cyan);
}

.card-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

/* ==========================================================================
   DIGITAL CLOCK
   ========================================================================== */
.clock-card {
  text-align: center;
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.8));
  border-color: rgba(99, 102, 241, 0.2);
}

.digital-clock {
  font-family: var(--font-mono);
  font-size: 3.4rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #fff;
  text-shadow: 0 0 25px rgba(99, 102, 241, 0.5);
  line-height: 1.1;
  margin: 0.35rem 0;
}

.clock-seconds {
  font-size: 2.2rem;
  color: var(--accent-cyan);
  opacity: 0.9;
}

.clock-date {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ==========================================================================
   ALARM FORM CONTROLS
   ========================================================================== */
.time-input-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin: 1.2rem 0;
}

.time-field {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.time-field label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-weight: 600;
}

.time-field input {
  width: 90px;
  height: 70px;
  background: rgba(15, 23, 42, 0.8);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 2.4rem;
  font-weight: 700;
  color: #fff;
  text-align: center;
  transition: all var(--transition-fast);
}

.time-field input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 20px var(--accent-primary-glow);
  background: rgba(30, 41, 59, 0.9);
}

/* Remove number spin buttons */
.time-field input::-webkit-outer-spin-button,
.time-field input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.time-field input[type=number] {
  -moz-appearance: textfield;
}

.time-colon {
  font-family: var(--font-mono);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-top: 1.25rem;
}

/* Presets */
.preset-chips {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

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

.chip-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chip-btn:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--accent-primary);
  color: #fff;
}

/* Buttons */
.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.25rem;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), #4338ca);
  color: #ffffff;
  box-shadow: 0 4px 15px var(--accent-primary-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #7174ff, #4f46e5);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-danger {
  background: linear-gradient(135deg, #f43f5e, #be123c);
  color: #ffffff;
  box-shadow: 0 4px 15px var(--accent-rose-glow);
}

.btn-danger:hover {
  background: linear-gradient(135deg, #fb7185, #e11d48);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-xs {
  padding: 0.3rem 0.65rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
}

.btn-small {
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
}

.btn-full {
  width: 100%;
}

.icon-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Alarm Countdown Badge */
.alarm-countdown {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.65rem;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  color: #34d399;
}

/* ==========================================================================
   MODEL SETTINGS & AUDIO CARD
   ========================================================================== */
.model-info {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-size: 0.85rem;
}

.model-status-row, .model-classes-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.model-classes-row {
  flex-direction: column;
  align-items: flex-start;
}

.info-label {
  color: var(--text-secondary);
  font-weight: 500;
}

.badge-status {
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.class-tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.25rem;
  width: 100%;
}

.class-tag {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.model-url-form {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

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

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

.input-with-button input {
  flex: 1;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.8rem;
  font-family: var(--font-mono);
}

.input-with-button input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.help-text {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.help-text code {
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

/* Audio Volume */
.volume-slider-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.volume-slider-group input[type="range"] {
  accent-color: var(--accent-primary);
  height: 6px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
}

/* ==========================================================================
   PANEL KANAN: CHALLENGE CARD
   ========================================================================== */
.challenge-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.9));
  border: 1px solid rgba(99, 102, 241, 0.25);
  position: relative;
  overflow: hidden;
  transition: all var(--transition-normal);
}

body.alarm-active .challenge-card {
  border-color: rgba(244, 63, 94, 0.7);
  box-shadow: 0 0 35px rgba(244, 63, 94, 0.35);
  background: linear-gradient(135deg, rgba(88, 28, 44, 0.7), rgba(26, 12, 20, 0.9));
  animation: borderGlow 1.2s infinite alternate;
}

@keyframes borderGlow {
  0% { border-color: rgba(244, 63, 94, 0.5); }
  100% { border-color: rgba(244, 63, 94, 1); }
}

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

.challenge-tag {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--accent-cyan);
  text-transform: uppercase;
}

body.alarm-active .challenge-tag {
  color: #fda4af;
}

.challenge-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

body.alarm-active .challenge-badge {
  background: rgba(244, 63, 94, 0.2);
  color: #fda4af;
  border: 1px solid rgba(244, 63, 94, 0.4);
}

.challenge-main {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin: 0.5rem 0 1.25rem;
}

.challenge-icon-box {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-md);
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
  flex-shrink: 0;
}

body.alarm-active .challenge-icon-box {
  background: rgba(244, 63, 94, 0.2);
  border-color: #f43f5e;
  color: #f43f5e;
  animation: pulseIcon 0.8s infinite alternate;
}

@keyframes pulseIcon {
  0% { transform: scale(0.95); }
  100% { transform: scale(1.05); }
}

.challenge-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.challenge-target {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #fff;
  text-transform: uppercase;
  margin-top: 0.15rem;
}

body.alarm-active .challenge-target {
  color: #ffffff;
  text-shadow: 0 0 20px rgba(244, 63, 94, 0.8);
}

/* 2-Second Hold Progress Indicator */
.hold-indicator-wrapper {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.hold-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}

.hold-label {
  color: var(--text-secondary);
  font-weight: 500;
}

.hold-timer {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-emerald);
}

.hold-progress-track {
  height: 12px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.hold-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #10b981, #34d399, #6ee7b7);
  border-radius: var(--radius-full);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.6);
  transition: width 0.08s linear;
}

/* ==========================================================================
   WEBCAM CARD & HUD VIEWPORT
   ========================================================================== */
.webcam-card {
  padding: 1rem;
  position: relative;
}

body.alarm-active .webcam-card {
  border-color: rgba(244, 63, 94, 0.4);
}

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

.webcam-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

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

.recording-dot.active {
  background: #f43f5e;
  box-shadow: 0 0 8px #f43f5e;
  animation: pulseDot 1s infinite;
}

.webcam-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 280px;
  background: #020617;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Placeholder */
.webcam-placeholder {
  text-align: center;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-muted);
}

.placeholder-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  justify-content: center;
}

.placeholder-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.placeholder-desc {
  font-size: 0.8rem;
  max-width: 320px;
  line-height: 1.4;
}

/* Canvas from tmImage */
.canvas-holder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.canvas-holder canvas {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  transform: scaleX(-1); /* Mirror camera feed for natural interaction */
}

/* HUD Overlay */
.hud-overlay {
  position: absolute;
  inset: 12px;
  pointer-events: none;
  z-index: 2;
  opacity: 0.7;
}

.hud-corner {
  position: absolute;
  width: 24px;
  height: 24px;
  border-color: var(--accent-cyan);
  border-style: solid;
}

.hud-corner.top-left { top: 0; left: 0; border-width: 2px 0 0 2px; }
.hud-corner.top-right { top: 0; right: 0; border-width: 2px 2px 0 0; }
.hud-corner.bottom-left { bottom: 0; left: 0; border-width: 0 0 2px 2px; }
.hud-corner.bottom-right { bottom: 0; right: 0; border-width: 0 2px 2px 0; }

.hud-scanner-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
  box-shadow: 0 0 10px var(--accent-cyan);
  opacity: 0;
  top: 0;
}

body.alarm-active .hud-scanner-line {
  opacity: 1;
  background: linear-gradient(90deg, transparent, #f43f5e, transparent);
  box-shadow: 0 0 15px #f43f5e;
  animation: scanWebcam 2s infinite ease-in-out;
}

@keyframes scanWebcam {
  0% { top: 0%; }
  50% { top: 98%; }
  100% { top: 0%; }
}

/* Camera Error Alert */
.alert-box {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  display: flex;
  gap: 0.75rem;
  font-size: 0.85rem;
}

.alert-error {
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: #fda4af;
}

.alert-error svg {
  color: #f43f5e;
  flex-shrink: 0;
}

/* ==========================================================================
   AI PREDICTIONS METER
   ========================================================================== */
.predictions-card {
  padding: 1.25rem;
}

.threshold-pill {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
}

.prediction-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 0.5rem;
}

.prediction-placeholder {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 1rem 0;
}

/* Single Prediction Item */
.prediction-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: all var(--transition-fast);
}

.prediction-item.is-target {
  background: rgba(99, 102, 241, 0.08);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(99, 102, 241, 0.35);
}

.prediction-item.is-target.is-validating {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.5);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
}

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

.pred-name {
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.pred-target-badge {
  font-size: 0.65rem;
  text-transform: uppercase;
  background: var(--accent-primary);
  color: #fff;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
}

.pred-percent {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.pred-meter-track {
  height: 8px;
  background: rgba(15, 23, 42, 0.7);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.pred-meter-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6366f1, #06b6d4);
  border-radius: var(--radius-full);
  transition: width 0.1s ease-out, background 0.2s ease;
}

/* When target hits >= 85% */
.pred-meter-fill.pass-threshold {
  background: linear-gradient(90deg, #10b981, #34d399);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
}

/* ==========================================================================
   MODAL SUKSES (ALARM RESOLVED)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 13, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
  animation: fadeIn 0.3s ease;
}

.modal-card {
  background: #0f172a;
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  max-width: 460px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 40px rgba(16, 185, 129, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  animation: scaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.success-icon-badge {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #059669);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 10px 30px rgba(16, 185, 129, 0.4);
  margin-bottom: 0.5rem;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #ffffff;
}

.modal-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.highlight-text {
  color: #34d399;
  font-weight: 700;
}

.modal-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  width: 100%;
  margin: 0.5rem 0;
  background: rgba(255, 255, 255, 0.03);
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.stat-val {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

.text-success {
  color: #34d399 !important;
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: #1e293b;
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 0.8rem 1.2rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  pointer-events: auto;
  animation: slideInRight 0.3s ease;
}

.toast.toast-success { border-color: #10b981; }
.toast.toast-error { border-color: #f43f5e; }
.toast.toast-info { border-color: #06b6d4; }

/* ==========================================================================
   FOOTER & UTILITIES
   ========================================================================== */
.app-footer {
  margin-top: auto;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 1rem 0;
}

.hidden {
  display: none !important;
}

.skeleton {
  opacity: 0.5;
  animation: pulseSkeleton 1.2s infinite alternate;
}

@keyframes pulseSkeleton {
  0% { opacity: 0.3; }
  100% { opacity: 0.7; }
}

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

@keyframes scaleUp {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

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

/* ==========================================================================
   RESPONSIVE BREAKPOINTS
   ========================================================================== */
@media (max-width: 980px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .panel-left {
    order: 2;
  }

  .panel-right {
    order: 1;
  }

  .app-wrapper {
    padding: 1rem;
  }
}

@media (max-width: 540px) {
  .digital-clock {
    font-size: 2.5rem;
  }
  .clock-seconds {
    font-size: 1.6rem;
  }
  .time-field input {
    width: 70px;
    height: 60px;
    font-size: 1.8rem;
  }
  .challenge-target {
    font-size: 1.35rem;
  }
}
