/* ==========================================================================
   OTWay — Design Tokens & Core System
   ========================================================================== */

:root {
  /* Colors */
  --bg-primary: #0b0f19;
  --bg-secondary: #131b2e;
  --bg-tertiary: #1e2942;
  --bg-hover: #253352;
  
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-tertiary: #6b7280;
  
  --accent-primary: #6366f1; /* Indigo */
  --accent-secondary: #4f46e5;
  --accent-glow: rgba(99, 102, 241, 0.15);
  
  /* Status Colors */
  --color-success: #10b981; /* Seats Avail (SEA) */
  --color-warning: #f59e0b; /* Standing Avail (SDA) */
  --color-danger: #ef4444;  /* Limited Standing (LSD) */
  --color-info: #06b6d4;    /* Special feature / WAB */
  
  /* Typography */
  --font-logo: 'Outfit', -apple-system, sans-serif;
  --font-sans: 'Inter', -apple-system, sans-serif;
  
  /* Borders & Shadows */
  --border-color: rgba(255, 255, 255, 0.08);
  --border-radius-sm: 8px;
  --border-radius-md: 14px;
  --border-radius-lg: 20px;
  --box-shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --box-shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --box-shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  /* Layout */
  --header-height: 72px;
  --nav-height: 64px;
}

/* Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}
a:hover {
  color: var(--text-primary);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--bg-hover);
}

/* App Containers */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 540px; /* Restrict width to feel like a premium mobile app on desktop */
  margin: 0 auto;
  background-color: var(--bg-primary);
  position: relative;
  border-left: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
}

/* Header */
.app-header {
  height: var(--header-height);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  z-index: 10;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 28px;
}

.logo-text h1 {
  font-family: var(--font-logo);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  line-height: 1.2;
}

.logo-text p {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* App Navigation Tabs */
.app-nav {
  height: var(--nav-height);
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 540px;
  margin: 0 auto;
  z-index: 1000;
}

.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: var(--font-sans);
  font-weight: 500;
}

.nav-tab i {
  width: 20px;
  height: 20px;
  stroke-width: 2.2;
  transition: transform 0.2s ease;
}

.nav-tab span {
  font-size: 11px;
  font-weight: 600;
}

.nav-tab:hover {
  color: var(--text-secondary);
}

.nav-tab.active {
  color: var(--accent-primary);
}

.nav-tab.active i {
  transform: translateY(-2px);
}

/* Content Area */
.app-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  padding-bottom: calc(var(--nav-height) + 20px);
  order: 1;
  position: relative;
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.tab-content.active {
  display: block;
}

#content-map.active {
  display: block;
  max-height: calc(100vh - var(--header-height) - var(--nav-height) - 40px);
  overflow: hidden;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Section Typography */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.section-header h2 {
  font-family: var(--font-logo);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Buttons */
.icon-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.icon-btn:hover {
  background: var(--bg-hover);
  transform: scale(1.05);
}
.icon-btn i {
  width: 18px;
  height: 18px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--border-radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
  background-color: var(--accent-primary);
  color: #fff;
  box-shadow: 0 4px 12px var(--accent-glow);
}
.btn-primary:hover {
  background-color: var(--accent-secondary);
  box-shadow: 0 6px 16px var(--accent-glow);
}

.btn-secondary {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}
.btn-secondary:hover {
  background-color: var(--bg-hover);
}

.btn-sm {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 6px;
}

.btn-icon-round {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-icon-round:hover {
  background: var(--bg-hover);
  transform: rotate(15deg);
}
.btn-icon-round i {
  width: 16px;
  height: 16px;
}

/* Status Pills */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 50px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

/* Compact connection indicator (demoted from a loud pill to a small dot) */
.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 3px 8px 3px 7px;
  border-radius: 50px;
  cursor: pointer;
  color: var(--text-tertiary);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}
.status-dot .conn-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-warning);
}
.status-dot.connected { color: var(--color-success); }
.status-dot.connected .conn-dot { background: var(--color-success); animation: pulseGreen 2s infinite; }
.status-dot.demo-mode .conn-dot { background: var(--color-warning); }

/* "Use my location" button inside the planner From field */
.use-location-btn {
  background: none;
  border: none;
  color: var(--accent-primary);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.use-location-btn:hover { color: var(--text-primary); }
.use-location-btn i { width: 18px; height: 18px; }

.status-pill.demo-mode {
  background-color: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.2);
  color: var(--color-warning);
}
.status-pill.connected {
  background-color: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.2);
  color: var(--color-success);
}

