:root {
  /* Maritime Theme Color Palette */
  --bg: linear-gradient(135deg, #f8fafb 0%, #e8f4f8 100%);
  --panel: #ffffff;
  --panel-highlight: linear-gradient(135deg, #ffffff 0%, #f8fcff 100%);
  --panel-2: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  --accent-blue: #0ea5e9;
  --accent-blue-light: #7dd3fc;
  --accent-blue-bg: rgba(14, 165, 233, 0.08);
  --accent-green: #059669;
  --accent-green-light: #34d399;
  --accent-green-bg: rgba(5, 150, 105, 0.08);
  --ocean-primary: #1e40af;
  --ocean-secondary: #3b82f6;
  --ocean-light: #dbeafe;
  --text: #0f172a;
  --text-secondary: #475569;
  --muted: #64748b;
  --shadow: 0 4px 20px rgba(30, 64, 175, 0.08);
  --shadow-elevated: 0 8px 32px rgba(30, 64, 175, 0.12);
  --radius: 16px;
  --radius-lg: 20px;
  --topbar-h: 72px;
  --footer-h: 40px;
  
  /* Animation variables */
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { 
  box-sizing: border-box; 
}

/* Apply transitions only to specific UI elements, not map */
.btn, .icon-btn, .topbar .brand .logo, .bar .fill {
  transition: var(--transition);
}

html, body { 
  height: 100%; 
  overflow: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fcff 100%);
  border-bottom: 1px solid var(--ocean-light);
  box-shadow: 0 1px 20px rgba(30, 64, 175, 0.04);
  position: sticky;
  top: 0;
  z-index: 60;
  backdrop-filter: blur(20px);
}

.topbar .brand { 
  display: flex; 
  align-items: center; 
  gap: 16px; 
}

.topbar .brand .logo { 
  height: 48px; 
  width: auto; 
  display: block;
  filter: drop-shadow(0 2px 8px rgba(30, 64, 175, 0.15));
  transition: var(--transition);
}

.topbar .brand .logo:hover {
  transform: scale(1.05);
}

.topbar .brand .brand-text { 
  font-weight: 700; 
  color: var(--ocean-primary); 
  font-size: 28px; 
  line-height: 1;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--ocean-primary) 0%, var(--ocean-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.topbar .actions { 
  display: flex; 
  gap: 12px; 
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 60vw) 1fr;
  gap: 16px;
  padding: 16px;
  height: calc(100vh - var(--topbar-h) - var(--footer-h));
  overflow: hidden;
  box-sizing: border-box;
}

.tile {
  background: var(--panel);
  border: 1px solid var(--ocean-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  overflow: hidden;
  position: relative;
  transition: transform var(--transition-slow), box-shadow var(--transition-slow);
}

.tile::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-blue) 0%, var(--accent-green) 100%);
  border-radius: var(--radius) var(--radius) 0 0;
  opacity: 0;
  transition: var(--transition);
}

.tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-elevated);
}

.tile:hover::before {
  opacity: 1;
}

.tile.small {
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  min-height: 90px;
  background: var(--panel-highlight);
}

