/* ==========================================================================
   RAPID Dashboard - Industrial Safari Aesthetic
   Ngorongoro Gate Processing System
   ========================================================================== */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=JetBrains+Mono:wght@400;500;600&family=Source+Sans+3:wght@300;400;600;700&display=swap');

/* ==========================================================================
   CSS Variables - The Savanna Palette
   ========================================================================== */
:root {
  /* Core Colors */
  --bg-deep: #0a0b0d;
  --bg-primary: #12141a;
  --bg-secondary: #1a1d24;
  --bg-elevated: #22262f;
  --bg-hover: #2a2f3a;

  /* Accent - Safari Gold/Amber */
  --accent-primary: #d4a853;
  --accent-light: #e8c777;
  --accent-glow: rgba(212, 168, 83, 0.15);
  --accent-intense: #ffb830;

  /* Accent Secondary - Savanna Teal */
  --teal: #2dd4bf;
  --teal-glow: rgba(45, 212, 191, 0.12);

  /* Status Colors */
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;

  /* Text */
  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --text-inverse: #0a0b0d;

  /* Borders & Lines */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.1);
  --border-accent: rgba(212, 168, 83, 0.3);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px var(--accent-glow);

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Typography */
  --font-display: 'Bebas Neue', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --font-body: 'Source Sans 3', sans-serif;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--text-primary);
  background: var(--bg-deep);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Noise Texture Overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  opacity: 0.025;
  pointer-events: none;
  z-index: 9999;
}

/* ==========================================================================
   Layout
   ========================================================================== */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 260px;
  background: var(--bg-primary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-header {
  padding: var(--space-xl);
  border-bottom: 1px solid var(--border-subtle);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  text-decoration: none;
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-light));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--text-inverse);
  letter-spacing: 1px;
}

.logo-text {
  font-family: var(--font-display);
  font-size: 1.75rem;
  color: var(--text-primary);
  letter-spacing: 3px;
}

.logo-subtitle {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-top: 2px;
}

/* Navigation */
.nav-section {
  padding: var(--space-lg) var(--space-md);
}

.nav-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 0 var(--space-md);
  margin-bottom: var(--space-sm);
}

.nav-list {
  list-style: none;
}

.nav-item {
  margin-bottom: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-md);
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  position: relative;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-link.active {
  color: var(--accent-primary);
  background: var(--accent-glow);
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent-primary);
  border-radius: 0 2px 2px 0;
}

.nav-icon {
  width: 20px;
  height: 20px;
  opacity: 0.7;
}

.nav-link.active .nav-icon,
.nav-link:hover .nav-icon {
  opacity: 1;
}

/* Status indicator */
.nav-status {
  margin-left: auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.nav-status.online {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

/* Sidebar Footer */
.sidebar-footer {
  margin-top: auto;
  padding: var(--space-lg);
  border-top: 1px solid var(--border-subtle);
}

.system-info {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.system-info-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-xs);
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: 260px;
  min-height: 100vh;
}

/* Page Header */
.page-header {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-subtle);
  padding: var(--space-xl) var(--space-2xl);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
}

.page-title {
  font-family: var(--font-display);
  font-size: 2.5rem;
  letter-spacing: 4px;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

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

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}

.breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.breadcrumb a:hover {
  color: var(--accent-primary);
}

.breadcrumb-sep {
  opacity: 0.4;
}

/* Page Content */
.page-content {
  padding: var(--space-2xl);
}

/* ==========================================================================
   Components
   ========================================================================== */

/* Cards */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-base);
}

.card:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
}

.card-header {
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  letter-spacing: 2px;
  color: var(--text-primary);
}

.card-body {
  padding: var(--space-xl);
}

.card-footer {
  padding: var(--space-lg) var(--space-xl);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
}

/* Model Cards (Dashboard Home) */
.model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-xl);
}

.model-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  position: relative;
  overflow: hidden;
  transition: all var(--transition-base);
  cursor: pointer;
  text-decoration: none;
  display: block;
}