.pulse-icon {
  width: 12px;
  height: 12px;
  stroke-width: 2.5;
}

.status-pill.connected .pulse-icon {
  animation: pulseGreen 2s infinite;
}
.status-pill.demo-mode .pulse-icon {
  animation: pulseOrange 2s infinite;
}

@keyframes pulseGreen {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.5; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes pulseOrange {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.5; }
  100% { transform: scale(1); opacity: 1; }
}

/* Badges */
.badge {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
}

/* Search UI Components */
.search-wrapper {
  margin-bottom: 20px;
}

.search-bar {
  display: flex;
  align-items: center;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 0 16px;
  height: 52px;
  box-shadow: var(--box-shadow-sm);
  transition: all 0.3s ease;
}

.search-bar:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-input-icon {
  width: 20px;
  height: 20px;
  color: var(--text-tertiary);
  margin-right: 12px;
}

.search-bar input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14.5px;
  font-weight: 500;
  height: 100%;
}
.search-bar input::placeholder {
  color: var(--text-tertiary);
}

.clear-btn {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
}
.clear-btn:hover {
  color: var(--text-primary);
}

.search-filters {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.filter-pill {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 50px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}
.filter-pill i {
  width: 12px;
  height: 12px;
}
.filter-pill:hover {
  background: var(--bg-tertiary);
}
.filter-pill.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}

/* Empty States */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  border-radius: var(--border-radius-lg);
  background-color: var(--bg-secondary);
  border: 1px dashed var(--border-color);
  margin-top: 10px;
}

.empty-icon {
  width: 64px;
  height: 64px;
  background-color: var(--bg-tertiary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  margin-bottom: 16px;
}
.empty-icon i {
  width: 28px;
  height: 28px;
}

.empty-state h3 {
  font-family: var(--font-logo);
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 260px;
  margin-bottom: 16px;
  line-height: 1.4;
}

.popular-suggestions {
  width: 100%;
  margin-top: 10px;
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
}

.suggestion-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 10px;
}

.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.chip {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.chip:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

/* Bus Stop List Cards */
.stops-list, .stops-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.stop-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 16px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--box-shadow-sm);
}

.stop-card:hover {
  border-color: var(--accent-primary);
  background-color: var(--bg-hover);
  transform: translateY(-2px);
}

.stop-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stop-title {
  font-family: var(--font-logo);
  font-size: 15.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.stop-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

.stop-code-badge {
  background-color: var(--bg-tertiary);
  font-family: monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--text-primary);
}

.stop-chevron {
  color: var(--text-tertiary);
  transition: transform 0.2s ease;
}
.stop-card:hover .stop-chevron {
  color: var(--accent-primary);
  transform: translateX(4px);
}

/* Drawer / Sliders overlay */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: var(--nav-height);
  max-width: 540px;
  margin: 0 auto;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  animation: backdropFade 0.2s ease-out;
}

.drawer-content {
  background: rgba(19, 27, 46, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top-left-radius: var(--border-radius-lg);
  border-top-right-radius: var(--border-radius-lg);
  border-top: 1px solid var(--border-color);
  max-height: 80%;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s cubic-bezier(0.1, 0.76, 0.55, 0.94);
}

@keyframes backdropFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.drawer-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.drawer-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.fav-star-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-tertiary);
  padding: 4px;
  transition: all 0.2s ease;
}
.fav-star-btn i {
  width: 22px;
  height: 22px;
}
.fav-star-btn.starred {
  color: var(--color-warning);
  fill: var(--color-warning);
  transform: scale(1.1);
}

.drawer-title-meta h2 {
  font-family: var(--font-logo);
  font-size: 19px;
  font-weight: 700;
}

.drawer-title-meta p {
  font-size: 12px;
  color: var(--text-secondary);
}

.close-drawer-btn {
  background: var(--bg-tertiary);
  border: none;
  color: var(--text-primary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 20px 20px;
}

/* Live updates bar */
.live-indicator-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 16px;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--color-success);
  letter-spacing: 0.5px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--color-success);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--color-success);
  animation: pulseGreen 1.5s infinite;
}

.refresh-countdown {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 500;
}

/* Service arrivals list styling */
.arrival-services-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.service-arrival-card {
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.3s ease;
  padding: 0 !important;
}

.service-id-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 90px;
}

.service-badge {
  background: var(--accent-primary);
  color: #fff;
  font-family: var(--font-logo);
  font-size: 16px;
  font-weight: 800;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px var(--accent-glow);
}

