:root {
  --primary-blue: #1e3a8a;
  --primary-blue-light: #2563eb;
  --primary-indigo: #4f46e5;
  --accent-green: #10b981;
  --accent-green-glow: rgba(16, 185, 129, 0.35);
  --accent-amber: #f59e0b;
  --accent-amber-glow: rgba(245, 158, 11, 0.35);
  --accent-red: #ef4444;
  --neutral-bg: #f8fafc;
  --card-bg: #ffffff;
  --card-border: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  --header-height: 60px;
  --sidebar-width: 380px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.14);
  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  background-color: var(--neutral-bg);
  color: var(--text-main);
  line-height: 1.5;
}

.app-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  position: relative;
}

/* ================= Header ================= */
.app-header {
  height: var(--header-height);
  background: #ffffff;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-sidebar-toggle {
  display: none;
  background: #f1f5f9;
  border: 1px solid var(--card-border);
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: 9px;
  font-size: 0.95rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-sidebar-toggle:active {
  transform: scale(0.94);
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: var(--shadow-sm);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.header-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--primary-blue);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.header-subtitle {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  display: block;
}

/* Status Pill */
.header-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.system-status-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  background: #f1f5f9;
  padding: 5px 12px;
  border-radius: 9999px;
  border: 1px solid #e2e8f0;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: all 0.3s ease;
}

.system-status-pill.live {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  color: #065f46;
}

.status-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
}

.system-status-pill.live .status-pulse-dot {
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulse-dot 1.8s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

/* Header Right Buttons */
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f8fafc;
  border: 1px solid var(--card-border);
  padding: 7px 12px;
  border-radius: 9px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.header-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.header-btn:active {
  transform: scale(0.96);
}

.btn-highlight {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}

.btn-highlight:hover {
  background: #fde68a;
  border-color: #fcd34d;
}

.btn-refresh {
  background: #eff6ff;
  color: #1e40af;
  border-color: #bfdbfe;
}

.btn-refresh:hover {
  background: #dbeafe;
}

.btn-about {
  background: #f8fafc;
  color: #334155;
  border-color: #cbd5e1;
}

.btn-about:hover {
  background: #eff6ff;
  color: var(--primary-blue);
  border-color: #93c5fd;
}

.btn-admin {
  background: #f1f5f9;
  color: #334155;
  border-color: #cbd5e1;
  text-decoration: none;
}

.btn-admin:hover {
  background: #1e293b;
  color: #ffffff;
  border-color: #0f172a;
}

.btn-refresh.refreshing i {
  animation: spin-refresh 0.6s linear infinite;
}

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

/* ================= Workspace Layout ================= */
.main-workspace {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
}

/* Sidebar / Bottom Sheet */
.bus-sidebar {
  width: var(--sidebar-width);
  background: #ffffff;
  border-right: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  z-index: 900;
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), max-height 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.sheet-drag-handle {
  display: none;
  width: 100%;
  padding: 8px 0 4px;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.drag-pill {
  width: 38px;
  height: 4px;
  background: #cbd5e1;
  border-radius: 999px;
}

/* Next Bus Hero Card */
.next-bus-card {
  margin: 12px 14px 6px;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  border-radius: 14px;
  padding: 14px;
  color: #ffffff;
  box-shadow: var(--shadow-md);
  border: 1px solid #334155;
  flex-shrink: 0;
}

.next-bus-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 6px;
}

.sheet-expand-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #93c5fd;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.sheet-expand-indicator i {
  font-size: 0.65rem;
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

.bus-sidebar.expanded .sheet-expand-indicator i {
  transform: rotate(180deg);
}

.next-bus-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.next-bus-badge.active-trip {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.4);
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: pulse-dot 1.5s infinite;
}

.link-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s;
}

.link-btn:hover {
  color: #ffffff;
}