.tile-title { 
  font-size: 12px; 
  font-weight: 600; 
  letter-spacing: 0.08em; 
  color: var(--muted); 
  text-transform: uppercase;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tile-value { 
  font-size: 32px; 
  font-weight: 700; 
  color: var(--text);
  line-height: 1;
  background: linear-gradient(135deg, var(--ocean-primary) 0%, var(--ocean-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.left, .right {
  display: grid;
  gap: 12px;
  overflow: hidden;
}

.left {
  grid-template-rows: auto auto auto;
}

.right {
  grid-template-rows: 1fr;
}

.left .webcam {
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--ocean-light);
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.aspect-169 {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 60vh;
  background: linear-gradient(135deg, #f8fafb 0%, #e8f4f8 50%, #dbeafe 100%);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--ocean-light);
}

.webcam-placeholder { 
  max-width: 100%; 
  max-height: 100%; 
  width: auto;
  height: 100%;
  object-fit: contain; 
  border-radius: var(--radius);
  box-shadow: none;
}

.webcam-webrtc-frame {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: var(--radius);
  background: #000;
}

.webcam-status {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  z-index: 10;
  backdrop-filter: blur(4px);
}

.placeholder {
  color: var(--muted);
  font-size: 14px;
}

.left-info-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  grid-auto-rows: 180px;
}

.left-small-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stat { 
  display: grid; 
  grid-template-rows: auto auto minmax(0, 1fr); 
  row-gap: 8px;
  background: var(--panel-highlight);
}

.stat .stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.bar {
  position: relative;
  height: 8px;
  background: var(--accent-blue-bg);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.bar.temp { 
  background: var(--accent-green-bg);
}

.bar .fill {
  position: absolute;
  left: 0; 
  top: 0; 
  bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-blue) 0%, var(--accent-blue-light) 100%);
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(14, 165, 233, 0.3);
}

.bar.temp .fill {
  background: linear-gradient(90deg, var(--accent-green) 0%, var(--accent-green-light) 100%);
  box-shadow: 0 1px 3px rgba(5, 150, 105, 0.3);
}

.spark { width: 100%; height: 100%; display: block; margin-top: 0; }

.map {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--ocean-light);
}

.map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.map-body {
  position: relative;
  flex: 1;
  min-height: 240px;
  background: var(--panel);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(30, 64, 175, 0.06);
}

#map {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}

/* Ensure no transitions interfere with Leaflet map performance */
#map *, #overlay-map *, .leaflet-container *, .leaflet-tile *, .leaflet-marker *, .leaflet-popup *, 
.leaflet-clickable, .leaflet-zoom-animated, .leaflet-interactive {
  transition: none !important;
  animation: none !important;
}

/* Map expand/close buttons are controlled by JavaScript and hidden attribute */

/* Map Control Panel - Organized into logical groups
 * 
 * Layout Structure:
 * ┌─────────────────┐
 * │ View Controls   │  - Expand/Close map, Fit view
 * │ ○ ⤢ 🎯         │
 * └─────────────────┘
 * 
 * ┌─────────────────┐
 * │ Nav Controls    │  - Route calc, A* viz, Reset
 * │ ▶️ ⭐ 🗑️      │
 * └─────────────────┘
 */
.map-controls-container {
  position: absolute !important;
  right: 16px !important;
  top: 16px !important;
  z-index: 1000 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
}

/* Control groups */
.map-control-group {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  padding: 8px !important;
  background: rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(12px) !important;
  border: 1px solid var(--ocean-light) !important;
  border-radius: 16px !important;
  box-shadow: var(--shadow-elevated) !important;
}

/* Individual control buttons */
.map-expand, .map-close, .map-control {
  position: relative !important;
  background: transparent !important;
  border: 1px solid rgba(30, 64, 175, 0.1) !important;
  border-radius: 12px !important;
  width: 44px !important;
  height: 44px !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.map-expand:hover, .map-close:hover, .map-control:hover {
  background: rgba(30, 64, 175, 0.08) !important;
  border-color: rgba(30, 64, 175, 0.2) !important;
  transform: scale(1.05) !important;
  box-shadow: 0 4px 12px rgba(30, 64, 175, 0.15) !important;
}

/* Active state for toggle buttons */
.map-control.active {
  background: rgba(30, 64, 175, 0.12) !important;
  border-color: var(--ocean-primary) !important;
}

/* Specific button styling improvements */
#calculate-route {
  border-color: rgba(5, 150, 105, 0.2) !important;
}

#calculate-route:hover {
  background: rgba(5, 150, 105, 0.08) !important;
  border-color: rgba(5, 150, 105, 0.3) !important;
}

#calculate-route svg {
  transition: all 0.2s ease;
}

#calculate-route:hover svg {
  fill: var(--accent-green) !important;
  transform: scale(1.1);
}

#reset-navigation {
  border-color: rgba(220, 38, 38, 0.2) !important;
}

#reset-navigation:hover {
  background: rgba(220, 38, 38, 0.08) !important;
  border-color: rgba(220, 38, 38, 0.3) !important;
}

#reset-navigation svg {
  transition: all 0.2s ease;
}

#reset-navigation:hover svg {
  fill: #dc2626 !important;
  transform: scale(1.1);
}

#fit-navigation {
  border-color: rgba(139, 92, 246, 0.2) !important;
}

#fit-navigation:hover {
  background: rgba(139, 92, 246, 0.08) !important;
  border-color: rgba(139, 92, 246, 0.3) !important;
}

#fit-navigation svg {
  transition: all 0.2s ease;
}

