/* ============================================================
   Andalath El Bus — Premium iOS-inspired CSS
   ============================================================ */

/* ── 1. Custom Properties ─────────────────────────────────── */
:root {
  /* Colors — Light */
  --bg:             #F2F2F7;
  --bg-secondary:   #E5E5EA;
  --card:           rgba(255, 255, 255, 0.85);
  --card-solid:     #ffffff;
  --surface:        rgba(255, 255, 255, 0.72);
  --border:         rgba(60, 60, 67, 0.12);
  --text-primary:   #1C1C1E;
  --text-secondary: #3C3C43CC;
  --text-tertiary:  #3C3C4399;
  --accent:         #0A84FF;
  --accent-muted:   rgba(10, 132, 255, 0.15);
  --danger:         #FF3B30;
  --success:        #30D158;
  --warning:        #FF9F0A;

  /* Line Colors */
  --line-62005:     #FF6B35;
  --line-62006:     #30D158;

  /* Glassmorphism */
  --glass-bg:       rgba(255, 255, 255, 0.72);
  --glass-border:   rgba(255, 255, 255, 0.5);
  --glass-shadow:   0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);

  /* Radii */
  --radius-sm:      8px;
  --radius-md:      14px;
  --radius-lg:      20px;
  --radius-xl:      28px;
  --radius-full:    9999px;

  /* Transitions */
  --ease-spring:    cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce:    cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition:     all 0.3s var(--ease-spring);

  /* Z-layers */
  --z-map:          0;
  --z-controls:     100;
  --z-sheet:        200;
  --z-modal:        300;
  --z-overlay:      400;
  --z-skeleton:     500;

  /* Spacing */
  --safe-top:       env(safe-area-inset-top, 0px);
  --safe-bottom:    env(safe-area-inset-bottom, 0px);
  --safe-left:      env(safe-area-inset-left, 0px);
  --safe-right:     env(safe-area-inset-right, 0px);
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:             #000000;
    --bg-secondary:   #1C1C1E;
    --card:           rgba(28, 28, 30, 0.9);
    --card-solid:     #1C1C1E;
    --surface:        rgba(44, 44, 46, 0.8);
    --border:         rgba(84, 84, 88, 0.36);
    --text-primary:   #FFFFFF;
    --text-secondary: rgba(235, 235, 245, 0.6);
    --text-tertiary:  rgba(235, 235, 245, 0.3);
    --accent:         #0A84FF;
    --accent-muted:   rgba(10, 132, 255, 0.2);
    --glass-bg:       rgba(28, 28, 30, 0.8);
    --glass-border:   rgba(84, 84, 88, 0.3);
    --glass-shadow:   0 8px 32px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
  }
}

.dark {
  --bg:             #000000;
  --bg-secondary:   #1C1C1E;
  --card:           rgba(28, 28, 30, 0.9);
  --card-solid:     #1C1C1E;
  --surface:        rgba(44, 44, 46, 0.8);
  --border:         rgba(84, 84, 88, 0.36);
  --text-primary:   #FFFFFF;
  --text-secondary: rgba(235, 235, 245, 0.6);
  --text-tertiary:  rgba(235, 235, 245, 0.3);
  --glass-bg:       rgba(28, 28, 30, 0.8);
  --glass-border:   rgba(84, 84, 88, 0.3);
  --glass-shadow:   0 8px 32px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ── 2. Reset & Base ──────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
               "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── 3. App Root ──────────────────────────────────────────── */
#app {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* ── 4. Map Container ─────────────────────────────────────── */
#map-container {
  position: absolute;
  inset: 0;
  z-index: var(--z-map);
  background: var(--bg);
}

/* Leaflet overrides */
.leaflet-container {
  background: #e8f0fe;
  font-family: inherit;
}

.dark .leaflet-container {
  background: #1a1f2e;
}

.leaflet-control-zoom {
  display: none; /* Custom controls instead */
}

.leaflet-popup-content-wrapper {
  background: var(--card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  color: var(--text-primary);
  padding: 0;
  overflow: hidden;
}

.leaflet-popup-content {
  margin: 0;
  width: auto !important;
  min-width: 180px;
}

.leaflet-popup-tip-container {
  margin-top: -1px;
}

.leaflet-popup-tip {
  background: var(--card-solid);
}

/* ── 5. Skeleton Loading ──────────────────────────────────── */
#skeleton-overlay {
  position: absolute;
  inset: 0;
  z-index: var(--z-skeleton);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: opacity 0.4s var(--ease-spring), transform 0.4s var(--ease-spring);
}

#skeleton-overlay.hiding {
  opacity: 0;
  transform: scale(1.05);
  pointer-events: none;
}