.trip-route-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.trip-stop-from { color: #f8fafc; }
.trip-arrow-icon { color: var(--primary-blue-light); font-size: 0.8rem; }
.trip-stop-to { color: #38bdf8; }

.trip-time-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.trip-time-item {
  display: flex;
  flex-direction: column;
}

.time-label {
  font-size: 0.62rem;
  color: #94a3b8;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.time-val {
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffffff;
}

.trip-countdown-box {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 5px 12px;
  border-radius: 9px;
  text-align: center;
}

.countdown-label {
  display: block;
  font-size: 0.58rem;
  font-weight: 800;
  color: #fbbf24;
  letter-spacing: 0.05em;
}

.countdown-clock {
  font-size: 1.05rem;
  font-weight: 900;
  font-family: monospace;
  color: #ffffff;
}

.sidebar-header {
  padding: 12px 16px 8px;
  border-bottom: 1px solid #f1f5f9;
}

.sidebar-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3px;
}

.sidebar-title-row h2 {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
}

.bus-count-badge {
  font-size: 0.7rem;
  font-weight: 700;
  background: #eff6ff;
  color: var(--primary-blue-light);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #dbeafe;
}

.btn-sidebar-close {
  display: none;
  background: transparent;
  border: none;
  font-size: 1.1rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.sidebar-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Bus Cards List */
.bus-cards-list {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bus-card {
  background: #ffffff;
  border: 1.5px solid var(--card-border);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.bus-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--bus-color, var(--primary-blue));
  border-radius: 12px 0 0 12px;
}

.bus-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.bus-card.active {
  border-color: var(--primary-blue-light);
  background: #f8fafc;
  box-shadow: var(--shadow-md);
}

.bus-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.bus-card-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bus-indicator-icon {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: rgba(30, 58, 138, 0.08);
  color: var(--bus-color, var(--primary-blue));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}

.bus-card-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
}

.live-pill {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
}

.live-pill.online {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
}

.live-pill.stale {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
}

.live-pill.offline {
  background: #f1f5f9;
  color: #94a3b8;
}

.bus-route-text {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  line-height: 1.3;
}

/* Live Current & Next Stop Tracker Box in Bus Card */
.bus-live-stops-tracker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 10px;
  margin: 6px 0 9px;
  transition: all 0.2s ease;
}

.bus-card.active .bus-live-stops-tracker {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.stop-box-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stop-tag-label {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.stop-tag-label.current-tag {
  color: #059669;
}

.stop-tag-label.next-tag {
  color: #2563eb;
}

.stop-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
  animation: liveStopPulse 1.8s infinite;
}

@keyframes liveStopPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: 0.7; }
}

.stop-title-val {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.stop-title-val.next-val-text {
  color: #1e3a8a;
}

.stop-box-arrow {
  color: #94a3b8;
  font-size: 0.72rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 2px;
}

.bus-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.meta-speed {
  color: var(--primary-blue);
  font-weight: 700;
}

/* Stops Timeline Panel */
.stops-panel {
  padding: 12px 16px;
  border-top: 1px solid #f1f5f9;
}

.stops-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.stops-panel-header h3 {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.route-badge {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--primary-blue);
  background: #eff6ff;
  padding: 2px 8px;
  border-radius: 999px;
}

.timeline-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stop-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  cursor: pointer;
  transition: all 0.15s;
}