#fit-navigation:hover svg {
  fill: #8b5cf6 !important;
  transform: scale(1.1);
}

#astar-visualization-toggle {
  border-color: rgba(255, 140, 0, 0.2) !important;
}

#astar-visualization-toggle:hover {
  background: rgba(255, 140, 0, 0.08) !important;
  border-color: rgba(255, 140, 0, 0.3) !important;
}

#astar-visualization-toggle.active {
  background: rgba(255, 140, 0, 0.15) !important;
  border-color: #ff8c00 !important;
}

#astar-visualization-toggle svg {
  transition: all 0.2s ease;
}

#astar-visualization-toggle:hover svg {
  fill: #ff8c00 !important;
  transform: scale(1.1);
}


/* ===== MAP OVERLAY ORGANIZATION =====
 * 
 * Left Side Stack (top to bottom):
 * ┌─────────────────────┐
 * │ GPS Status (top)    │  - 16px from top
 * └─────────────────────┘
 * 
 * ┌─────────────────────┐
 * │ Zoom Controls       │  - 80px from top (below GPS)
 * │    [+]              │
 * │    [-]              │
 * └─────────────────────┘
 * 
 * ┌─────────────────────┐
 * │ Navigacijski koraci │  - 200px from bottom
 * └─────────────────────┘
 * 
 * ┌─────────────────────┐
 * │ LIDAR Status        │  - 16px from bottom
 * └─────────────────────┘
 * 
 * Right Side Stack (top to bottom):
 * ┌─────────────────────┐
 * │ View Controls       │  - 16px from top
 * │ Navigation Controls │
 * └─────────────────────┘
 */

/* GPS status badge - positioned at top-left to avoid distance measurement conflicts */
.gps-status {
  position: absolute !important;
  left: 16px !important;
  top: 16px !important;
  z-index: 1100 !important;
  padding: 10px 14px !important;
  border-radius: 999px !important;
  font-family: var(--font, 'Inter', system-ui, sans-serif) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  background: rgba(255,255,255,0.98) !important;
  border: 1px solid var(--ocean-light) !important;
  box-shadow: var(--shadow-elevated) !important;
  color: var(--text, #0f172a) !important;
  backdrop-filter: blur(12px) !important;
}
.gps-dot {
  width: 12px; 
  height: 12px; 
  border-radius: 50%;
  background: #9ca3af; /* gray by default */
  box-shadow: 0 0 0 2px rgba(0,0,0,0.05) inset;
  transition: var(--transition);
}
.gps-ok .gps-dot { background: #10b981; }     /* green */
.gps-warn .gps-dot { background: #f59e0b; }   /* amber */
.gps-bad .gps-dot { background: #ef4444; }    /* red */
.gps-sim .gps-dot { background: #3b82f6; }    /* blue */

/* Leaflet Zoom Controls Styling - match our design system */
.leaflet-control-zoom {
  position: absolute !important;
  left: 16px !important;
  top: 80px !important; /* Below GPS status */
  z-index: 1000 !important;
  box-shadow: var(--shadow-elevated) !important;
  border: 1px solid var(--ocean-light) !important;
  border-radius: 16px !important;
  overflow: hidden !important;
  backdrop-filter: blur(12px) !important;
}

.leaflet-control-zoom a {
  background: rgba(255, 255, 255, 0.98) !important;
  border: none !important;
  border-radius: 0 !important;
  width: 44px !important;
  height: 44px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: var(--ocean-primary) !important;
  font-size: 20px !important;
  font-weight: 600 !important;
  transition: var(--transition) !important;
  text-decoration: none !important;
  border-bottom: 1px solid var(--ocean-light) !important;
}

.leaflet-control-zoom a:last-child {
  border-bottom: none !important;
}

.leaflet-control-zoom a:hover {
  background: rgba(30, 64, 175, 0.08) !important;
  color: var(--ocean-secondary) !important;
  transform: scale(1.05) !important;
}

.leaflet-control-zoom a:active {
  transform: scale(0.95) !important;
}

/* Map button visibility control */
#expand-map {
  display: block;
}

#close-map {
  display: none;
}

/* When map is expanded, hide expand and show close */
#map-tile.expanded #expand-map {
  display: none;
}

#map-tile.expanded #close-map {
  display: block;
}

/* Ensure hidden attribute works for map buttons */
#expand-map[hidden],
#close-map[hidden] {
  display: none !important;
}