.model-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-primary), transparent);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.model-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.model-card:hover::before {
  opacity: 1;
}

.model-icon {
  width: 56px;
  height: 56px;
  background: var(--accent-glow);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-lg);
}

.model-icon svg {
  width: 28px;
  height: 28px;
  color: var(--accent-primary);
}

.model-name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: 2px;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.model-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: var(--space-lg);
}

.model-meta {
  display: flex;
  gap: var(--space-lg);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--text-muted);
}

.meta-value {
  color: var(--accent-primary);
}

/* Status Badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.status-badge.online {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.status-badge.offline {
  background: rgba(239, 68, 68, 0.15);
  color: var(--error);
}

.status-badge.mock {
  background: rgba(59, 130, 246, 0.15);
  color: var(--info);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ==========================================================================
   Demo Interface
   ========================================================================== */

.demo-layout {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: var(--space-xl);
}

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

/* Upload Zone */
.upload-zone {
  border: 2px dashed var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-3xl);
  text-align: center;
  transition: all var(--transition-base);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.upload-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-glow), transparent);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--accent-primary);
  background: var(--accent-glow);
}

.upload-zone:hover::before,
.upload-zone.dragover::before {
  opacity: 1;
}

.upload-zone.has-image {
  padding: var(--space-md);
}

.upload-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-lg);
  color: var(--accent-primary);
  opacity: 0.6;
}

.upload-text {
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

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

.upload-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  pointer-events: none;
}

/* Preview Image */
.preview-container {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-deep);
}

.preview-image {
  width: 100%;
  height: auto;
  display: block;
}

.preview-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 40%);
  pointer-events: none;
}

/* Results Panel */
.results-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.results-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: 2px;
}

.results-body {
  max-height: 500px;
  overflow-y: auto;
}

.results-empty {
  padding: var(--space-3xl);
  text-align: center;
  color: var(--text-muted);
}

/* Detection Results */
.detection-item {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
}

.detection-item:hover {
  background: var(--bg-hover);
}

.detection-item:last-child {
  border-bottom: none;
}

.detection-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}

.detection-label {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent-primary);
}

.detection-confidence {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

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

.detection-tag {
  display: inline-block;
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  margin-right: var(--space-xs);
  margin-top: var(--space-xs);
}

/* Stats Bar */
.stats-bar {
  display: flex;
  gap: var(--space-xl);
  padding: var(--space-lg);
  background: var(--bg-elevated);
  border-top: 1px solid var(--border-subtle);
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--accent-primary);
  letter-spacing: 1px;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-light));
  color: var(--text-inverse);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-accent);
}

.btn-icon {
  padding: var(--space-md);
}

.btn-lg {
  padding: var(--space-lg) var(--space-2xl);
  font-size: 1rem;
}

/* ==========================================================================
   Processing Animation
   ========================================================================== */

.processing-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 11, 13, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.processing-overlay.active {
  opacity: 1;
  visibility: visible;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border-default);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.processing-text {
  margin-top: var(--space-lg);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent-primary);
  letter-spacing: 1px;
}

/* ==========================================================================
   Pipeline View (Combined)
   ========================================================================== */

.pipeline-flow {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
  overflow-x: auto;
  padding-bottom: var(--space-md);
}

