/* st-map.css - styles for shared/js/st-map.js. Uses design-system tokens with fallbacks. */
:root { --st-map-bottom-offset: 16px; }

/* ---- bus marker ---- */
.st-bus-marker { background: none; border: 0; }
.st-bus-marker .st-bus-rot {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  transform-origin: 50% 50%; will-change: transform;
  filter: drop-shadow(0 2px 4px rgba(15, 23, 42, .45));
}
.st-bus-marker .st-bus-pulse {
  position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px;
  border-radius: 50%; background: var(--primary-glow, rgba(37, 99, 235, .25));
  border: 2px solid var(--primary, #2563EB);
  animation: st-pulse 2s ease-out infinite;
}

/* ---- stop pins ---- */
.st-stop-marker { background: none; border: 0; }
.st-stop-pin { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.st-stop-face {
  position: relative; width: 28px; height: 28px; border-radius: 50%; box-sizing: border-box;
  display: flex; align-items: center; justify-content: center;
  font: 700 14px/1 system-ui, sans-serif; color: var(--primary-dark, #1E40AF);
  background: #fff; border: 3px solid var(--primary, #2563EB);
  box-shadow: 0 1px 4px rgba(15, 23, 42, .4);
  transition: transform .2s ease, background-color .2s ease, border-color .2s ease;
}
.st-stop-done .st-stop-face { background: #94A3B8; border-color: #64748B; color: #fff; }
.st-stop-skipped .st-stop-face { background: #F1F5F9; border: 3px dashed #94A3B8; color: #475569; opacity: .8; }
.st-stop-next .st-stop-face { width: 38px; height: 38px; background: var(--primary, #2563EB); border-color: #fff; color: #fff; font-size: 17px; }
.st-stop-terminus .st-stop-face { background: var(--primary-dark, #1E40AF); border-color: #fff; color: #fff; font-size: 16px; }
.st-stop-pulse {
  position: absolute; left: 50%; top: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%;
  background: var(--primary-glow, rgba(37, 99, 235, .3)); animation: st-pulse 1.8s ease-out infinite;
}
.st-stop-tooltip { font: 600 13px/1.3 system-ui, sans-serif; color: #0F172A; border-radius: 8px; }

/* ---- guide line ---- */
.st-guide-line { stroke-linecap: round; }

/* ---- controls (buttons are children of the map container) ---- */
.st-map-recenter, .st-map-follow-chip {
  position: absolute; z-index: 1000; border: 0; cursor: pointer; font-family: inherit;
  background: var(--bg-surface, #fff); color: var(--primary, #2563EB);
  box-shadow: 0 2px 10px rgba(15, 23, 42, .35);
  transition: background-color .2s ease, color .2s ease, opacity .2s ease, transform .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.st-map-recenter {
  inset-inline-end: 16px; bottom: var(--st-map-bottom-offset, 16px);
  width: 52px; height: 52px; min-width: 48px; min-height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.st-map-recenter.st-following { background: var(--primary, #2563EB); color: #fff; }
.st-map-follow-chip {
  inset-inline-end: 80px; bottom: calc(var(--st-map-bottom-offset, 16px) + 2px);
  min-height: 48px; padding: 0 18px; border-radius: 24px; font-size: 15px; font-weight: 700;
  background: var(--primary, #2563EB); color: #fff; white-space: nowrap;
}
.st-map-follow-chip[hidden] { display: none; }
.st-map-recenter:active, .st-map-follow-chip:active { transform: scale(.95); }
.st-map-recenter:focus-visible, .st-map-follow-chip:focus-visible { outline: 3px solid #F59E0B; outline-offset: 2px; }
[dir="rtl"] .st-bus-marker .st-bus-rot { direction: ltr; }

@keyframes st-pulse {
  0% { transform: scale(.6); opacity: .9; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* ---- night theme ---- */
@media (prefers-color-scheme: dark) {
  .st-map-night .leaflet-tile-pane { filter: brightness(.62) contrast(1.1) saturate(.8); }
  .st-map-no-night .leaflet-tile-pane { filter: none; }
  .st-map-recenter { background: #1E293B; color: #93C5FD; }
  .st-map-recenter.st-following { background: #3B82F6; color: #fff; }
  .st-map-follow-chip { background: #3B82F6; color: #fff; }
  .st-stop-face { background: #1E293B; color: #BFDBFE; border-color: #60A5FA; }
  .st-stop-done .st-stop-face { background: #475569; border-color: #94A3B8; color: #fff; }
  .st-stop-next .st-stop-face { background: #3B82F6; border-color: #fff; color: #fff; }
  .st-stop-terminus .st-stop-face { background: #1E40AF; border-color: #fff; color: #fff; }
}

@media (prefers-reduced-motion: reduce) {
  .st-bus-marker .st-bus-pulse, .st-stop-pulse { animation: none; opacity: .35; }
  .st-map-recenter, .st-map-follow-chip, .st-stop-face { transition: none; }
}

/* ---- fleet status colours (school / admin maps) ---- */
.st-bus-marker[data-status="moving"] path { fill: #16A34A; }
.st-bus-marker[data-status="stopped"] path { fill: #D97706; }
.st-bus-marker[data-status="offline"] path { fill: #94A3B8; }
.st-bus-marker[data-status="offline"] .st-bus-pulse { animation: none; opacity: 0; }
.st-bus-marker.leaflet-interactive { cursor: pointer; }
/* ---- parent ETA chip over the map ---- */
.st-map-eta-chip { position: absolute; z-index: 1000; inset-inline-start: 12px; top: 12px; padding: 6px 12px; border-radius: 16px;
  background: var(--bg-surface, #fff); color: #0F172A; font: 700 13px/1.2 system-ui, sans-serif; box-shadow: 0 2px 10px rgba(15, 23, 42, .35); pointer-events: none; }
.st-map-eta-chip[hidden] { display: none; }
