/**
 * MetroLive™ Production High-Performance Stylesheet
 * Pre-compiled vector radar, countdown pill, marker, and kiosk layouts.
 */

:root {
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --agency-primary: #0284c7;
  --agency-primary-dark: #0369a1;
}

* {
  -webkit-tap-highlight-color: transparent;
}

.pt-safe { padding-top: max(12px, var(--sat)); }
.pb-safe { padding-bottom: max(16px, var(--sab)); }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior-y: none;
  touch-action: pan-x pan-y;
}

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

/* Map container styles */
#map {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 100%;
  height: 100dvh;
}

/* Hardware-Accelerated Dynamic Route Badge Bus Marker */
.bus-marker {
  min-width: 44px;
  height: 36px;
  padding: 0 8px;
  border-radius: 18px;
  background: var(--agency-primary);
  border: 2.5px solid #ffffff;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.22), 0 1px 3px rgba(0, 0, 0, 0.1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.3s ease;
  position: relative;
  white-space: nowrap;
  user-select: none;
}

.dark .bus-marker {
  box-shadow: 0 0 16px rgba(2, 132, 199, 0.65), 0 3px 8px rgba(0, 0, 0, 0.6);
}

.bus-marker .heading-arrow {
  position: absolute;
  top: -7px;
  left: calc(50% - 5px);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 7px solid currentColor;
}

.bus-marker .speed-tag {
  font-size: 9px;
  font-family: 'JetBrains Mono', monospace;
  opacity: 0.9;
  font-weight: 700;
  margin-left: 2px;
}

.bus-marker:hover, .bus-marker.active {
  transform: scale(1.18);
  z-index: 60;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

/* Stop Marker Pin */
.stop-marker {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--agency-primary);
  border: 2.5px solid #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.dark .stop-marker {
  background: #06b6d4;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}

.stop-marker:hover, .stop-marker.active {
  width: 20px;
  height: 20px;
  background: var(--agency-primary);
  border-width: 3px;
  box-shadow: 0 0 0 5px rgba(2, 132, 199, 0.35);
  z-index: 50;
}

.dark .stop-marker:hover, .dark .stop-marker.active {
  background: #38bdf8;
  box-shadow: 0 0 0 6px rgba(56, 189, 248, 0.4);
}

/* User GPS Location Marker */
.user-marker {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #2563eb;
  border: 3px solid #ffffff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.35);
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.6); }
  70% { box-shadow: 0 0 0 16px rgba(37, 99, 235, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

/* Draggable Bottom Sheet states */
.bottom-sheet {
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 -8px 30px rgba(15, 23, 42, 0.12);
}

.dark .bottom-sheet {
  box-shadow: 0 -12px 35px rgba(0, 0, 0, 0.7);
}

.bottom-sheet.dragging {
  transition: none !important;
}

.sheet-peek { transform: translateY(calc(100% - 136px)); }
.sheet-half { transform: translateY(calc(100% - 50dvh)); }
.sheet-full { transform: translateY(calc(100% - 90dvh)); }

/* Custom scrollbar for sheet */
.sheet-content::-webkit-scrollbar { width: 4px; }
.sheet-content::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.dark .sheet-content::-webkit-scrollbar-thumb { background: #334155; }

/* Route Badge Styling */
.route-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 36px;
  padding: 0 9px;
  border-radius: 12px;
  font-weight: 900;
  font-size: 14px;
  letter-spacing: -0.02em;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
}

/* Live Countdown Pill */
.countdown-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
}

.countdown-live {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.dark .countdown-live {
  background: #064e3b;
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.4);
}

.countdown-due {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.4);
  animation: pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.dark .countdown-due {
  background: #78350f;
  color: #fde68a;
  border: 1px solid rgba(251, 191, 36, 0.4);
}

.countdown-scheduled {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.dark .countdown-scheduled {
  background: #1e293b;
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

/* Container query for cards */
.transit-stream-container {
  container-type: inline-size;
}

/* Clean subtle horizontal scroll hiding */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* MetroLive™ Countertop Departure Board Kiosk Display Mode */
body.kiosk-mode #map {
  left: 440px !important;
  width: calc(100% - 440px) !important;
}

@media (max-width: 768px) {
  body.kiosk-mode #map {
    left: 0 !important;
    width: 100% !important;
  }
}

body.kiosk-mode #bottomSheet,
body.kiosk-mode header,
body.kiosk-mode #recenterBtn,
body.kiosk-mode #locateBtn {
  display: none !important;
}

/* Dynamic Agency Theming Utilities */
.bg-agency { background-color: var(--agency-primary) !important; }
.text-agency { color: var(--agency-primary) !important; }
.border-agency { border-color: var(--agency-primary) !important; }