#skeleton-overlay.hidden {
  display: none;
}

.skeleton-logo {
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  border-radius: 20px;
}

.skeleton-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.skeleton-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
}

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

@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}

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

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.shimmer {
  background: linear-gradient(
    90deg,
    var(--bg-secondary) 25%,
    var(--surface) 50%,
    var(--bg-secondary) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* ── 6. Status Bar ────────────────────────────────────────── */
#status-bar {
  position: absolute;
  top: calc(12px + var(--safe-top));
  right: 16px;
  z-index: var(--z-controls);
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  box-shadow: var(--glass-shadow);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.2px;
}

#current-time {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}

.active-badge {
  background: var(--accent-muted);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

/* ── 7. Theme Toggle ──────────────────────────────────────── */
#theme-toggle {
  position: absolute;
  top: calc(12px + var(--safe-top));
  left: 16px;
  z-index: var(--z-controls);
  width: 44px;
  height: 44px;
  border: none;
  border-radius: var(--radius-full);
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  transition: var(--transition);
}

#theme-toggle svg {
  width: 18px;
  height: 18px;
}

#theme-toggle:hover  { transform: scale(1.08); }
#theme-toggle:active { transform: scale(0.95); }

/* ── 8. Search Bar ────────────────────────────────────────── */
#search-bar {
  position: absolute;
  top: calc(68px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-controls);
  width: min(440px, calc(100% - 32px));
  height: 46px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  box-shadow: var(--glass-shadow);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 8px;
  transition: var(--transition);
}

#search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted), var(--glass-shadow);
  width: min(500px, calc(100% - 32px));
}

.search-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--text-tertiary);
}

#search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 15px;
  font-family: inherit;
  color: var(--text-primary);
  caret-color: var(--accent);
}

#search-input::placeholder {
  color: var(--text-tertiary);
}

#search-clear {
  width: 20px;
  height: 20px;
  border: none;
  background: var(--text-tertiary);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--card-solid);
  flex-shrink: 0;
  transition: var(--transition);
}

#search-clear svg {
  width: 11px;
  height: 11px;
  stroke-width: 3;
}

#search-clear:hover  { background: var(--text-secondary); }
#search-clear:active { transform: scale(0.9); }

/* ── 9. Search Results ────────────────────────────────────── */
#search-results {
  position: absolute;
  top: calc(68px + var(--safe-top) + 54px);
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-controls);
  width: min(440px, calc(100% - 32px));
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  overflow: hidden;
  max-height: 300px;
  overflow-y: auto;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.15s var(--ease-spring);
  border-bottom: 1px solid var(--border);
}

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

.search-result-item:hover  { background: var(--accent-muted); }
.search-result-item:active { background: var(--accent-muted); }

.search-result-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--accent-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
}

.search-result-icon svg {
  width: 16px;
  height: 16px;
}

.search-result-info {
  flex: 1;
  min-width: 0;
}

.search-result-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ── 10. Line Filter Pills ────────────────────────────────── */
#line-filter {
  position: absolute;
  bottom: calc(26vh + 16px);
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-controls);
  display: flex;
  gap: 8px;
  padding: 6px 12px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  box-shadow: var(--glass-shadow);
  white-space: nowrap;
}

.filter-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border: none;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
  transition: var(--transition);
}

.filter-pill:hover {
  color: var(--text-primary);
  background: var(--surface);
}

.filter-pill.active {
  background: var(--accent);
  color: #fff;
}

.filter-pill[data-line="62005"].active {
  background: var(--line-62005);
  color: #fff;
}

.filter-pill[data-line="62006"].active {
  background: var(--line-62006);
  color: #fff;
}

.filter-pill:active { transform: scale(0.96); }

.line-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── 11. Action Buttons (geoloc / fit) ────────────────────── */
#geoloc-btn,
#fit-route-btn {
  position: absolute;
  z-index: var(--z-controls);
  width: 46px;
  height: 46px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  transition: var(--transition);
}

#geoloc-btn   { right: 16px; bottom: calc(26vh + 80px); }
#fit-route-btn { right: 16px; bottom: calc(26vh + 134px); }

#geoloc-btn svg,
#fit-route-btn svg {
  width: 20px;
  height: 20px;
}

#geoloc-btn:hover,
#fit-route-btn:hover  { transform: scale(1.08); background: var(--card); }

#geoloc-btn:active,
#fit-route-btn:active { transform: scale(0.95); }

#geoloc-btn.locating {
  color: var(--accent);
  border-color: var(--accent);
}

/* ── 12. Bottom Sheet ─────────────────────────────────────── */
#bottom-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-sheet);
  height: 90vh;
  background: var(--glass-bg);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-top: 1px solid var(--glass-border);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.18), 0 -2px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(calc(100% - 25vh));
  will-change: transform;
  touch-action: none;
}

