@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
  --font-family: 'Outfit', sans-serif;
  --bg-dark: #ffffff;
  --panel-bg: rgba(255, 255, 255, 0.82);
  --panel-border: rgba(13, 27, 62, 0.08);
  --panel-glow: rgba(30, 127, 255, 0.1);
  --text-primary: #0d1b3e;
  --text-secondary: #475569;
  --text-muted: #64748b;
  
  /* Color system - BlueFlares themed */
  --cyan: #1E7FFF;
  --cyan-glow: rgba(30, 127, 255, 0.3);
  --purple: #7c3aed;
  --purple-glow: rgba(124, 58, 237, 0.3);
  --emerald: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.3);
  --rose: #e11d48;
  --rose-glow: rgba(225, 29, 72, 0.3);
  --amber: #d97706;
  --amber-glow: rgba(217, 119, 6, 0.3);
  
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-dark);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Header Styling */
header {
  height: 70px;
  background: #ffffff;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2rem;
  z-index: 1000;
}

.header-branding {
  display: flex;
  align-items: center;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #06b6d4, var(--purple));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.3);
  font-weight: 700;
  font-size: 1.25rem;
}

.logo-text h1 {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: #0d1b3e;
  background: none;
  -webkit-background-clip: unset;
  -webkit-text-fill-color: unset;
}

.logo-text span {
  font-size: 0.75rem;
  color: #10b981;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: block;
  font-weight: 700;
  margin-top: -2px;
}

.blueflares-subtitle {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #0d1b3e;
  font-size: 0.95rem;
  font-weight: 500;
  margin-left: 2rem;
}

.by-text {
  font-size: 0.95rem;
  color: #0d1b3e;
  font-weight: 500;
  font-family: var(--font-family);
  text-transform: lowercase;
}

.blueflares-logo-svg {
  height: 16px;
  width: auto;
  display: block;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.system-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 0.35rem 0.75rem;
  border-radius: 99px;
  color: var(--emerald);
  font-weight: 500;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--emerald);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse 1.6s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* Workspace Layout */
.dashboard-container {
  display: flex;
  flex: 1;
  position: relative;
  height: calc(100vh - 70px);
}

#map-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  background-color: #ffffff;
}

/* Floating Glass Panels overlay */
.overlay-panel {
  position: absolute;
  top: 1.5rem;
  bottom: 1.5rem;
  z-index: 10;
  background: var(--panel-bg);
  backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: var(--transition);
}

.left-panel {
  left: 1.5rem;
  width: 400px;
}

.right-panel {
  right: 1.5rem;
  width: 420px;
}

/* Panel Header */
.panel-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--panel-border);
  background: rgba(13, 27, 62, 0.03);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-header h2 {
  font-size: 1.15rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-primary);
}

.panel-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  background: rgba(13, 27, 62, 0.06);
  border-radius: 6px;
  color: var(--text-secondary);
}

/* Tab Switcher inside Panel */
.tab-container {
  display: flex;
  background: rgba(13, 27, 62, 0.04);
  padding: 0.25rem;
  margin: 1rem 1.5rem 0.5rem;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
}

.tab-btn {
  flex: 1;
  padding: 0.5rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
  transition: var(--transition);
}

.tab-btn.active {
  background: #ffffff;
  color: #1E7FFF;
  box-shadow: 0 2px 8px rgba(13, 27, 62, 0.08);
}

/* Scrollable Panel Content */
.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Style Scrollbars */
.panel-content::-webkit-scrollbar {
  width: 6px;
}
.panel-content::-webkit-scrollbar-track {
  background: transparent;
}
.panel-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
}
.panel-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Form controls & UI cards */
.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.control-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  font-weight: 600;
}

.custom-select {
  background: rgba(13, 27, 62, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-family: var(--font-family);
  font-size: 0.95rem;
  outline: none;
  cursor: pointer;
  transition: var(--transition);
}

.custom-select option {
  background: #ffffff;
  color: #0d1b3e;
}

.custom-select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 10px var(--cyan-glow);
}

/* Glass Card */
.glass-card {
  background: rgba(13, 27, 62, 0.03);
  border: 1px solid rgba(13, 27, 62, 0.05);
  border-radius: 14px;
  padding: 1rem;
  transition: var(--transition);
}

.glass-card:hover {
  border-color: rgba(13, 27, 62, 0.1);
  background: rgba(13, 27, 62, 0.05);
}