.pipeline-step {
  flex: 0 0 auto;
  min-width: 140px;
  padding: var(--space-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  text-align: center;
  position: relative;
  transition: all var(--transition-base);
}

.pipeline-step::after {
  content: '';
  position: absolute;
  right: -16px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 8px solid var(--border-default);
}

.pipeline-step:last-child::after {
  display: none;
}

.pipeline-step.active {
  border-color: var(--accent-primary);
  background: var(--accent-glow);
}

.pipeline-step.completed {
  border-color: var(--success);
}

.pipeline-step.completed::before {
  content: '✓';
  position: absolute;
  top: -8px;
  right: -8px;
  width: 20px;
  height: 20px;
  background: var(--success);
  border-radius: 50%;
  font-size: 0.7rem;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-icon {
  width: 32px;
  height: 32px;
  margin: 0 auto var(--space-sm);
  color: var(--text-muted);
}

.pipeline-step.active .step-icon,
.pipeline-step.completed .step-icon {
  color: var(--accent-primary);
}

.step-name {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
}

.step-time {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

/* Pipeline Results Grid */
.pipeline-results {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-lg);
}

@media (max-width: 900px) {
  .pipeline-results {
    grid-template-columns: 1fr;
  }
}

.pipeline-result-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
}

.pipeline-result-card h4 {
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 2px;
  color: var(--accent-primary);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* ==========================================================================
   Home Page - Hero Section
   ========================================================================== */

.hero {
  text-align: center;
  padding: var(--space-3xl) 0;
  position: relative;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 300px;
  background: radial-gradient(ellipse, var(--accent-glow), transparent);
  pointer-events: none;
}

.hero-title {
  font-family: var(--font-display);
  font-size: 4rem;
  letter-spacing: 8px;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
  position: relative;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto var(--space-2xl);
}

/* African Pattern Decoration */
.pattern-divider {
  height: 40px;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='40' viewBox='0 0 60 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 20 L15 0 L30 20 L45 0 L60 20 L45 40 L30 20 L15 40 Z' fill='none' stroke='%23d4a853' stroke-width='1' opacity='0.3'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  margin: var(--space-2xl) 0;
  opacity: 0.5;
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.animate-in {
  animation: fadeInUp 0.6s ease forwards;
}

.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.4s; }

/* ==========================================================================
   Scrollbar
   ========================================================================== */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-elevated);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-base);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .page-header {
    padding: var(--space-lg);
  }

  .page-title {
    font-size: 1.8rem;
  }

  .page-content {
    padding: var(--space-lg);
  }

  .hero-title {
    font-size: 2.5rem;
    letter-spacing: 4px;
  }

  .demo-layout {
    grid-template-columns: 1fr;
  }
}

/* Mobile Menu Toggle */
.menu-toggle {
  display: none;
  position: fixed;
  top: var(--space-md);
  left: var(--space-md);
  z-index: 200;
  padding: var(--space-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
}

@media (max-width: 768px) {
  .menu-toggle {
    display: flex;
  }
}

/* ==========================================================================
   Live Stream
   ========================================================================== */

.stream-toggle {
  display: none;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.stream-toggle.visible {
  display: flex;
}

.toggle-switch {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

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

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 22px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  bottom: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all var(--transition-fast);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent-glow);
  border-color: var(--accent-primary);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
  background: var(--accent-primary);
}

.camera-select {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: var(--space-xs) var(--space-sm);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition-fast);
}

.camera-select:hover,
.camera-select:focus {
  border-color: var(--accent-primary);
}

.stream-container {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-deep);
}

.stream-view {
  width: 100%;
  display: block;
  min-height: 200px;
  object-fit: contain;
  background: var(--bg-deep);
}

.stream-overlay {
  position: absolute;
  top: var(--space-sm);
  left: var(--space-sm);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  pointer-events: none;
}

.stream-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stream-badge.live {
  background: rgba(239, 68, 68, 0.9);
  color: white;
  animation: livePulse 2s ease-in-out infinite;
}

.stream-badge.live::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: white;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.stream-fps {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(0, 0, 0, 0.5);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

/* Dual-Camera Stream Layout */
.dual-stream-row {
  position: relative;
  margin-bottom: var(--space-md);
}

.dual-stream-row:last-child {
  margin-bottom: 0;
}

.dual-stream-row .stream-view {
  width: 100%;
  display: block;
}

.stream-label {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.dual-stream-row .stream-overlay {
  top: 8px;
  right: 8px;
  left: auto;
}