#bottom-sheet.snap-20 { transform: translateY(calc(100% - 20vh)); }
#bottom-sheet.snap-50 { transform: translateY(calc(100% - 50vh)); }
#bottom-sheet.snap-85 { transform: translateY(calc(100% - 85vh)); }

#bottom-sheet-handle-area {
  width: 100%;
  padding: 12px 0 8px;
  display: flex;
  justify-content: center;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

#bottom-sheet-handle-area:active {
  cursor: grabbing;
}

#bottom-sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--text-tertiary);
  border-radius: var(--radius-full);
}

#bottom-sheet-content {
  height: calc(90vh - 40px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 0 calc(var(--safe-bottom) + 20px);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

#bottom-sheet-content::-webkit-scrollbar {
  display: none;
}

/* ── 13. Sheet: Section Headers ───────────────────────────── */
.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 20px 12px;
  border-bottom: 1px solid var(--border);
}

.sheet-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.sheet-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.sheet-close-btn {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.sheet-close-btn svg {
  width: 14px;
  height: 14px;
  stroke-width: 2.5;
}

.sheet-close-btn:hover  { background: var(--danger); color: #fff; }
.sheet-close-btn:active { transform: scale(0.92); }

/* ── 14. Departure Board ──────────────────────────────────── */
.departure-section {
  padding: 12px 20px 8px;
}

.departure-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.departure-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.departure-card:hover  { transform: scale(1.01); box-shadow: 0 4px 16px rgba(0,0,0,0.1); }
.departure-card:active { transform: scale(0.98); }

.departure-card.line-62005 { border-left-color: var(--line-62005); }
.departure-card.line-62006 { border-left-color: var(--line-62006); }

.departure-card.active-trip {
  background: var(--accent-muted);
  border-left-color: var(--accent);
}

.dep-line-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: -0.3px;
  flex-shrink: 0;
}

.dep-line-badge.line-62005 { background: rgba(255, 107, 53, 0.15); color: var(--line-62005); }
.dep-line-badge.line-62006 { background: rgba(48, 209, 88, 0.15);  color: var(--line-62006); }

.dep-info {
  flex: 1;
  min-width: 0;
}

.dep-route {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dep-stop {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 1px;
}

.dep-bus-name {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 1px;
}

.dep-time-block {
  text-align: right;
  flex-shrink: 0;
}

.dep-time {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.dep-countdown {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  margin-top: 3px;
}

.dep-countdown.soon   { background: rgba(255, 59, 48, 0.15); color: var(--danger); }
.dep-countdown.near   { background: rgba(255, 159, 10, 0.15); color: var(--warning); }
.dep-countdown.normal { background: var(--accent-muted); color: var(--accent); }
.dep-countdown.active { background: rgba(48, 209, 88, 0.15); color: var(--success); }

/* ── 15. Stop Info Panel ──────────────────────────────────── */
.stop-info-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
}

.stop-icon-large {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-md);
  background: var(--accent-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stop-icon-large svg {
  width: 24px;
  height: 24px;
  color: var(--accent);
}

.stop-name-large {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.stop-meta-tags {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.stop-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

/* ── 16. Bus Info Panel ───────────────────────────────────── */
.bus-info-hero {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bus-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.bus-icon-large {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
}

.bus-icon-large.line-62005 { background: rgba(255, 107, 53, 0.15); color: var(--line-62005); }
.bus-icon-large.line-62006 { background: rgba(48, 209, 88, 0.15);  color: var(--line-62006); }

.bus-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.4px;
  line-height: 1.2;
}

.bus-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 3px;
}

.bus-progress-container {
  padding: 4px 0;
}

.bus-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.bus-progress-bar {
  height: 6px;
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.bus-progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.8s var(--ease-spring);
  background: linear-gradient(90deg, var(--line-62006), var(--accent));
}

.bus-progress-fill.line-62005 {
  background: linear-gradient(90deg, var(--line-62005), #ff9550);
}

.bus-stops-timeline {
  padding: 8px 0;
}

.timeline-stop {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  position: relative;
}

.timeline-stop::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 50%;
  height: 100%;
  width: 2px;
  background: var(--border);
  z-index: 0;
}

.timeline-stop:last-child::before { display: none; }

.timeline-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.timeline-dot.passed  { background: var(--text-tertiary); border-color: var(--text-tertiary); }
.timeline-dot.current { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-muted); }
.timeline-dot.future  { background: var(--bg); border-color: var(--border); }

.timeline-info {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.timeline-station {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.timeline-station.passed   { color: var(--text-tertiary); }
.timeline-station.current  { color: var(--accent); }

.timeline-time {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ── 17. Empty State ──────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  gap: 12px;
  text-align: center;
}

.empty-state-icon {
  font-size: 48px;
  opacity: 0.3;
}

.empty-state-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.empty-state-text {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 280px;
  line-height: 1.5;
}

/* ── 18. Bus Markers (Leaflet DivIcon) ────────────────────── */
.bus-marker-wrapper {
  position: relative;
}

.bus-marker {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: white;
  cursor: pointer;
  transition: transform 0.3s var(--ease-spring);
  position: relative;
  box-shadow: 0 3px 12px rgba(0,0,0,0.25);
  border: 3px solid rgba(255,255,255,0.5);
  line-height: 1;
  text-align: center;
}

.bus-marker.line-62005 { background: var(--line-62005, #FF6B35); }
.bus-marker.line-62006 { background: var(--line-62006, #30D158); }

.bus-marker::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid currentColor;
  opacity: 0.4;
  animation: bus-pulse 2s ease-in-out infinite;
}

.bus-marker.line-62005::after { border-color: var(--line-62005, #FF6B35); }
.bus-marker.line-62006::after { border-color: var(--line-62006, #30D158); }

@keyframes bus-pulse {
  0%, 100% { transform: scale(1);   opacity: 0.4; }
  50%       { transform: scale(1.3); opacity: 0;   }
}

/* Direction arrow inside marker */
.bus-arrow {
  font-size: 14px;
  display: block;
  line-height: 1;
}

/* ── 19. Stop Markers ─────────────────────────────────────── */
.stop-marker {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: white;
  border: 3px solid var(--accent);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  cursor: pointer;
  transition: transform 0.2s var(--ease-spring), box-shadow 0.2s var(--ease-spring);
}

.stop-marker:hover,
.stop-marker.highlighted {
  transform: scale(1.5);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* ── 20. Popup Content ────────────────────────────────────── */
.popup-content {
  padding: 12px 16px;
}

.popup-stop-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.popup-next-dep {
  font-size: 12px;
  color: var(--text-secondary);
}

.popup-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 8px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
}

.popup-btn:hover  { background: #0070e0; }
.popup-btn:active { transform: scale(0.97); }

/* ── 21. Stats Row ────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px 20px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  line-height: 1;
}

.stat-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 3px;
  font-weight: 500;
}

/* ── 22. Route Polyline (via Leaflet) ─────────────────────── */
/* .leaflet-interactive is set in JS */

/* ── 23. Scrollbar hide ───────────────────────────────────── */
* {
  scrollbar-width: none;
}

*::-webkit-scrollbar {
  display: none;
}

/* ── 24. Responsive ───────────────────────────────────────── */
@media (min-width: 768px) {
  #bottom-sheet {
    max-width: 420px;
    left: 16px;
    right: auto;
    border-radius: var(--radius-xl);
    bottom: 16px;
    height: calc(100vh - 32px);
    transform: none !important;
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
  }

  #bottom-sheet-handle-area { display: none; }

  #bottom-sheet-content {
    height: calc(100% - 0px);
  }

  #line-filter {
    left: 452px;
    transform: none;
    bottom: 24px;
  }

  #geoloc-btn   { right: auto; left: 452px; bottom: 80px; }
  #fit-route-btn { right: auto; left: 452px; bottom: 136px; }
}

/* ── 25. Transitions for sheet ────────────────────────────── */
#bottom-sheet {
  transition: transform 0.38s var(--ease-spring);
}

#bottom-sheet.dragging {
  transition: none;
}

/* ── 26. Map dark overlay tiles ───────────────────────────── */
.dark .leaflet-tile-pane {
  filter: brightness(0.75) saturate(0.8);
}

/* ── 27. Active trip highlight in filter ──────────────────── */
.departure-card.highlighted {
  box-shadow: 0 0 0 2px var(--accent);
}

/* ── 28. Smooth appear animation ──────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.departure-card {
  animation: fadeUp 0.3s var(--ease-spring) both;
}

.departure-card:nth-child(1)  { animation-delay: 0.00s; }
.departure-card:nth-child(2)  { animation-delay: 0.03s; }
.departure-card:nth-child(3)  { animation-delay: 0.06s; }
.departure-card:nth-child(4)  { animation-delay: 0.09s; }
.departure-card:nth-child(5)  { animation-delay: 0.12s; }
.departure-card:nth-child(6)  { animation-delay: 0.14s; }
.departure-card:nth-child(7)  { animation-delay: 0.16s; }
.departure-card:nth-child(8)  { animation-delay: 0.18s; }
.departure-card:nth-child(9)  { animation-delay: 0.20s; }
.departure-card:nth-child(10) { animation-delay: 0.22s; }