.card-title-sm {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Driver / Info Details */
.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.info-item {
  display: flex;
  flex-direction: column;
}

.info-item .label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.info-item .value {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
}

/* Live Stops List */
.stops-list {
  position: relative;
  padding-left: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.stops-list::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.stop-item {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.stop-indicator {
  position: absolute;
  left: -21px;
  top: 5px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #334155;
  border: 2px solid var(--bg-dark);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.05);
  transition: var(--transition);
  z-index: 2;
}

.stop-item.completed .stop-indicator {
  background: var(--text-muted);
}

.stop-item.current .stop-indicator {
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
  animation: pulse-stop 1.5s infinite;
}

@keyframes pulse-stop {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.7); }
  70% { transform: scale(1.25); box-shadow: 0 0 0 6px rgba(6, 182, 212, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(6, 182, 212, 0); }
}

.stop-item.upcoming .stop-indicator {
  border-color: var(--purple);
}

.stop-details {
  display: flex;
  flex-direction: column;
  padding-right: 1rem;
}

.stop-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
}

.stop-item.completed .stop-name {
  color: var(--text-muted);
  text-decoration: line-through;
}

.stop-eta {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  white-space: nowrap;
}

.eta-next {
  background: rgba(6, 182, 212, 0.15);
  color: var(--cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.eta-later {
  background: rgba(168, 85, 247, 0.1);
  color: var(--purple);
}

.eta-arrived {
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald);
}

/* Fix 7: Neutral badge when bus hasn't started — shows scheduled time without
   a colored background that looks "broken" when ETAs aren't meaningful yet */
.eta-neutral {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-weight: 500;
}

/* Simulation Controls */
.sim-controls-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.btn {
  font-family: var(--font-family);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.65rem 1rem;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.btn-primary {
  background: linear-gradient(135deg, #1E7FFF, #1A6FE0);
  color: #fff;
  box-shadow: 0 4px 15px rgba(30, 127, 255, 0.22);
}

.btn-primary:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #1A6FE0, #0D1B3E);
  box-shadow: 0 6px 20px rgba(13, 27, 62, 0.25);
}

.btn-secondary {
  background: rgba(13, 27, 62, 0.06);
  color: var(--text-primary);
  border-color: var(--panel-border);
}

.btn-secondary:hover {
  background: rgba(13, 27, 62, 0.12);
  color: #1E7FFF;
  border-color: rgba(30, 127, 255, 0.3);
}

.btn-danger {
  background: rgba(225, 29, 72, 0.1);
  color: var(--rose);
  border-color: rgba(225, 29, 72, 0.2);
}

.btn-danger:hover {
  background: rgba(225, 29, 72, 0.2);
  box-shadow: 0 4px 15px rgba(225, 29, 72, 0.15);
}

/* Fix 4: Disabled state — clear visual feedback */
.btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
  pointer-events: all; /* keep pointer visible but show :disabled state */
}

.btn-active {
  background: rgba(16, 185, 129, 0.1);
  color: var(--emerald);
  border-color: rgba(16, 185, 129, 0.25);
}

/* Slider Controls */
.slider-container {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.range-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  cursor: pointer;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  cursor: pointer;
  transition: var(--transition);
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Alert Notification Log */
.notifications-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 0.25rem;
  /* Fix 10: Fade out at bottom to indicate scrollability */
  -webkit-mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
  mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
}

.notification-pill {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.8rem;
  line-height: 1.4;
  border-left: 3px solid #64748b;
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid rgba(255, 255, 255, 0.02);
  border-right: 1px solid rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  animation: slideIn 0.3s ease-out;
}

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

.notification-pill.info {
  border-left-color: var(--cyan);
  background: rgba(6, 182, 212, 0.04);
}
.notification-pill.warning {
  border-left-color: var(--amber);
  background: rgba(245, 158, 11, 0.04);
}
.notification-pill.danger {
  border-left-color: var(--rose);
  background: rgba(244, 63, 94, 0.04);
}
.notification-pill.success {
  border-left-color: var(--emerald);
  background: rgba(16, 185, 129, 0.04);
}

.notification-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  align-self: flex-end;
}

/* Leaflet Customization for Glowing Dark Theme */
.leaflet-container {
  font-family: var(--font-family) !important;
}

