/* ATLAS Mobile Styles - PWA */

/* ========================================
   Mobile-First Base Styles
   ======================================== */

/* Larger touch targets - minimum 44px */
.btn-mobile,
.touch-target {
  min-height: 44px;
  min-width: 44px;
  padding: 12px;
}

/* Hide mobile-only elements on desktop */
.mobile-menu,
.mobile-bottom-sheet,
.connection-banner {
  display: none;
}

/* ========================================
   Mobile & Tablet Layout (< 1024px)
   ======================================== */

@media (max-width: 1024px) {
  /* Show mobile elements */
  .mobile-menu,
  .connection-banner {
    display: block;
  }
  /* Hide desktop elements */
  #sidebar,
  #right-sidebar,
  footer,
  .desktop-only {
    display: none !important;
  }

  /* Hide standalone voice toggle on mobile (use menu item instead) */
  .voice-toggle {
    display: none !important;
  }

  /* Full viewport map */
  body {
    overflow: hidden;
  }

  main {
    flex-direction: column;
  }

  #map-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
  }

  #map {
    height: 100% !important;
    width: 100% !important;
  }

  /* Mobile header - minimal */
  header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    z-index: 1000;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(26, 35, 126, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  .header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .header-brand {
    font-size: 1.5rem;
    font-weight: 600;
    color: white;
    text-decoration: none;
  }

  .header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  #ws-status {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
  }

  #intersection-count {
    display: none;
  }

  /* Adjust map controls position - below search box */
  .leaflet-top.leaflet-left {
    top: 135px !important;
  }

  .leaflet-top.leaflet-right {
    top: 135px !important;
  }

  .leaflet-control-zoom {
    margin-top: 10px !important;
  }

  .leaflet-control-layers {
    margin-top: 10px !important;
  }
}

/* ========================================
   Bottom Sheet - Intersection Panel
   ======================================== */

.mobile-bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  z-index: 1001;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 70vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.mobile-bottom-sheet.visible {
  transform: translateY(0);
}

/* TIM Ticker Banner */
.sheet-tim-ticker {
  width: 100%;
  background: #ff9800;
  color: white;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.5rem 0;
  overflow: hidden;
  white-space: nowrap;
  flex-shrink: 0;
}

.sheet-tim-ticker.hidden {
  display: none;
}

.ticker-content {
  display: inline-block;
  padding-left: 100%;
  animation: ticker-scroll 12s linear infinite;
}

@keyframes ticker-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

/* Close button in sheet header */
.sheet-close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #666;
  padding: 8px 12px;
  cursor: pointer;
  margin-left: auto;
}

.sheet-close-btn:active {
  color: #333;
}

/* Drag handle */
.sheet-handle {
  width: 100%;
  padding: 12px 0 8px;
  display: flex;
  justify-content: center;
  cursor: grab;
  flex-shrink: 0;
}

.sheet-handle::after {
  content: '';
  width: 40px;
  height: 4px;
  background: #ddd;
  border-radius: 2px;
}

/* Sheet header with signal preview */
.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 12px;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}

.sheet-intersection-info {
  flex: 1;
  min-width: 0;
}

.sheet-intersection-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sheet-intersection-distance {
  font-size: 0.85rem;
  color: #666;
  margin-top: 2px;
}

/* Signal preview lights in header */
.sheet-signal-preview {
  display: flex;
  gap: 8px;
  margin-left: 16px;
}

.signal-light-mini {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: bold;
  color: white;
}

.signal-light-mini.red {
  background: #f44336;
}

.signal-light-mini.yellow {
  background: #ffeb3b;
  color: #333;
}

.signal-light-mini.green {
  background: #4caf50;
}

/* Sheet content area */
.sheet-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}

/* ========================================
   Signal Display - Large Mobile Style
   ======================================== */

.mobile-signal-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 8px 0;
}