/* Pilot mode overlay map in webcam */
.overlay-map {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 35%;
  height: 35%;
  border-radius: var(--radius);
  overflow: hidden;
  opacity: 0.85;
  border: 2px solid var(--ocean-light);
  box-shadow: var(--shadow-elevated);
  backdrop-filter: blur(4px);
}

.btn {
  appearance: none;
  border: 1px solid var(--ocean-light);
  background: linear-gradient(135deg, #ffffff 0%, #f8fcff 100%);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow);
}

.icon-btn {
  appearance: none;
  width: 44px; 
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--ocean-light);
  background: linear-gradient(135deg, #ffffff 0%, #f8fcff 100%);
  display: grid; 
  place-items: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: var(--transition);
}

.btn.secondary {
  border-color: var(--accent-green-bg);
  background: linear-gradient(135deg, #f0fff4 0%, #ecfdf5 100%);
}

.btn:hover, .icon-btn:hover { 
  transform: translateY(-1px);
  box-shadow: var(--shadow-elevated);
}

.btn:active, .icon-btn:active {
  transform: translateY(0);
}

.right-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* Expanded map overlaying the page but not OS fullscreen */
#map-tile.expanded {
  position: fixed;
  left: 12px; 
  right: 12px; 
  bottom: calc(var(--footer-h) + 12px);
  top: calc(var(--topbar-h) + 12px);
  z-index: 50;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-elevated);
}

/* Pilot mode layout adjustments */
.pilot-mode .dashboard {
  grid-template-columns: 1fr minmax(240px, 16vw);
  gap: 16px;
}

.pilot-mode .left-info-grid,
.pilot-mode .left-small-grid {
  display: none;
}

.pilot-mode .map { 
  display: none; 
}

.pilot-mode .pilot-side-grid { 
  display: grid !important; 
  grid-template-columns: 1fr; 
  gap: 12px; 
  align-content: start; 
  height: fit-content;
}

.pilot-mode .right { 
  display: grid; 
  justify-items: stretch; 
  align-content: start; 
  padding: 8px;
}

.pilot-mode .pilot-side-grid { 
  width: 100%; 
}

.pilot-mode .left { 
  display: grid; 
  place-items: center; 
  height: 100%;
}