.leaflet-popup-content-wrapper {
  background: rgba(15, 23, 42, 0.9) !important;
  backdrop-filter: blur(8px);
  border: 1px solid var(--panel-border);
  color: #fff !important;
  border-radius: 12px !important;
}

.leaflet-popup-tip {
  background: rgba(15, 23, 42, 0.9) !important;
  border: 1px solid var(--panel-border);
}

/* Custom Marker Styling */
.marker-pin-bus {
  width: 32px;
  height: 32px;
  border-radius: 50% 50% 50% 0;
  background: var(--cyan);
  position: absolute;
  transform: rotate(-45deg);
  left: 50%;
  top: 50%;
  margin: -16px 0 0 -16px;
  box-shadow: 0 0 15px var(--cyan-glow);
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.marker-pin-bus span {
  transform: rotate(45deg);
  font-size: 1.1rem;
}

.bus-custom-marker {
  transition: transform 0.4s ease-out, left 0.4s ease-out, top 0.4s ease-out;
}

/* Responsive collapse buttons */
.panel-toggle-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 50px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(10px);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 100;
  transition: var(--transition);
}

.left-toggle {
  left: 400px;
  border-radius: 0 8px 8px 0;
  border-left: none;
}

.right-toggle {
  right: 420px;
  border-radius: 8px 0 0 8px;
  border-right: none;
}

/* Collapsed States */
.left-panel.collapsed {
  transform: translateX(-100%);
  left: -20px;
}
.left-toggle.collapsed {
  left: 0;
}
.right-panel.collapsed {
  transform: translateX(100%);
  right: -20px;
}
.right-toggle.collapsed {
  right: 0;
}

.custom-input {
  background: rgba(13, 27, 62, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-family: var(--font-family);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
}

.custom-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 10px var(--cyan-glow);
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem 0;
  font-size: 0.9rem;
  font-style: italic;
}

/* --- Interactive Map Picker additions --- */

/* Map Picker Banner */
.map-banner {
  position: absolute;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--cyan);
  border-radius: 99px;
  padding: 0.5rem 1.5rem;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 4px 20px rgba(13, 27, 62, 0.12);
  backdrop-filter: blur(8px);
  animation: slideDownBanner 0.3s ease-out;
}