.stop-item:hover {
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.stop-bullet {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #1e3a8a;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stop-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stop-info-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.stop-item.is-current-stop {
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.stop-item.is-current-stop .stop-bullet {
  background: #059669;
}

.stop-item.is-next-stop {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.stop-item.is-next-stop .stop-bullet {
  background: #2563eb;
}

/* Stops not included in the active trip are dimmed but still visible */
.stop-item.stop-not-in-trip {
  opacity: 0.38;
  pointer-events: auto; /* still clickable to fly map */
}
.stop-item.stop-not-in-trip .stop-bullet {
  background: var(--text-subtle);
}

.timeline-stop-pill {
  font-size: 0.62rem;
  font-weight: 800;
  padding: 1.5px 6px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.timeline-stop-pill.current-pill {
  background: rgba(16, 185, 129, 0.15);
  color: #047857;
}

.timeline-stop-pill.next-pill {
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
}

.pill-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #10b981;
}

.stop-pin-icon {
  color: #94a3b8;
  font-size: 0.8rem;
  transition: color 0.2s;
}

.stop-item:hover .stop-pin-icon {
  color: var(--primary-blue);
}

.loading-state, .no-selection-msg {
  text-align: center;
  padding: 16px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ================= Map Area ================= */
.map-wrapper {
  flex: 1;
  position: relative;
  height: 100%;
  width: 100%;
}

.map-canvas {
  width: 100%;
  height: 100%;
  background: #e5e7eb;
}

/* Floating Map Quick-Controls */
.floating-controls {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 800;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map-ctrl-btn {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 10px;
  color: var(--primary-blue);
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  transition: all 0.2s;
}

.map-ctrl-btn:hover {
  background: #ffffff;
  color: var(--primary-blue-light);
  transform: scale(1.05);
}

.map-ctrl-btn:active {
  transform: scale(0.95);
}

/* Floating Bus HUD */
.floating-bus-hud {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(16px);
  border: 1px solid #334155;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 800;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}

.floating-bus-hud.hidden {
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateY(20px);
  pointer-events: none;
}

.hud-bus-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hud-icon-box {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-blue-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.hud-bus-info h3 {
  font-size: 0.88rem;
  font-weight: 700;
}

.hud-bus-info p {
  font-size: 0.72rem;
  color: #94a3b8;
}

.hud-close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 0.9rem;
  cursor: pointer;
}

/* ================= Leaflet Custom Markers ================= */
.custom-stop-marker {
  width: 26px !important;
  height: 26px !important;
  background: #ffffff;
  border: 2.5px solid #1e3a8a;
  border-radius: 50%;
  color: #1e3a8a;
  display: flex !important;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

.bus-vehicle-marker {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.bus-logo-badge {
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35));
  transition: transform 0.2s ease;
}

.bus-vehicle-marker:hover .bus-logo-badge {
  transform: scale(1.1);
}

.bus-heading-indicator {
  position: absolute;
  top: -10px;
  left: 50%;
  transform-origin: bottom center;
  width: 14px;
  height: 14px;
  pointer-events: none;
}

.heading-arrow-tip {
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 10px solid #ef4444;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.bus-radar-pulse {
  position: absolute;
  top: 6px;
  left: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.35);
  animation: radar-pulse 2s infinite ease-out;
  pointer-events: none;
}

@keyframes radar-pulse {
  0% { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; }
}

.bus-floating-tag {
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(8px);
  color: #ffffff;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  margin-top: 2px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.bus-tag-speed {
  color: #38bdf8;
  font-weight: 800;
}

/* ================= Timetable Modal Dialog ================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-window {
  background: #ffffff;
  border-radius: 18px;
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

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

.modal-icon-badge {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #eff6ff;
  color: var(--primary-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.modal-header h2 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
}

.modal-subtitle {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.btn-modal-close {
  background: #f1f5f9;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  cursor: pointer;
}

.modal-toolbar {
  padding: 10px 18px;
  background: #f8fafc;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.modal-tab {
  background: #ffffff;
  border: 1px solid var(--card-border);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}

.modal-tab.active {
  background: var(--primary-blue);
  color: #ffffff;
  border-color: var(--primary-blue);
}

.filter-pills {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-pill {
  background: transparent;
  border: 1px solid #cbd5e1;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}

.filter-pill.active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

.modal-body {
  padding: 12px 18px;
  overflow-y: auto;
  flex: 1;
}

.schedule-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.schedule-table th {
  text-align: left;
  padding: 8px 10px;
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.72rem;
  border-bottom: 1px solid var(--card-border);
  white-space: nowrap;
}

.schedule-table td {
  padding: 10px 10px;
  border-bottom: 1px solid #f1f5f9;
  font-weight: 600;
}

.schedule-row {
  cursor: pointer;
  transition: background 0.15s;
}

.schedule-row:hover {
  background: #f8fafc;
}

.schedule-row.row-active {
  background: rgba(16, 185, 129, 0.08);
}

.schedule-row.row-next {
  background: rgba(245, 158, 11, 0.08);
}

.stop-tag {
  color: var(--text-main);
  font-weight: 700;
}

.time-tag {
  color: var(--primary-blue);
  font-weight: 800;
  font-family: monospace;
  font-size: 0.85rem;
}

.modal-footer {
  padding: 10px 18px;
  border-top: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
}

.modal-footer-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

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

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

.legend-dot.active { background: var(--accent-green); }
.legend-dot.upcoming { background: var(--accent-amber); }

.btn-primary-close {
  background: var(--primary-blue);
  color: #ffffff;
  border: none;
  padding: 7px 18px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary-close:hover {
  background: #1d4ed8;
}

/* ================= Embedded About Us & Team Footer ================= */
.app-about-footer {
  margin-top: 14px;
  background: #f8fafc;
  border-top: 1px solid var(--card-border);
  padding: 16px 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

.footer-section-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.footer-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #eff6ff;
  color: var(--primary-blue);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid #bfdbfe;
}

.footer-section-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.footer-section-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.footer-team-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-member-card {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.footer-member-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.footer-member-card.faculty-card {
  border-left: 3.5px solid #2563eb;
}

.footer-member-card.student-card {
  border-left: 3.5px solid #10b981;
}

.footer-member-top {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.footer-role-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2.5px 7px;
  border-radius: 6px;
  letter-spacing: 0.02em;
}

.footer-role-pill.faculty-role {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.footer-role-pill.student-role {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.footer-member-body {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.footer-avatar-box {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--card-border);
}

.footer-avatar-box.has-photo {
  border-color: #93c5fd;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.18);
  background: #e0f2fe;
}

.member-photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 10%;
  display: block;
}

.footer-avatar-box.faculty-avatar {
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  color: #ffffff;
}

.footer-avatar-box.student-avatar {
  background: linear-gradient(135deg, #047857 0%, #10b981 100%);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.22);
}

.footer-member-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.footer-member-name {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.25;
}

.footer-member-designation {
  font-size: 0.74rem;
  font-weight: 700;
  color: #334155;
}

.footer-member-dept {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.35;
  margin-top: 1px;
}

.footer-member-inst {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--primary-blue);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.footer-partner-card {
  background: #ffffff;
  border-radius: 10px;
  border: 1px dashed #cbd5e1;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}

.footer-partner-card:hover {
  background: #f0f7ff;
  border-color: #93c5fd;
  border-style: solid;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(37, 99, 235, 0.08);
}

.footer-partner-card:hover .footer-partner-name {
  color: var(--primary-blue-light);
}

.footer-partner-card:hover .partner-ext-icon {
  color: var(--primary-blue-light);
  transform: translate(1px, -1px);
}

.footer-partner-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #475569;
  font-size: 1.05rem;
  flex-shrink: 0;
  overflow: hidden;
  padding: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: border-color 0.2s ease;
}

.footer-partner-card:hover .footer-partner-icon {
  border-color: #bfdbfe;
}

.partner-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.footer-partner-details {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.footer-partner-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.partner-ext-icon {
  font-size: 0.65rem;
  color: var(--text-subtle);
  transition: all 0.2s ease;
}

.footer-partner-tag {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.footer-partner-name {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.25;
  transition: color 0.2s ease;
}

.footer-partner-loc {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.footer-copyright-bar {
  padding-top: 8px;
  border-top: 1px solid #e2e8f0;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.4;
}

.copyright-link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: #cbd5e1;
  transition: color 0.2s, text-decoration-color 0.2s;
}

.copyright-link:hover {
  color: var(--primary-blue-light);
  text-decoration-color: var(--primary-blue-light);
}

/* ================= Mobile Optimized Design ================= */
@media (max-width: 768px) {
  :root {
    --header-height: 54px;
  }

  .app-header {
    padding: 0 10px;
  }

  .btn-sidebar-toggle {
    display: none;
  }

  .header-logo {
    width: 30px;
    height: 30px;
    border-radius: 6px;
  }

  .header-title {
    font-size: 0.88rem;
    white-space: nowrap;
  }

  .header-subtitle {
    display: none;
  }

  /* Compact Live Status Pill on Mobile */
  .system-status-pill {
    padding: 2.5px 7px;
    font-size: 0.64rem;
    font-weight: 700;
    gap: 4px;
    line-height: 1.1;
    white-space: nowrap;
    border-radius: 9999px;
  }

  .status-pulse-dot {
    width: 5.5px;
    height: 5.5px;
  }

  .header-right {
    gap: 5px;
  }

  .header-btn {
    padding: 5px 8px;
    font-size: 0.72rem;
    gap: 4px;
  }

  .btn-label-desktop {
    display: inline;
  }

  /* Bottom Sheet on Mobile */
  .bus-sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(226, 232, 240, 0.9);
    border-right: none;
    box-shadow: 0 -8px 30px rgba(15, 23, 42, 0.18);
    z-index: 950;
    max-height: 180px;
    overflow: hidden !important;
    transition: max-height 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    touch-action: pan-y;
  }

  .bus-sidebar.expanded {
    max-height: 80vh;
    overflow-y: auto !important;
  }

  .sheet-drag-handle {
    display: flex;
    padding: 8px 0 3px;
  }

  .drag-pill {
    width: 44px;
    height: 5px;
    background: #cbd5e1;
  }

  .next-bus-card {
    margin: 4px 10px 6px;
    padding: 10px 12px;
    border-radius: 12px;
  }

  .next-bus-header {
    margin-bottom: 6px;
  }

  .trip-route-row {
    font-size: 0.82rem;
    margin-bottom: 6px;
    padding-bottom: 6px;
  }

  .trip-countdown-box {
    padding: 3px 8px;
  }

  .countdown-clock {
    font-size: 0.92rem;
  }

  .sidebar-header {
    padding: 8px 12px 6px;
  }

  .bus-cards-list {
    padding: 8px 10px;
  }

  .stops-panel {
    padding: 8px 12px 18px;
  }

  /* Floating controls above bottom sheet */
  .floating-controls {
    top: 10px;
    right: 10px;
    gap: 6px;
  }

  .map-ctrl-btn {
    width: 38px;
    height: 38px;
    font-size: 0.88rem;
  }

  .floating-bus-hud {
    display: none;
  }

  /* Timetable Modal Mobile */
  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }

  .modal-window {
    max-height: 90vh;
    border-radius: 20px 20px 0 0;
    animation: slideUpModal 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }

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

  .modal-header {
    padding: 12px 14px;
  }

  .modal-toolbar {
    padding: 8px 12px;
    gap: 6px;
  }

  .modal-tab {
    padding: 5px 10px;
    font-size: 0.72rem;
  }

  .filter-pill {
    padding: 3px 8px;
    font-size: 0.68rem;
  }

  .modal-body {
    padding: 8px 10px;
  }

  .schedule-table th, .schedule-table td {
    padding: 7px 5px;
    font-size: 0.72rem;
  }
}

@media (max-width: 380px) {
  .header-title {
    font-size: 0.8rem;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .btn-label-desktop {
    display: none;
  }

  .header-btn {
    padding: 6px 8px;
  }
}