.pilot-mode .left .webcam { 
  width: 100%; 
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.pilot-mode .aspect-169 { 
  max-height: none;
  height: 100%;
  flex: 1;
}

.site-footer {
  height: var(--footer-h);
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  background: linear-gradient(135deg, #ffffff 0%, #f8fcff 100%);
  border-top: 1px solid var(--ocean-light);
  z-index: 100;
  position: relative;
}

/* Responsive tweaks */
@media (max-width: 1200px) {
  .left-info-grid { 
    grid-template-columns: repeat(2, 1fr); 
    gap: 12px;
    grid-auto-rows: 160px;
  }
  .left-small-grid { 
    grid-template-columns: repeat(3, 1fr); 
    gap: 12px;
  }
  .dashboard {
    gap: 12px;
    padding: 12px;
  }
  .left, .right {
    gap: 10px;
  }
}

@media (max-width: 900px) {
  .dashboard { 
    grid-template-columns: 1fr; 
    height: auto; 
    gap: 12px;
    padding: 12px;
  }
  
  body { 
    height: auto; 
    overflow: auto;
  }
  
  .right { 
    order: 2; 
  }
  
  .left, .right {
    gap: 8px;
  }
  
  .left-info-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 150px;
    gap: 8px;
  }
  
  .left-small-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  
  .topbar {
    padding: 0 16px;
  }
  
  .topbar .brand .brand-text {
    font-size: 24px;
  }
  
  .tile {
    padding: 12px;
  }
  
  .tile.small {
    padding: 12px;
    min-height: 80px;
  }
  
  .aspect-169 {
    max-height: 50vh;
  }
  
  .left .webcam {
    padding: 12px;
  }
}

@media (max-width: 600px) {
  .left-info-grid {
    grid-template-columns: 1fr;
  }
  
  .left-small-grid {
    grid-template-columns: 1fr;
  }
  
  .topbar .brand .brand-text {
    display: none;
  }
}

/* Simplified Leaflet marker styling for better performance */
.order-label {
  background: #ffffff !important;
  border: 2px solid #1e40af !important;
  border-radius: 50% !important;
  box-shadow: 0 2px 8px rgba(30, 64, 175, 0.3) !important;
  width: 28px !important;
  height: 28px !important;
  margin-left: -14px !important;
  margin-top: -14px !important;
}

.order-label div {
  color: #1e40af !important;
  font-weight: 700 !important;
  font-size: 13px !important;
  width: 28px !important;
  height: 28px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  margin: 0 !important;
  padding: 0 !important;
  text-align: center !important;
}

/* Route calculation modal - positioned better */
.route-modal {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  border-radius: var(--radius);
  backdrop-filter: blur(4px);
}

.route-modal[hidden] {
  display: none !important;
}

.modal-content {
  background: rgba(255, 255, 255, 0.98);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 20px 40px rgba(30, 64, 175, 0.2);
  backdrop-filter: blur(12px);
  border: 1px solid var(--ocean-light);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  min-width: 320px;
  max-width: 480px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--accent-blue-bg);
  border-top: 4px solid var(--accent-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.modal-text {
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  text-align: center;
}

/* Route simulation controls styling */
.route-sim-controls {
  width: 100%;
  padding: 16px;
  background: rgba(30, 64, 175, 0.05);
  border-radius: 12px;
  border: 1px solid var(--ocean-light);
}

.ctrl-row {
  margin: 8px 0;
}

.ctrl-row label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.ctrl-row input[type="number"] {
  padding: 8px 12px;
  border: 1px solid var(--ocean-light);
  border-radius: 8px;
  font-size: 14px;
  background: white;
}

.ctrl-row button {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
}

/* Custom scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--ocean-light);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--accent-blue);
  border-radius: 4px;
  transition: var(--transition);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--ocean-secondary);
}

/* Loading animation for tiles */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.tile.loading {
  animation: pulse 2s infinite;
}

/* Subtle glow effect for active elements */
.tile:focus-within,
.btn:focus,
.icon-btn:focus {
  outline: none;
  box-shadow: var(--shadow-elevated), 0 0 0 3px rgba(30, 64, 175, 0.1);
}

/* Enhanced stat header values */
.stat .stat-header span:last-child {
  font-weight: 700;
  color: var(--ocean-primary);
  font-variant-numeric: tabular-nums;
}

/* Pilot Mode Styles */
body.pilot-mode {
  background: #000;
  position: relative;
}

/* Full-screen webcam background in pilot mode */
body.pilot-mode::before {
  content: '';
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  right: 0;
  bottom: var(--footer-h);
  background-image: var(--webcam-bg, url('/webcam_placeholder.jpg'));
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: -1;
}

/* Make tiles transparent in pilot mode */
body.pilot-mode .tile {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

body.pilot-mode .tile.small {
  background: rgba(255, 255, 255, 0.8);
}

/* Hide the regular webcam tile in pilot mode */
body.pilot-mode .left .webcam {
  display: none;
}

/* Overlay map base styles */
.overlay-map {
  position: fixed;
  bottom: calc(var(--footer-h) + 20px);
  right: 20px;
  width: 450px;
  height: 300px;
  z-index: 50;
  border-radius: var(--radius);
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  display: block;
}

.overlay-map[hidden] {
  display: none !important;
}

/* Position overlay map in bottom right corner */
body.pilot-mode .overlay-map {
  display: block !important;
}

/* Adjust dashboard layout in pilot mode */
body.pilot-mode .dashboard {
  background: transparent;
}

/* Ensure topbar and footer stay visible */
body.pilot-mode .topbar {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  z-index: 100;
}

body.pilot-mode .site-footer {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  z-index: 100;
}

/* Mobile adjustments for pilot mode */
@media (max-width: 768px) {
  body.pilot-mode .overlay-map {
    width: 375px;
    height: 225px;
    bottom: calc(var(--footer-h) + 10px);
    right: 10px;
  }
}

/* Countdown display animations */
@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes slideOutUp {
  from {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  to {
    opacity: 0;
    transform: translateX(-50%) translateY(-30px);
  }
}

/* Route Commands Modal animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes modalSlideOut {
  from {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  to {
    opacity: 0;
    transform: scale(0.95) translateY(-20px);
  }
}

#route-commands-modal > div {
  animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Smooth transitions for modal buttons */
#route-commands-modal button {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

#route-commands-modal button:active {
  transform: translateY(-1px) scale(0.98);
}