@keyframes slideDownBanner {
  from { transform: translate(-50%, -20px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

.map-banner .btn-done {
  background: var(--cyan);
  border: none;
  color: #fff;
  padding: 0.25rem 0.75rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.map-banner .btn-done:hover {
  background: #0d1b3e;
  box-shadow: 0 0 10px var(--cyan-glow);
}

/* Map Picker crosshair cursor */
.picker-cursor {
  cursor: crosshair !important;
}

/* Custom Marker Styling for Picker */
.marker-pin-picker {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  border: 2px solid #fff;
  font-weight: bold;
  color: #fff;
}
.marker-pin-picker.start {
  background: linear-gradient(135deg, var(--emerald), #047857);
  box-shadow: 0 0 10px var(--emerald-glow);
}
.marker-pin-picker.end {
  background: linear-gradient(135deg, var(--rose), #be123c);
  box-shadow: 0 0 10px var(--rose-glow);
}
.marker-pin-picker.inter {
  background: linear-gradient(135deg, var(--cyan), #0369a1);
  box-shadow: 0 0 10px var(--cyan-glow);
}

/* Intermediate stop list items in creator */
.temp-stop-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 0.35rem 0.6rem;
  margin-top: 0.25rem;
}

.temp-stop-item span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 250px;
}

.temp-stop-item .btn-remove-stop {
  background: transparent;
  border: none;
  color: var(--rose);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
}

.temp-stop-item .btn-remove-stop:hover {
  background: rgba(244, 63, 94, 0.1);
}

/* Floating Map Search Bar Styles */
.map-search-container {
  position: absolute;
  top: 15px;
  left: 440px; /* Aligned just right of the left panel (400px) + 1.5rem gap */
  z-index: 1000;
  width: 320px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(13, 27, 62, 0.12);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Fix 1 & 9: Smooth transition when panel collapses repositions search bar */
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), var(--transition);
}

/* Fix 1: Shift search bar left when left panel collapses */
.left-panel-collapsed .map-search-container {
  left: 30px;
}

.map-search-container:focus-within {
  border-color: var(--cyan);
  box-shadow: 0 0 10px var(--cyan-glow);
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  gap: 0.5rem;
}

.search-icon {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

#map-search-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.85rem;
  outline: none;
}

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

#map-search-clear-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
}

#map-search-clear-btn:hover {
  color: var(--rose);
  background: rgba(244, 63, 94, 0.1);
}

.map-search-results {
  border-top: 1px solid var(--panel-border);
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.search-result-item {
  padding: 0.6rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
  border-bottom: 1px solid rgba(13, 27, 62, 0.05);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-item:hover {
  background: rgba(13, 27, 62, 0.04);
  color: var(--text-primary);
}

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

/* --- New Locality Marker Styles --- */
.locality-marker {
  background-color: #0ea5e9;
  border: 3px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

.locality-marker.pink-city {
  background-color: #a855f7;
}

/* Custom Tooltip mimicking Google Maps Labels */
.locality-tooltip {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  margin-left: 10px;
}

.locality-tooltip::before {
  display: none;
}

.locality-label-container {
  font-family: 'Inter', sans-serif;
  text-shadow: 
    -1.5px -1.5px 0 #fff,  
     1.5px -1.5px 0 #fff,
    -1.5px  1.5px 0 #fff,
     1.5px  1.5px 0 #fff,
    0px 2px 4px rgba(0,0,0,0.1);
  white-space: nowrap;
}

.locality-label-title {
  /* Fix 8: Use white text + dark shadow — readable on both satellite & dark map tiles */
  color: #ffffff;
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.1;
}

.locality-label-subtitle {
  /* Fix 8: Light color for dark backgrounds */
  color: #cbd5e1;
  font-size: 0.85rem;
  line-height: 1.1;
  font-weight: 500;
}

.locality-label-desc {
  /* Fix 8: Muted light color for legibility */
  color: #94a3b8;
  font-size: 0.75rem;
  line-height: 1.2;
  white-space: normal;
  width: 140px;
  margin-top: 2px;
}

/* Fix 8: Update text-shadow for light-on-dark contrast */
.locality-label-container {
  font-family: 'Inter', sans-serif;
  text-shadow:
    -1.5px -1.5px 0 rgba(0,0,0,0.8),
     1.5px -1.5px 0 rgba(0,0,0,0.8),
    -1.5px  1.5px 0 rgba(0,0,0,0.8),
     1.5px  1.5px 0 rgba(0,0,0,0.8),
    0px 2px 6px rgba(0,0,0,0.6);
  white-space: nowrap;
}

/* Custom Tooltip for Route Stops */
.stop-tooltip {
  background: rgba(15, 23, 42, 0.95) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  color: #f8fafc !important;
  font-family: 'Outfit', sans-serif !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  padding: 4px 8px !important;
  border-radius: 6px !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6) !important;
  white-space: nowrap;
}

.stop-tooltip.leaflet-tooltip-top::before {
  border-top-color: rgba(15, 23, 42, 0.95) !important;
}
.stop-tooltip.leaflet-tooltip-bottom::before {
  border-bottom-color: rgba(15, 23, 42, 0.95) !important;
}
.stop-tooltip.leaflet-tooltip-left::before {
  border-left-color: rgba(15, 23, 42, 0.95) !important;
}
.stop-tooltip.leaflet-tooltip-right::before {
  border-right-color: rgba(15, 23, 42, 0.95) !important;
}

/* ─────────────────────────────────────────────
   Fix 5: Collapsed card — remove margin-bottom from title
   when the collapsible body is hidden
──────────────────────────────────────────────── */
.glass-card .card-title-sm.collapsed-title {
  margin-bottom: 0;
}

/* ─────────────────────────────────────────────
   Fix 2: Mobile & Tablet Responsive Layout
──────────────────────────────────────────────── */

/* Tablet landscape (1024px and below) */
@media (max-width: 1024px) {
  .left-panel  { width: 320px; }
  .right-panel { width: 340px; }
  .left-toggle  { left: 320px; }
  .right-toggle { right: 340px; }
  .map-search-container { left: 360px; width: 260px; }
  .left-panel-collapsed .map-search-container { left: 20px; }
}

/* Tablet portrait / large phone (768px and below) */
@media (max-width: 768px) {
  header {
    padding: 0.6rem 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
    height: auto;
  }
  .header-status {
    gap: 0.4rem;
    flex-wrap: wrap;
  }
  #system-status-badge { display: none; }
  #map-theme-btn { font-size: 0.75rem; }

  .dashboard-container { height: calc(100vh - 88px); }

  /* Stack panels at bottom as drawers on mobile */
  .overlay-panel {
    top: auto;
    bottom: 0;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-height: 55vh;
    border-radius: 20px 20px 0 0;
    border-bottom: none;
  }

  .left-panel  { display: none; } /* Hidden by default, opened by toggle */
  .right-panel { display: none; }

  .left-panel.mobile-open  { display: flex; z-index: 50; }
  .right-panel.mobile-open { display: flex; z-index: 50; }

  /* Reposition panel toggle buttons to bottom of screen */
  .panel-toggle-btn {
    top: auto;
    bottom: 10px;
    transform: none;
    width: 48px;
    height: 36px;
    border-radius: 99px;
    font-size: 0.9rem;
    z-index: 200;
  }
  .left-toggle {
    left: 10px;
    border-left: 1px solid var(--panel-border);
    border-radius: 99px;
  }
  .right-toggle {
    right: 10px;
    border-right: 1px solid var(--panel-border);
    border-radius: 99px;
  }
  .left-toggle.collapsed  { left: 10px; }
  .right-toggle.collapsed { right: 10px; }

  /* Search bar — full width across top on mobile */
  .map-search-container {
    left: 10px !important;
    right: 10px;
    top: 10px;
    width: auto !important;
  }
}

/* Small phone (480px and below) */
@media (max-width: 480px) {
  .logo-text span { display: none; }
  .panel-content  { padding: 1rem; gap: 1rem; }
  .info-grid      { grid-template-columns: 1fr; }
}

/* ── MAP RENDERING GPU OPTIMIZATIONS & TRANSITIONS ── */
.leaflet-container {
  background-color: #ffffff !important;
}

.leaflet-tile {
  will-change: transform, opacity;
  transform: translate3d(0, 0, 0);
  transition: opacity 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.leaflet-marker-icon {
  will-change: transform;
  transform: translate3d(0, 0, 0);
}

.leaflet-pane {
  will-change: transform;
}

.bus-custom-marker {
  will-change: transform;
  transform: translate3d(0, 0, 0);
}

/* ── Stop side-labels ─────────────────────────────────────────────────────── */
/* Permanent, direction=right labels placed beside each stop circle.          */
/* Leaflet wraps these in .leaflet-tooltip — we override its default look.    */

.leaflet-tooltip.stop-side-label {
  /* Reset default Leaflet tooltip chrome */
  background: rgba(10, 16, 30, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 6px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 3px 8px 3px 6px;
  white-space: nowrap;
  pointer-events: none;    /* clicks pass through to the map */

  /* Remove the default arrow */
  color: transparent;
}

/* Kill Leaflet's default arrow on ALL sides */
.leaflet-tooltip.stop-side-label::before {
  display: none;
}

/* ── Inner layout helpers ── */
.stop-side-label .stop-label-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
  flex-shrink: 0;
}

.stop-side-label .stop-label-icon {
  font-size: 0.7rem;
  margin-right: 2px;
  vertical-align: middle;
}

.stop-side-label .stop-label-text {
  font-family: 'Outfit', sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  color: #cbd5e1;
  letter-spacing: 0.01em;
  vertical-align: middle;
}

/* Terminal stops (first / last) get a slightly bolder label */
.leaflet-tooltip.stop-side-label--terminal {
  border-color: rgba(255, 255, 255, 0.18);
}

.stop-side-label--terminal .stop-label-text {
  font-weight: 650;
  color: #f1f5f9;
}

/* ── Visited / completed stop label ────────────────────────────────────────── */
/* Added dynamically via JS when the bus arrives at a stop.                    */
/* Matches the slate-gray (#64748b) used by the covered route polyline.        */

.leaflet-tooltip.stop-side-label--visited {
  background: rgba(30, 35, 48, 0.65);
  border-color: rgba(100, 116, 139, 0.25);
  transition: background 0.4s ease, border-color 0.4s ease;
}

.stop-side-label--visited .stop-label-dot {
  background: #64748b !important;   /* override the inline route-color */
  transition: background 0.4s ease;
}

.stop-side-label--visited .stop-label-icon {
  opacity: 0.4;
  transition: opacity 0.4s ease;
}

.stop-side-label--visited .stop-label-text {
  color: #64748b;
  font-weight: 400;
  transition: color 0.4s ease;
}