.mobile-signal-card {
  background: #f5f5f5;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.mobile-signal-light {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: bold;
  color: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.mobile-signal-light.red {
  background: linear-gradient(145deg, #ff5252, #d32f2f);
}

.mobile-signal-light.yellow {
  background: linear-gradient(145deg, #ffee58, #fbc02d);
  color: #333;
}

.mobile-signal-light.green {
  background: linear-gradient(145deg, #69f0ae, #388e3c);
}

.mobile-signal-light.unknown {
  background: linear-gradient(145deg, #9e9e9e, #616161);
}

.mobile-signal-label {
  font-size: 0.85rem;
  color: #666;
  text-align: center;
}

.mobile-signal-countdown {
  font-size: 1.1rem;
  font-weight: 600;
  color: #333;
}

/* ========================================
   Mobile Intersection List
   ======================================== */

.mobile-intersection-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mobile-intersection-item {
  display: flex;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  transition: background 0.15s;
}

.mobile-intersection-item:active {
  background: #f0f0f0;
}

.mobile-intersection-item .item-info {
  flex: 1;
  min-width: 0;
}

.mobile-intersection-item .item-name {
  font-size: 1rem;
  font-weight: 500;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-intersection-item .item-distance {
  font-size: 0.85rem;
  color: #666;
  margin-top: 2px;
}

.mobile-intersection-item .item-status {
  margin-left: 12px;
  font-size: 1.2rem;
  color: #ccc;
}

.mobile-intersection-item .item-status.active {
  color: #4caf50;
}

.mobile-intersection-item.selected {
  background: #e3f2fd;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.status-dot.green {
  background: #4caf50;
}

.status-dot.yellow {
  background: #ffeb3b;
}

.status-dot.red {
  background: #f44336;
}

.status-dot.unknown {
  background: #9e9e9e;
}

/* ========================================
   Mobile Control Buttons
   ======================================== */

/* Old mobile-controls - replaced by mobile-menu */
.mobile-controls {
  display: none !important;
}

/* New collapsible mobile menu */
.mobile-menu {
  position: fixed;
  left: 16px;
  top: 140px !important;  /* Below nav banner and search bar */
  bottom: auto !important;  /* Override any bottom rules */
  z-index: 1050;  /* Below nav-search (z-index: 1100) so search results show on top */
}

.menu-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: #1a237e;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}

.menu-toggle:active {
  transform: scale(0.95);
}

.menu-toggle.active {
  background: #303f9f;
}

.menu-toggle svg {
  width: 24px;
  height: 24px;
}

.menu-items {
  position: absolute;
  top: 68px;  /* Expand downward from menu button */
  left: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: opacity 0.2s, transform 0.2s;
}

.menu-items.hidden {
  display: none;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.menu-label {
  background: rgba(0, 0, 0, 0.75);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 14px;
  white-space: nowrap;
}

.mobile-fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: #1a237e;
  color: white;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
  text-decoration: none;
}

.mobile-fab:active {
  transform: scale(0.95);
}

.mobile-fab.active {
  background: #4caf50;
}

.mobile-fab.follow-mode {
  background: #2196f3;
}

.mobile-fab.gps-off {
  background: #f44336;
}

/* Recenter button control on map (appears when panned away) */
.mobile-recenter-control {
  margin-bottom: 10px !important;
  margin-right: 10px !important;
}

.mobile-recenter-btn {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 44px !important;
  height: 44px !important;
  font-size: 22px;
  background: #2196f3;
  color: white;
  text-decoration: none;
  border-radius: 4px;
  transition: all 0.2s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.mobile-recenter-btn:hover {
  background: #1976d2;
}

.mobile-fab svg,
.mobile-fab img {
  width: 24px;
  height: 24px;
}

/* ========================================
   User Location Marker
   ======================================== */

.user-location-marker {
  width: 30px;
  height: 30px;
  position: relative;
}

.user-arrow {
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-bottom: 24px solid #2196f3;
  position: absolute;
  top: 3px;
  left: 3px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.user-location-pulse {
  position: absolute;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(33, 150, 243, 0.3);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(2.5);
    opacity: 0;
  }
}

/* ========================================
   Connection Status Banner
   ======================================== */

.connection-banner {
  position: fixed;
  top: 50px;
  left: 0;
  right: 0;
  padding: 8px 16px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 999;
  transform: translateY(-100%);
  transition: transform 0.3s;
}

.connection-banner.visible {
  transform: translateY(0);
}

.connection-banner.offline {
  background: #f44336;
  color: white;
}

.connection-banner.reconnecting {
  background: #ff9800;
  color: white;
}

.connection-banner.online {
  background: #4caf50;
  color: white;
}

/* ========================================
   Driving Mode
   ======================================== */

body.driving-mode header {
  display: none !important;
}

body.driving-mode .mobile-bottom-sheet {
  display: none !important;
}

body.driving-mode .mobile-menu {
  bottom: 20px;
}

.driving-hud {
  display: none;
}

body.driving-mode .driving-hud {
  display: block;
}

/* ========================================
   Driving Mode WITHOUT Navigation (full screen black)
   ======================================== */

body.driving-mode:not(.navigation-active) .driving-hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  background: #000;
  display: flex;
  flex-direction: column;
}

body.driving-mode:not(.navigation-active) .hud-top-overlay {
  flex-shrink: 0;
  background: transparent;
  padding: 15px 20px;
  padding-top: max(15px, env(safe-area-inset-top));
}

body.driving-mode:not(.navigation-active) .hud-bottom-overlay {
  flex: 1;
  background: transparent;
  padding: 15px 20px;
  padding-bottom: max(80px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

/* ========================================
   Driving Mode WITH Navigation (overlay on map)
   ======================================== */

body.driving-mode.navigation-active {
  background: transparent !important;
}

body.driving-mode.navigation-active main {
  background: transparent !important;
}

body.driving-mode.navigation-active #map-container {
  z-index: 1 !important;  /* Normal z-index - HUD overlays position themselves */
}

body.driving-mode.navigation-active .driving-hud {
  /* Don't cover full screen - just position the overlays */
  position: static;
  background: transparent;
  pointer-events: none;
  display: block;
}

/* Hide non-active direction rows when navigating */
body.driving-mode.navigation-active .hud-direction-row:not(.active) {
  display: none !important;
}

/* Top overlay - intersection name and distance (positioned below nav banner) */
body.driving-mode.navigation-active .hud-top-overlay {
  position: fixed;
  top: 80px;  /* Below the nav-banner */
  left: 0;
  right: 0;
  z-index: 2000;
  background: transparent;
  padding: 10px 20px;
  pointer-events: none;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9), 0 0 10px rgba(0, 0, 0, 0.7);
}

/* Bottom overlay - minimal signal status */
body.driving-mode.navigation-active .hud-bottom-overlay {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.6);
  padding: 10px 15px;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  pointer-events: auto;
}

/* Hide stats row when navigating (less clutter) */
body.driving-mode.navigation-active .hud-stats {
  display: none;
}

/* Compact header row when navigating */
body.driving-mode.navigation-active .hud-header-row {
  display: none;
}

/* Smaller intersection name when navigating */
body.driving-mode.navigation-active .hud-intersection-name {
  font-size: 1.2rem;
  margin-bottom: 2px;
  padding: 0 30px;
}

/* Smaller distance text when navigating */
body.driving-mode.navigation-active .hud-distance {
  font-size: 0.9rem;
  color: #ccc;
}

/* Compact signal row when navigating - single line */
body.driving-mode.navigation-active .hud-direction-row {
  padding: 8px 0;
  gap: 6px;
}

body.driving-mode.navigation-active .hud-signal-ball {
  width: 50px;
  height: 50px;
  font-size: 1.1rem;
}

body.driving-mode.navigation-active .hud-direction-label {
  font-size: 0.9rem;
}

/* Nav banner should appear above HUD when both are active */
body.driving-mode.navigation-active .nav-banner {
  z-index: 2100 !important;
}

/* HUD TIM Ticker */
.hud-tim-ticker {
  width: 100%;
  background: #ff9800;
  color: white;
  font-weight: 600;
  font-size: 1rem;
  padding: 0.75rem 0;
  overflow: hidden;
  white-space: nowrap;
  margin-bottom: 10px;
  border-radius: 8px;
}

.hud-tim-ticker.hidden {
  display: none;
}

.hud-tim-ticker .ticker-content {
  display: inline-block;
  padding-left: 100%;
  animation: ticker-scroll 12s linear infinite;
}

/* Header at top */
.hud-intersection-name {
  font-size: 1.8rem;
  font-weight: 700;
  color: white;
  text-align: center;
  margin-bottom: 4px;
  width: 100%;
  padding: 0 40px;
  box-sizing: border-box;
  line-height: 1.2;
}

.hud-distance {
  font-size: 1.2rem;
  font-weight: 600;
  color: #aaa;
  text-align: center;
  margin-bottom: 0;
  min-height: 1.5rem;
}

/* No data message */
.hud-no-data {
  color: #666;
  font-size: 1.2rem;
  text-align: center;
  margin-top: 40px;
}

/* Header row with column labels */
.hud-header-row {
  display: grid;
  grid-template-columns: 50px repeat(3, 1fr);
  gap: 8px;
  padding: 8px 0;
  margin-bottom: 8px;
}

.hud-header-row span {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Direction rows */
.hud-direction-row {
  display: grid;
  grid-template-columns: 50px repeat(3, 1fr);
  gap: 8px;
  padding: 12px 8px;
  border-radius: 12px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.03);
  transition: background 0.3s, transform 0.3s;
}

.hud-direction-row.active {
  background: rgba(33, 150, 243, 0.2);
  border: 2px solid #2196f3;
  transform: scale(1.02);
}

.hud-dir-label {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: #888;
}

.hud-direction-row.active .hud-dir-label {
  color: #2196f3;
}

/* Signal balls - all same size */
.hud-signal-ball {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: bold;
  color: white;
  margin: 0 auto;
}

.hud-signal-ball.red {
  background: radial-gradient(circle at 30% 30%, #ff5252, #b71c1c);
  box-shadow: 0 0 20px rgba(244, 67, 54, 0.4);
}

.hud-signal-ball.yellow {
  background: radial-gradient(circle at 30% 30%, #ffee58, #f9a825);
  color: #333;
  box-shadow: 0 0 20px rgba(255, 235, 59, 0.4);
}

.hud-signal-ball.green {
  background: radial-gradient(circle at 30% 30%, #69f0ae, #1b5e20);
  box-shadow: 0 0 20px rgba(76, 175, 80, 0.4);
}

.hud-signal-ball.unknown {
  background: radial-gradient(circle at 30% 30%, #9e9e9e, #424242);
  box-shadow: 0 0 10px rgba(158, 158, 158, 0.2);
}

.hud-signal-ball.none {
  background: transparent;
  box-shadow: none;
  border: 1px dashed rgba(255,255,255,0.15);
}

/* Make active row signals slightly larger */
.hud-direction-row.active .hud-signal-ball {
  width: 80px;
  height: 80px;
  font-size: 1.5rem;
  box-shadow: 0 0 30px currentColor;
}

.hud-direction-row.active .hud-signal-ball.red {
  box-shadow: 0 0 40px rgba(244, 67, 54, 0.6);
}

.hud-direction-row.active .hud-signal-ball.yellow {
  box-shadow: 0 0 40px rgba(255, 235, 59, 0.6);
}

.hud-direction-row.active .hud-signal-ball.green {
  box-shadow: 0 0 40px rgba(76, 175, 80, 0.6);
}

.hud-direction-row.active .hud-signal-ball.none {
  background: transparent;
  box-shadow: none;
  border: 1px dashed rgba(255,255,255,0.2);
}

/* Legacy styles for backwards compatibility */
.hud-signal {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  font-weight: bold;
  color: white;
  margin-bottom: 30px;
}

.hud-signal.red {
  background: radial-gradient(circle at 30% 30%, #ff5252, #b71c1c);
  box-shadow: 0 0 60px rgba(244, 67, 54, 0.5);
}

.hud-signal.yellow {
  background: radial-gradient(circle at 30% 30%, #ffee58, #f9a825);
  color: #333;
  box-shadow: 0 0 60px rgba(255, 235, 59, 0.5);
}

.hud-signal.green {
  background: radial-gradient(circle at 30% 30%, #69f0ae, #1b5e20);
  box-shadow: 0 0 60px rgba(76, 175, 80, 0.5);
}

.hud-signal.unknown {
  background: radial-gradient(circle at 30% 30%, #9e9e9e, #424242);
  box-shadow: 0 0 30px rgba(158, 158, 158, 0.3);
}

/* Stats bar above exit button */
.hud-stats {
  position: fixed;
  bottom: 100px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 20px;
  font-size: 0.85rem;
  color: #888;
}

.hud-stats span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.hud-stats strong {
  color: #fff;
  font-weight: 600;
}

.hud-exit-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

/* Hide exit button during navigation (nav-banner has its own cancel button) */
body.navigation-active .hud-exit-btn {
  display: none;
}

/* ========================================
   Settings Panel
   ======================================== */

.settings-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: white;
  z-index: 2000;
  transform: translateX(100%);
  transition: transform 0.3s;
  overflow-y: auto;
}

.settings-panel.open {
  transform: translateX(0);
}

.settings-header {
  display: flex;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid #eee;
  position: sticky;
  top: 0;
  background: white;
}

.settings-back-btn {
  width: 44px;
  height: 44px;
  border: none;
  background: none;
  font-size: 1.5rem;
  cursor: pointer;
  margin-right: 8px;
}

.settings-title {
  font-size: 1.25rem;
  font-weight: 600;
}

.settings-section {
  padding: 16px;
  border-bottom: 1px solid #eee;
}

.settings-section-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
}

.settings-label {
  font-size: 1rem;
  color: #333;
}

.settings-description {
  font-size: 0.85rem;
  color: #666;
  margin-top: 2px;
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  width: 50px;
  height: 28px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 28px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: #4caf50;
}

input:checked + .toggle-slider:before {
  transform: translateX(22px);
}

/* ========================================
   PWA Install Prompt
   ======================================== */

.install-prompt {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #1a237e;
  color: white;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 3000;
  transform: translateY(100%);
  transition: transform 0.3s;
}

.install-prompt.visible {
  transform: translateY(0);
}

.install-prompt-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

.install-prompt-text {
  flex: 1;
}

.install-prompt-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.install-prompt-desc {
  font-size: 0.85rem;
  opacity: 0.9;
}

.install-prompt-btn {
  padding: 10px 20px;
  background: white;
  color: #1a237e;
  border: none;
  border-radius: 20px;
  font-weight: 600;
  cursor: pointer;
}

.install-prompt-close {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 8px;
}

/* ========================================
   Safe Area Insets (Notch support)
   ======================================== */

@supports (padding-top: env(safe-area-inset-top)) {
  header {
    padding-top: calc(0.5rem + env(safe-area-inset-top));
  }

  .mobile-bottom-sheet {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .mobile-menu {
    bottom: calc(30px + env(safe-area-inset-bottom));
  }
}

/* ========================================
   Landscape Mode
   ======================================== */

@media (max-width: 1024px) and (orientation: landscape) {
  .mobile-bottom-sheet {
    width: 50%;
    left: auto;
    right: 0;
    top: 0;
    bottom: 0;
    max-height: 100vh;
    border-radius: 0;
    transform: translateX(100%);
  }

  .mobile-bottom-sheet.expanded {
    transform: translateX(0);
  }

  .sheet-handle {
    display: none;
  }

  .mobile-controls {
    right: 52%;
  }
}

/* ========================================
   Dark Mode
   ======================================== */

@media (prefers-color-scheme: dark) {
  .mobile-bottom-sheet {
    background: #1a1a1a;
  }

  .sheet-header {
    border-bottom-color: #333;
  }

  .sheet-intersection-name {
    color: #fff;
  }

  .sheet-intersection-distance {
    color: #aaa;
  }

  .sheet-content {
    background: #1a1a1a;
  }

  .mobile-signal-card {
    background: #2a2a2a;
  }

  .mobile-intersection-item {
    border-bottom-color: #333;
  }

  .mobile-intersection-item .item-name {
    color: #fff;
  }

  .mobile-intersection-item .item-distance {
    color: #aaa;
  }

  .settings-panel {
    background: #1a1a1a;
  }

  .settings-header {
    background: #1a1a1a;
    border-bottom-color: #333;
  }

  .settings-title {
    color: #fff;
  }

  .settings-section {
    border-bottom-color: #333;
  }

  .settings-label {
    color: #fff;
  }
}

/* Force dark mode class */
body.dark-mode .mobile-bottom-sheet,
body.dark-mode .settings-panel {
  background: #1a1a1a;
}