.service-op-desc {
  font-size: 10px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  font-weight: 700;
}

/* ETAs list block */
.eta-group {
  display: flex;
  gap: 8px;
}

.eta-item-box {
  position: relative; /* anchors .alert-bell-badge to the box (it's absolute-positioned) */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  width: 58px;
  padding: 6px 0;
  transition: all 0.2s ease;
}

.eta-item-box.no-bus {
  opacity: 0.3;
}

.eta-number {
  font-family: var(--font-logo);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.1;
}

.eta-unit {
  font-size: 9px;
  color: var(--text-secondary);
  font-weight: 600;
}

/* Load descriptors mapping */
.load-indicator {
  width: 28px;
  height: 4px;
  border-radius: 10px;
}
.load-sea {
  background-color: var(--color-success);
}
.load-sda {
  background-color: var(--color-warning);
}
.load-lsd {
  background-color: var(--color-danger);
}

/* Type icons & features badge */
.badge-group {
  display: flex;
  gap: 2px;
  margin-top: 1px;
}

.micro-badge {
  font-size: 8px;
  font-weight: 700;
  padding: 1px 3px;
  border-radius: 3px;
  color: #fff;
}
.badge-wab {
  background-color: var(--color-info);
}
.badge-dd {
  background-color: var(--text-tertiary);
}

/* Settings Forms */
.settings-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 20px;
  margin-bottom: 16px;
}

.settings-card h3 {
  font-family: var(--font-logo);
  font-size: 16.5px;
  font-weight: 700;
  margin-bottom: 6px;
}

.settings-help {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.45;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}

.api-key-input-wrapper {
  display: flex;
  gap: 8px;
}

.api-key-input-wrapper input {
  flex: 1;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  font-family: monospace;
  font-size: 13px;
  padding: 10px 14px;
  outline: none;
}
.api-key-input-wrapper input:focus {
  border-color: var(--accent-primary);
}

.btn-group {
  display: flex;
  gap: 8px;
}

.sync-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-primary);
  padding: 10px 14px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
}

.sync-status {
  font-size: 12.5px;
  display: flex;
  flex-direction: column;
}
.sync-status span {
  color: var(--text-tertiary);
}
.sync-status strong {
  color: var(--text-primary);
}

/* Database Syncing Progress Bar */
.progress-bar-wrapper {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.progress-bar-track {
  height: 6px;
  background: var(--bg-primary);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--color-info));
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
  text-align: right;
}

/* Info Cards */
.info-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
}
.info-row:last-child {
  border-bottom: none;
}
.info-row span {
  color: var(--text-secondary);
}
.info-row strong {
  color: var(--text-primary);
}
.text-success {
  color: var(--color-success) !important;
}

/* Route display classes */
.route-details-container {
  margin-top: 12px;
}
.route-display-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 16px;
  animation: fadeIn 0.3s ease-out;
}

.route-header-card {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 14px;
}

.service-badge-large {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: #fff;
  font-family: var(--font-logo);
  font-size: 24px;
  font-weight: 800;
  width: 58px;
  height: 58px;
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.route-title-meta {
  flex: 1;
}
.route-title-meta h3 {
  font-family: var(--font-logo);
  font-size: 16.5px;
  font-weight: 700;
}
.route-title-meta p {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 600;
}

.route-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 14px;
}

.meta-item {
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 8px 10px;
  border-radius: 8px;
}
.meta-label {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 4px;
}
.meta-label i {
  width: 10px;
  height: 10px;
}
.meta-value {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 2px;
}

/* Route sequencing timeline list */
.route-sequence-timeline {
  display: flex;
  flex-direction: column;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}

.timeline-item {
  display: flex;
  gap: 14px;
  position: relative;
  padding-bottom: 16px;
  cursor: pointer;
}
.timeline-item:last-child {
  padding-bottom: 0;
}

/* Vertical connector line */
.timeline-item::after {
  content: '';
  position: absolute;
  left: 21px;
  top: 14px;
  bottom: 0;
  width: 2px;
  background-color: var(--border-color);
  z-index: 1;
}
.timeline-item:last-child::after {
  display: none;
}

.timeline-item.passed::after {
  background-color: var(--accent-primary);
}

.timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  margin-left: 17px;
  margin-top: 3px;
  z-index: 2;
  transition: all 0.2s ease;
}
.timeline-item:hover .timeline-dot {
  border-color: var(--accent-primary);
  transform: scale(1.2);
}
.timeline-item.active-stop .timeline-dot {
  background: var(--accent-primary);
  border-color: #fff;
  box-shadow: 0 0 8px var(--accent-primary);
  transform: scale(1.3);
}

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

