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

:root {
  --bg-primary: #07090e;
  --bg-secondary: #0d121d;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(16, 185, 129, 0.4);
  
  --color-emerald: #10b981;
  --color-emerald-glow: rgba(16, 185, 129, 0.25);
  --color-amber: #f59e0b;
  --color-amber-glow: rgba(245, 158, 11, 0.25);
  --color-cyan: #06b6d4;
  --color-cyan-glow: rgba(6, 182, 212, 0.25);
  --color-rose: #f43f5e;
  --color-indigo: #6366f1;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-primary);
  color: #f3f4f6;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

.font-mono {
  font-family: 'JetBrains Mono', monospace;
}

/* Background Ambient Lighting */
.ambient-glow {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 600px;
  background: radial-gradient(circle at 50% -10%, rgba(16, 185, 129, 0.12), rgba(6, 182, 212, 0.05), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.ambient-glow-bottom {
  position: fixed;
  bottom: 0;
  right: 0;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle at 100% 100%, rgba(99, 102, 241, 0.08), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Glassmorphism Styles */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: 1rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.glass-panel:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

.glass-panel-glow-emerald:hover {
  border-color: var(--color-emerald);
  box-shadow: 0 10px 30px -5px var(--color-emerald-glow);
}

.glass-panel-glow-amber:hover {
  border-color: var(--color-amber);
  box-shadow: 0 10px 30px -5px var(--color-amber-glow);
}

.glass-panel-glow-cyan:hover {
  border-color: var(--color-cyan);
  box-shadow: 0 10px 30px -5px var(--color-cyan-glow);
}

.glass-input {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-subtle);
  color: #f3f4f6;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
}

.glass-input:focus {
  outline: none;
  border-color: var(--color-emerald);
  box-shadow: 0 0 0 3px var(--color-emerald-glow);
}

.glass-btn {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(8px);
  color: #e2e8f0;
  transition: all 0.2s ease;
}

.glass-btn:hover {
  background: rgba(51, 65, 85, 0.9);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  transform: translateY(-1px);
}

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

.glass-btn-emerald {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(5, 150, 105, 0.4));
  border: 1px solid rgba(16, 185, 129, 0.5);
  color: #6ee7b7;
}

.glass-btn-emerald:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.4), rgba(5, 150, 105, 0.6));
  border-color: #10b981;
  color: #ffffff;
  box-shadow: 0 0 15px var(--color-emerald-glow);
}

.glass-badge {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(6px);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.6);
}

::-webkit-scrollbar-thumb {
  background: rgba(71, 85, 105, 0.6);
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.9);
}

/* Range Slider Styling */
input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(30, 41, 59, 0.9);
  border-radius: 9999px;
  outline: none;
  transition: background 0.2s;
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #10b981;
  cursor: pointer;
  border: 2px solid #ffffff;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.8);
  transition: transform 0.15s ease, background 0.15s ease;
}

input[type=range]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  background: #34d399;
}

input[type=range].slider-amber::-webkit-slider-thumb {
  background: #f59e0b;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.8);
}
input[type=range].slider-amber::-webkit-slider-thumb:hover {
  background: #fbbf24;
}

input[type=range].slider-cyan::-webkit-slider-thumb {
  background: #06b6d4;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.8);
}
input[type=range].slider-cyan::-webkit-slider-thumb:hover {
  background: #22d3ee;
}

/* Video Stage Container */
.video-container {
  position: relative;
  background: #000000;
  border-radius: 0.875rem;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8), 0 15px 35px -5px rgba(0, 0, 0, 0.7);
}

.video-container video,
.video-container img,
.video-container canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.canvas-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Pulse Beacon */
.pulse-beacon {
  position: relative;
  display: inline-flex;
}

.pulse-beacon::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 50%;
  background: inherit;
  animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes pulse-ring {
  0% {
    transform: scale(0.95);
    opacity: 0.8;
  }
  50% {
    transform: scale(2.2);
    opacity: 0;
  }
  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

/* Active Crossing Flash */
@keyframes counter-flash {
  0% {
    transform: scale(1);
    color: #ffffff;
  }
  30% {
    transform: scale(1.12);
    color: #34d399;
    text-shadow: 0 0 25px rgba(16, 185, 129, 0.9);
  }
  100% {
    transform: scale(1);
    color: #ffffff;
  }
}

.flash-trigger {
  animation: counter-flash 0.4s ease-out;
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #334155;
  transition: .3s;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .switch-slider {
  background-color: #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

input:checked + .switch-slider.slider-amber {
  background-color: #f59e0b;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

input:checked + .switch-slider.slider-cyan {
  background-color: #06b6d4;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

input:checked + .switch-slider:before {
  transform: translateX(20px);
}

/* Table styling */
.log-table th {
  position: sticky;
  top: 0;
  background: #0f172a;
  z-index: 10;
}

.log-table tr {
  transition: background-color 0.15s ease;
}

.log-table tr:hover {
  background-color: rgba(30, 41, 59, 0.6);
}

/* Picture in Picture Floating Preview */
.pip-window {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  width: 220px;
  height: 130px;
  background: #000000;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 2px solid rgba(16, 185, 129, 0.6);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.8);
  z-index: 20;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.pip-window:hover {
  transform: scale(1.05);
}

/* Modal Backdrop */
.modal-backdrop {
  background: rgba(3, 7, 18, 0.8);
  backdrop-filter: blur(8px);
}
