:root {
  --bg-dark: #0a0e17;
  --bg-card: rgba(22, 28, 45, 0.75);
  --bg-card-hover: rgba(30, 39, 62, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --accent-cyan: #00f2fe;
  --accent-blue: #4facfe;
  --accent-green: #10b981;
  --accent-purple: #8b5cf6;
  --accent-pink: #ec4899;
  --accent-orange: #f97316;
  --accent-red: #ef4444;
  --accent-yellow: #eab308;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --radius-lg: 16px;
  --radius-md: 10px;
  --shadow-glow: 0 8px 32px 0 rgba(0, 242, 254, 0.15);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(at 0% 0%, rgba(79, 172, 254, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.12) 0px, transparent 50%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
  background: rgba(10, 14, 23, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0a0e17;
  font-size: 20px;
  font-weight: bold;
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.4);
}

.brand-title {
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(90deg, #ffffff, var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.controls-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.date-selector-container {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  padding: 6px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.date-selector-container label {
  font-size: 13px;
  color: var(--text-muted);
}

select {
  background: transparent;
  color: var(--text-main);
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

select option {
  background: #161c2d;
  color: var(--text-main);
}

/* Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
  padding: 24px 28px;
  flex: 1;
}

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

/* Main View Area */
.main-view {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Dual Player Grid */
.player-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  background: var(--bg-card);
  padding: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-glow);
}

@media (max-width: 768px) {
  .player-grid {
    grid-template-columns: 1fr;
  }
}

.camera-card {
  position: relative;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.camera-card video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cam-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(10, 14, 23, 0.75);
  backdrop-filter: blur(8px);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 242, 254, 0.3);
  display: flex;
  align-items: center;
  gap: 6px;
}

.cam-badge .dot {
  width: 8px;
  height: 8px;
  background: var(--accent-green);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-green);
}

.btn-badge-audio {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  margin-left: 8px;
  transition: all 0.2s ease;
}

.btn-badge-audio:hover {
  background: rgba(0, 242, 254, 0.25);
  border-color: var(--accent-cyan);
}

.btn-badge-audio.muted {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.no-video-placeholder {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 20px 10px;
}

/* Master Player Controls */
.master-controls {
  background: var(--bg-card);
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.seek-container {
  display: flex;
  align-items: center;
  gap: 14px;
}

.time-display {
  font-family: monospace;
  font-size: 13px;
  color: var(--accent-cyan);
  min-width: 110px;
}

input[type="range"] {
  flex: 1;
  accent-color: var(--accent-cyan);
  height: 6px;
  border-radius: 3px;
  cursor: pointer;
}

.buttons-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.btn-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
  user-select: none;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 6px;
}

.btn:hover {
  background: rgba(0, 242, 254, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  color: #0a0e17;
  border: none;
  font-weight: 700;
}

.btn-primary:hover {
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.5);
  transform: translateY(-1px);
}

.btn-ai-pulse {
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  color: #ffffff;
  border: none;
  font-weight: 700;
  box-shadow: 0 0 12px rgba(236, 72, 153, 0.4);
  animation: pulseAI 2s infinite;
}

.btn-ai-pulse:hover {
  box-shadow: 0 0 20px rgba(236, 72, 153, 0.8);
  transform: translateY(-1px);
}

@keyframes pulseAI {
  0% { transform: scale(1); box-shadow: 0 0 8px rgba(236, 72, 153, 0.4); }
  50% { transform: scale(1.03); box-shadow: 0 0 16px rgba(236, 72, 153, 0.7); }
  100% { transform: scale(1); box-shadow: 0 0 8px rgba(236, 72, 153, 0.4); }
}

.btn-secondary {
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.4);
}

.btn-secondary:hover {
  background: rgba(139, 92, 246, 0.35);
  color: #fff;
  border-color: var(--accent-purple);
}

/* Timeline Section */
.timeline-card {
  background: var(--bg-card);
  padding: 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.timeline-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
}

.timeline-bar-wrapper {
  position: relative;
  height: 64px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 10px;
  overflow: hidden;
  cursor: crosshair;
  border: 1px solid var(--border-color);
}

.timeline-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.hover-badge {
  position: absolute;
  top: 4px;
  left: 0;
  background: rgba(0, 242, 254, 0.9);
  color: #0a0e17;
  font-family: monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  transform: translateX(-50%);
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.timeline-instructions {
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
  margin-top: -4px;
}

/* Sidebar & Tabs */
.sidebar {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.sidebar-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px;
  border-radius: 10px;
  gap: 4px;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: rgba(0, 242, 254, 0.15);
  color: var(--accent-cyan);
}

.tab-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.trip-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.trip-item:hover, .trip-item.active {
  background: rgba(0, 242, 254, 0.08);
  border-color: var(--accent-cyan);
}

.trip-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.trip-time {
  font-weight: 700;
  font-size: 14px;
  color: var(--accent-cyan);
}

.trip-badge {
  font-size: 11px;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 8px;
  border-radius: 6px;
  color: var(--text-muted);
}

/* Infractions Card Item */
.infraction-item {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.infraction-item:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--accent-red);
}

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

.infraction-title {
  font-weight: 700;
  font-size: 13px;
  color: #fca5a5;
}

.infraction-time {
  font-family: monospace;
  font-size: 12px;
  color: var(--accent-cyan);
}

.infraction-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