.timeline-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}
.timeline-item:hover .timeline-title {
  color: var(--accent-primary);
}

.timeline-sub {
  font-size: 11px;
  color: var(--text-secondary);
}

.timeline-dist {
  font-size: 11px;
  color: var(--text-tertiary);
  font-family: monospace;
  margin-top: 3px;
}

/* Spinner */
.loading-spinner-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 0;
  gap: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3.5px solid var(--border-color);
  border-top: 3.5px solid var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* API Key Verification Styles */
.test-feedback-box {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--border-radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: fadeIn 0.2s ease-out;
  line-height: 1.4;
}

.test-feedback-box i {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.test-feedback-box.success {
  background-color: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: var(--color-success);
}

.test-feedback-box.error {
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--color-danger);
}

.test-feedback-box.loading {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

/* Interactive Bus ETA boxes and Alerts */
.eta-item-box:not(.no-bus) {
  cursor: pointer;
  position: relative;
  user-select: none;
}

.eta-item-box:not(.no-bus):hover {
  background-color: var(--bg-hover);
  border-color: var(--accent-primary);
  transform: translateY(-1px);
}

.eta-item-box:not(.no-bus):active {
  transform: translateY(0);
}

.eta-item-box.alert-active {
  border-color: var(--color-warning);
  background-color: rgba(245, 158, 11, 0.08);
}

.alert-bell-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background-color: var(--color-warning);
  color: #0b0f19;
  border-radius: 50%;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  animation: pulse-bell 2.5s infinite;
}

@keyframes pulse-bell {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* In-App Toast Notification */
.toast-notification {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-primary);
  border-radius: var(--border-radius-sm);
  padding: 12px 20px;
  box-shadow: var(--box-shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.320, 1.275);
  pointer-events: none;
}

.toast-notification.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.toast-icon {
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toast-title {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-primary);
}

.toast-desc {
  font-size: 11.5px;
  color: var(--text-secondary);
}

/* Service Expandable Route Timeline and Live Bus Avatars */
.service-card-main-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  width: 100%;
}

.service-card-main-row:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.service-card-right-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.expand-chevron-icon {
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}

.service-arrival-card.expanded .expand-chevron-icon {
  transform: rotate(180deg);
}

.service-timeline-container {
  padding: 16px;
  border-top: 1px dashed var(--border-color);
  background-color: rgba(0, 0, 0, 0.15);
}

/* Bus avatar and tooltip hover effects */
.timeline-bus-avatar {
  position: absolute;
  cursor: pointer;
}

.timeline-bus-avatar:hover .bus-avatar-tooltip {
  opacity: 1 !important;
  visibility: visible !important;
}

.bus-avatar-tooltip {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

/* ==========================================================================
   Live Map — Leaflet Integration
   ========================================================================== */

.map-container-wrapper {
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  box-shadow: var(--box-shadow-md);
  margin-bottom: 8px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.bus-map {
  width: 100%;
  height: 35vh;
  min-height: 180px;
  background-color: #0b0f19;
}

/* Dark tile overrides */
.leaflet-container {
  background: #0b0f19 !important;
  font-family: var(--font-sans) !important;
}

.leaflet-control-zoom a {
  background-color: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

.leaflet-control-zoom a:hover {
  background-color: var(--bg-hover) !important;
}

.leaflet-control-attribution {
  background: rgba(11, 15, 25, 0.7) !important;
  color: var(--text-tertiary) !important;
  font-size: 9px !important;
}

.leaflet-control-attribution a {
  color: var(--accent-primary) !important;
}

/* Custom map popups */
.leaflet-popup-content-wrapper {
  background: rgba(19, 27, 46, 0.96) !important;
  backdrop-filter: blur(12px) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--border-radius-sm) !important;
  box-shadow: var(--box-shadow-lg) !important;
  padding: 0 !important;
}

.leaflet-popup-tip {
  background: rgba(19, 27, 46, 0.96) !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: none !important;
}

.leaflet-popup-content {
  margin: 0 !important;
  color: var(--text-primary) !important;
  font-family: var(--font-sans) !important;
  font-size: 13px !important;
  line-height: 1.4 !important;
}

.map-popup {
  padding: 12px 14px;
  min-width: 180px;
}

.map-popup-title {
  font-family: var(--font-logo);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 2px;
}

.map-popup-sub {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.map-popup-radius {
  font-size: 10px;
  color: var(--accent-primary);
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: 0.3px;
}

.map-popup-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.map-popup-btn:hover {
  background: var(--accent-secondary);
}

/* Map legend */
.map-legend {
  display: flex;
  gap: 16px;
  padding: 8px 14px;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.legend-dot-user {
  background-color: #3b82f6;
  box-shadow: 0 0 6px rgba(59, 130, 246, 0.6);
}

.legend-dot-stop {
  background-color: var(--accent-primary);
}

.legend-dot-bus {
  background-color: var(--color-success);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

/* Map header actions */
.map-header-actions {
  display: flex;
  gap: 6px;
}

/* Map info bar (bottom card) */
.map-info-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 10px 14px;
  animation: fadeIn 0.3s ease-out;
  box-shadow: var(--box-shadow-sm);
  flex-shrink: 0;
  margin-bottom: 8px;
}

.map-info-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.map-info-title {
  font-family: var(--font-logo);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-info-sub {
  font-size: 11px;
  color: var(--text-secondary);
}

.map-info-live {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.map-info-live-text {
  font-size: 10px;
  font-weight: 700;
  color: var(--color-success);
  letter-spacing: 0.5px;
}

/* Inline arrivals panel below map */
.map-arrivals-panel {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  overflow: hidden;
  animation: fadeIn 0.3s ease-out;
  box-shadow: var(--box-shadow-sm);
}

.map-arrivals-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
}

.map-arrivals-header h3 {
  font-family: var(--font-logo);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.map-arrivals-countdown {
  font-size: 10px;
  color: var(--text-tertiary);
  font-weight: 500;
}

.map-arrivals-list {
  max-height: calc(100vh - 35vh - var(--header-height) - var(--nav-height) - 280px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

.map-arrivals-list::-webkit-scrollbar {
  width: 4px;
}

.map-arrivals-list::-webkit-scrollbar-track {
  background: transparent;
}

.map-arrivals-list::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

/* Drawer map pin button */
.map-drawer-btn {
  background: var(--bg-tertiary);
  border: none;
  color: var(--text-primary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-right: 6px;
}

.map-drawer-btn:hover {
  background: var(--accent-primary);
  transform: scale(1.1);
}

/* Route stop numbered dots */
.route-stop-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.25);
  border: 2px solid rgba(99, 102, 241, 0.6);
  color: rgba(255, 255, 255, 0.8);
  font-size: 8px;
  font-weight: 700;
  transition: all 0.2s ease;
}

.route-stop-dot:hover {
  background: rgba(99, 102, 241, 0.5);
  transform: scale(1.3);
}

.map-drawer-btn i {
  width: 16px;
  height: 16px;
}

/* Custom bus marker pulse on map */
.bus-marker-pulse {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  position: relative;
}

.bus-marker-pulse::after {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid currentColor;
  opacity: 0;
  animation: marker-pulse 2s infinite;
}

@keyframes marker-pulse {
  0% { transform: scale(0.5); opacity: 0.8; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* Custom Leaflet marker icons */
.custom-stop-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-primary);
  border: 2px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
  font-size: 10px;
  color: #fff;
  font-weight: 800;
  transition: transform 0.2s ease;
}

.custom-stop-marker:hover {
  transform: scale(1.3);
}

.custom-stop-marker.selected {
  background: var(--color-success);
  border-color: #fff;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.6);
  transform: scale(1.2);
}

.custom-bus-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  border: 2px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  animation: bus-bounce 3s ease-in-out infinite;
}

.custom-bus-marker.load-sea {
  background: var(--color-success);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.custom-bus-marker.load-sda {
  background: var(--color-warning);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

.custom-bus-marker.load-lsd {
  background: var(--color-danger);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

@keyframes bus-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.custom-user-marker {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #3b82f6;
  border: 3px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.6), 0 0 24px rgba(59, 130, 246, 0.3);
  animation: user-pulse 2s infinite;
}

@keyframes user-pulse {
  0% { box-shadow: 0 0 12px rgba(59, 130, 246, 0.6), 0 0 24px rgba(59, 130, 246, 0.3); }
  50% { box-shadow: 0 0 20px rgba(59, 130, 246, 0.8), 0 0 40px rgba(59, 130, 246, 0.4); }
  100% { box-shadow: 0 0 12px rgba(59, 130, 246, 0.6), 0 0 24px rgba(59, 130, 246, 0.3); }
}

/* Route path on map */
.map-route-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.map-route-info .service-badge {
  width: 30px;
  height: 30px;
  font-size: 12px;
  border-radius: 6px;
}

/* Breadcrumbs Navigation Bar styling */
.breadcrumbs-container {
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 10px 20px;
  font-size: 12.5px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  z-index: 100;
  animation: slide-down 0.25s ease-out;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.breadcrumb-item {
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  font-weight: 500;
}

.breadcrumb-item:hover {
  color: var(--color-primary);
}

.breadcrumb-item.active {
  color: var(--text-primary);
  font-weight: 600;
  cursor: default;
}

.breadcrumb-separator {
  color: var(--text-tertiary);
  font-size: 11px;
  user-select: none;
  font-family: monospace;
}

@keyframes slide-down {
  from { transform: translateY(-5px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Modal overlays (for LegSync Setup Dialog) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 15, 30, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1100;
  animation: fade-in 0.2s ease-out;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  animation: zoom-in 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.modal-header p {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin: 2px 0 0 0;
}

.modal-body {
  padding: 20px;
}

.close-modal-btn {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
}

.close-modal-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

/* LegSync options lists and cards */
.legsync-option-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.legsync-option-card:hover {
  border-color: rgba(255,255,255,0.15);
  background: rgba(255, 255, 255, 0.04);
}

.legsync-option-card.optimal {
  border-left: 4px solid var(--color-success);
}

.legsync-option-card.tight {
  border-left: 4px solid var(--color-warning);
}

.legsync-option-card.missed {
  border-left: 4px solid var(--color-danger);
}

.option-badge-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.option-rank {
  font-size: 10px;
  font-weight: 700;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.connection-status-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.connection-status-pill.status-optimal {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.connection-status-pill.status-tight {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.connection-status-pill.status-missed {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.legsync-flow-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  padding: 8px 12px;
}

.flow-step {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.flow-step .step-time {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.flow-step .step-label {
  font-size: 10px;
  color: var(--text-tertiary);
  font-weight: 500;
}

.solver-summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  border-top: 1px dashed var(--border-color);
  padding-top: 8px;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes zoom-in {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   Segment Controls
   ========================================================================== */

.segment-control {
  display: flex;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 20px;
  gap: 4px;
}

.segment-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-sans);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
  color: var(--text-tertiary);
  transition: all 0.25s ease;
}

.segment-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.segment-btn.active {
  background: var(--accent-primary);
  color: white;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.35);
}

.segment-btn.active:hover {
  background: var(--accent-secondary);
}

.segment-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* ==========================================================================
   Journey Planner Form
   ========================================================================== */

.planner-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

.planner-field {
  position: relative;
  z-index: 5;
}

#planner-field-start {
  z-index: 15;
}

#planner-field-end {
  z-index: 10;
}

.planner-field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 6px;
  padding-left: 2px;
}

.planner-label-icon {
  width: 13px;
  height: 13px;
}

.planner-label-icon.start-icon {
  color: var(--color-success);
}

.planner-label-icon.end-icon {
  color: var(--color-danger);
}

.planner-field .search-bar {
  height: 48px;
}

.planner-field .search-bar input {
  width: 100%;
}

.planner-swap-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  align-self: center;
  margin: 2px 0;
  z-index: 20;
  position: relative;
}

.planner-swap-btn i {
  width: 14px;
  height: 14px;
}

.planner-swap-btn:hover {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
  transform: rotate(180deg);
}

.planner-submit {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  position: relative;
  z-index: 1;
}

.planner-submit i {
  width: 16px;
  height: 16px;
}

#planner-results-container {
  margin-top: 20px;
}

/* ==========================================================================
   Journey Planner Map
   ========================================================================== */

.planner-map-panel {
  margin-bottom: 18px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--bg-secondary);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.planner-map {
  width: 100%;
  height: 300px;
  background: #0b0f19;
}

.planner-map .leaflet-container {
  background: #0b0f19;
  font-family: var(--font-body, inherit);
}

.planner-map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 10px 14px;
  font-size: 11px;
  color: var(--text-secondary);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.015);
}

.planner-map-legend .lg {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.planner-map-legend .lg-swatch {
  width: 14px;
  height: 4px;
  border-radius: 2px;
  display: inline-block;
}

.planner-map-legend .lg-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

/* Leaflet divIcon station/stop markers used by the planner map */
.pm-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  font-size: 11px;
  line-height: 1;
}

.pm-station-dot {
  width: 9px;
  height: 9px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4);
}

.pm-interchange {
  width: 15px;
  height: 15px;
  background: #fff;
  border: 3px solid #f59e0b;
  border-radius: 50%;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.55);
}

.pm-endpoint {
  width: 24px;
  height: 24px;
  color: #fff;
  font-weight: 700;
}

/* Multimodal itinerary card summary chips */
.multimodal-card {
  border-left: 3px solid #10b981;
}

.planner-mm-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin: 2px 0 10px;
}

.planner-mm-summary .mm-chip {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 5px;
  white-space: nowrap;
}

.planner-mm-summary .mm-arrow {
  color: var(--text-tertiary);
  font-size: 11px;
}

.mm-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--color-success);
}

.mm-live-badge:empty {
  display: none;
}

.mm-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-success);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
  animation: mmPulse 1.6s infinite;
}

@keyframes mmPulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Itinerary card: summary (always visible) + accordion detail */
.mm-card-head {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mm-head-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mm-head-row .route-duration-pill {
  margin-left: auto;
}

.mm-clock-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-logo);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.mm-expand-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 11.5px;
  color: var(--text-tertiary);
}

.mm-details-toggle {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 700;
  color: var(--accent-primary);
  white-space: nowrap;
}

.mm-chevron {
  transition: transform 0.2s ease;
}

.multimodal-card.expanded .mm-chevron {
  transform: rotate(180deg);
}

.mm-card-detail {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-color);
}

/* Compact preference block: aligned label + full-width segmented toggle */
.planner-prefs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 4px;
}
.planner-pref-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}
.planner-pref-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
}
.planner-prefs .planner-pref-label {
  width: 74px;
  flex-shrink: 0;
}
.planner-prefs .planner-time-toggle {
  display: flex;
  flex: 1;
}
.planner-prefs .ptt-btn {
  flex: 1;
  padding: 6px 8px;
}
.planner-prefs .planner-datetime {
  margin-left: 84px; /* aligns under the toggles; flex-column stretch sets its width */
}
/* Card whose route is currently drawn on the map */
.multimodal-card.map-active {
  box-shadow: 0 0 0 2px var(--accent-primary, #6366f1) inset;
}

/* Accessibility toggle in Settings */
.access-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}
.access-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

/* Live disruption banner on planner results */
.disruption-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--color-warning);
  border-radius: 12px;
  padding: 11px 13px;
  margin-bottom: 14px;
  font-size: 12.5px;
  line-height: 1.45;
}
.disruption-banner strong { color: var(--color-warning); }
.disruption-msg {
  color: var(--text-secondary);
  font-size: 11.5px;
  margin-top: 3px;
}

.wab-badge { font-size: 12px; }

/* "Show more routes" toggle under the itinerary list */
.mm-showmore {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--accent-primary);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 700;
  padding: 9px;
  border-radius: 10px;
  cursor: pointer;
  margin: 4px 0 8px;
  transition: background 0.15s ease;
}
.mm-showmore:hover { background: var(--bg-hover); }

.planner-time-toggle {
  display: inline-flex;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 2px;
}

.ptt-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 14px;
  min-height: 40px; /* fat-finger tap target */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ptt-btn.active {
  background: var(--accent-primary);
  color: #fff;
}

.planner-datetime {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  padding: 7px 10px;
  border-radius: 8px;
  color-scheme: dark;
}

/* Results header: sort toggle (left) + count & Save (right) on one row */
.planner-results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  row-gap: 8px;
  margin-bottom: 10px;
}
.planner-head-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.planner-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.planner-depart-note {
  font-size: 11.5px;
  color: var(--color-warning);
  font-weight: 600;
  margin-top: 2px;
}

/* Saved journeys / daily plans */
.saved-journeys {
  margin-top: 20px;
  text-align: left;
}

.saved-journeys-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.saved-journey {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.saved-journey:hover {
  background: var(--bg-hover);
  border-color: rgba(99, 102, 241, 0.4);
}

.sj-main { flex: 1; min-width: 0; }

.sj-route {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sj-sub {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.sj-daily {
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #10b981;
  background: rgba(16, 185, 129, 0.14);
  padding: 1px 6px;
  border-radius: 4px;
}

.sj-del {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  flex-shrink: 0;
}

.sj-del:hover {
  color: var(--color-danger);
  background: rgba(239, 68, 68, 0.1);
}

/* ==========================================================================
   Autocomplete Suggestions Dropdown
   ========================================================================== */

.autocomplete-suggestions {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  max-height: 280px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
  margin-top: 6px;
  backdrop-filter: blur(12px);
}

.suggestion-item {
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.15s ease;
}

/* Autocomplete "Places" (POI/building) group */
.ac-group-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding: 8px 14px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.ac-loading {
  font-size: 11.5px;
  color: var(--text-tertiary);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ac-loading::before {
  content: '';
  width: 10px;
  height: 10px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.suggestion-item:hover {
  background: rgba(99, 102, 241, 0.08);
}

.suggestion-item .item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.suggestion-item .item-sub {
  font-size: 11px;
  color: var(--text-tertiary);
  line-height: 1.3;
}

/* ==========================================================================
   Planner Route Result Cards
   ========================================================================== */

.planner-route-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: all 0.2s ease;
  animation: fade-in 0.3s ease-out;
}

.planner-route-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
}

.planner-route-card.direct-card {
  border-left: 3px solid var(--color-success);
}

.planner-route-card.transfer-card {
  border-left: 3px solid var(--color-primary);
}

.planner-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.route-type-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 5px;
  letter-spacing: 0.5px;
}

.route-type-badge.direct-badge {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}

.route-type-badge.transfer-badge {
  background: rgba(99, 102, 241, 0.12);
  color: #818cf8;
}

.route-duration-pill {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.planner-flow-container {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 12.5px;
}

.planner-flow-leg {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}

.planner-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-secondary);
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

.planner-dot.green-dot { background: var(--color-success); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15); }
.planner-dot.blue-dot  { background: #818cf8; box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15); }
.planner-dot.red-dot   { background: var(--color-warning); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15); }

/* Flow timeline time marker */
.flow-time {
  width: 40px;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
  color: var(--text-tertiary);
  text-align: right;
  letter-spacing: 0.3px;
  transition: color 0.3s ease;
}

.flow-time-live {
  color: var(--text-primary);
}

.planner-transfer-line {
  border-left: 2px dashed rgba(255, 255, 255, 0.08);
  margin-left: 49px; /* 40px time + 10px gap - center of 10px dot */
  height: 12px;
}

.planner-leg-info {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  color: var(--text-secondary);
  line-height: 1.4;
  font-size: 12px;
}

.planner-action-btn {
  background: var(--accent-primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.planner-action-btn:hover {
  background: var(--accent-secondary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.planner-action-btn.success-btn {
  background: var(--color-success);
}

.planner-action-btn.success-btn:hover {
  background: #059669;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* ==========================================================================
   Planner Section Headings & Live Timing Strips
   ========================================================================== */

.planner-section-heading {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-tertiary);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin: 0 0 10px 2px;
}

/* Live timing strip container */
.planner-live-strip {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  animation: fade-in 0.4s ease-out;
}

.live-strip-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-tertiary);
  font-size: 11.5px;
}

.live-strip-unavail {
  color: var(--text-tertiary);
  font-size: 11.5px;
  font-style: italic;
}

.live-strip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.live-strip-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 6px;
}

/* Urgency states */
.live-strip-pill.live-great {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.live-strip-pill.live-good {
  background: rgba(99, 102, 241, 0.12);
  color: #818cf8;
}

.live-strip-pill.live-warn {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.live-strip-pill.live-slow {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
}

.live-strip-total {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.live-strip-alt {
  margin-top: 6px;
  font-size: 10.5px;
  color: var(--text-tertiary);
}

.live-strip-breakdown {
  margin-top: 6px;
  font-size: 10.5px;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  letter-spacing: 0.2px;
}

/* Recommended (fastest) card highlight */
.recommended-card {
  border-color: rgba(250, 204, 21, 0.3) !important;
  box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.1), 0 4px 16px rgba(250, 204, 21, 0.08);
}

.route-type-badge.recommended-badge {
  background: rgba(250, 204, 21, 0.15);
  color: #facc15;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 5px;
  letter-spacing: 0.5px;
  margin-left: 6px;
}

/* Bus arrival time chips */
.live-strip-times {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.live-times-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 0.3px;
}

.live-time-chip {
  font-size: 11px;
  font-weight: 600;
  font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  padding: 2px 6px;
  line-height: 1.3;
}

.live-time-chip.next {
  color: #34d399;
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.2);
}

.live-times-sep {
  color: rgba(255, 255, 255, 0.1);
  font-size: 12px;
  margin: 0 2px;
}

/* Urgency pulse: brief attention grab (3 gentle cycles, then steady — no strobe). */
@keyframes urgencyPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
  50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.35); }
}
.urgency-pulse { animation: urgencyPulse 1.1s ease-in-out 3; border-radius: 10px; }
