/* ==========================================================================
   TeyMaps - Next-Gen Modern GIS & Transit Interface
   Color Palette: Deep Cyber Dark (#080d1a, #0f172a, #1e293b),
   Neon Accents: Cyan (#06b6d4), Emerald (#10b981), Amber (#f59e0b), Indigo (#6366f1)
   Mobile First & Desktop Pro Layout
   ========================================================================== */

:root {
  --bg-main: #090d16;
  --bg-panel: rgba(15, 23, 42, 0.86);
  --bg-panel-solid: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.72);
  --bg-hover: rgba(51, 65, 85, 0.65);
  --bg-active: rgba(6, 182, 212, 0.18);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(6, 182, 212, 0.4);
  --border-strong: rgba(255, 255, 255, 0.16);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-glow: #38bdf8;
  
  --primary: #06b6d4;
  --primary-hover: #0891b2;
  --primary-glow: rgba(6, 182, 212, 0.4);
  
  --accent-bike: #10b981;
  --accent-bus: #ff8400;
  --accent-route: #3b82f6;
  --accent-danger: #ef4444;
  --accent-purple: #8b5cf6;
  --accent-gold: #f59e0b;
  
  --shadow-lg: 0 12px 36px -4px rgba(0, 0, 0, 0.65), 0 0 1px 1px var(--border-subtle);
  --shadow-glow: 0 0 24px rgba(6, 182, 212, 0.3);
  --glass-blur: blur(20px);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --sidebar-w: 430px;
  --transition-fast: 0.18s ease;
  --transition-smooth: 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

[data-theme="light"] {
  --bg-main: #f8fafc;
  --bg-panel: rgba(255, 255, 255, 0.92);
  --bg-panel-solid: #ffffff;
  --bg-card: rgba(241, 245, 249, 0.94);
  --bg-hover: rgba(226, 232, 240, 0.85);
  --bg-active: rgba(6, 182, 212, 0.14);
  
  --border-subtle: rgba(0, 0, 0, 0.09);
  --border-glow: rgba(6, 182, 212, 0.45);
  --border-strong: rgba(0, 0, 0, 0.16);
  
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-glow: #0284c7;
  
  --shadow-lg: 0 10px 30px -5px rgba(0, 0, 0, 0.12), 0 0 1px 1px var(--border-subtle);
  --shadow-glow: 0 0 18px rgba(6, 182, 212, 0.2);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: fixed;
  background-color: var(--bg-main);
  color: var(--text-primary);
}

/* App Wrapper */
#app {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  overflow: hidden;
}

/* Map Canvas */
#map {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  background: #090d16;
  transition: transform 0.4s ease;
}

#map.pitch-mode {
  transform: perspective(900px) rotateX(28deg) translateY(-20px) scale(1.08);
}

/* Floating Sidebar Container (Desktop) */
.sidebar {
  position: absolute;
  top: 16px;
  left: 16px;
  bottom: 16px;
  width: var(--sidebar-w);
  max-width: calc(100vw - 32px);
  z-index: 20;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  transition: transform var(--transition-smooth), opacity var(--transition-smooth);
  overflow: hidden;
}

.sidebar.collapsed {
  transform: translateX(calc(-100% - 24px));
  opacity: 0;
  pointer-events: none;
}

/* Mobile Drag Bar */
.mobile-drag-bar {
  display: none;
  width: 100%;
  height: 20px;
  align-items: center;
  justify-content: center;
  cursor: grab;
}

.drag-handle {
  width: 36px;
  height: 4px;
  background: var(--text-muted);
  opacity: 0.5;
  border-radius: 2px;
}

/* Sidebar Header */
.sidebar-header {
  padding: 16px 20px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, transparent 100%);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  cursor: pointer;
}

.logo-badge {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #06b6d4, #3b82f6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  box-shadow: 0 0 16px rgba(6, 182, 212, 0.55);
}

.brand-info h1 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-info h1 span.city {
  font-size: 10.5px;
  font-weight: 700;
  background: rgba(6, 182, 212, 0.2);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.brand-tagline {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

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

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all var(--transition-fast);
}

.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

/* Nav Tabs */
.nav-tabs {
  display: flex;
  padding: 8px 12px;
  gap: 6px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(0,0,0,0.12);
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  flex: 1;
  min-width: 72px;
  padding: 8px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.tab-btn i {
  font-size: 15px;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.tab-btn.active {
  background: var(--bg-active);
  color: var(--primary);
  border-color: var(--border-glow);
  box-shadow: 0 0 14px rgba(6, 182, 212, 0.2);
}

/* Sidebar Scrollable Body */
.sidebar-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
  animation: fadeIn 0.25s ease-out;
}

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

/* Unified Search Bar */
.search-container {
  position: relative;
  margin-bottom: 14px;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  font-size: 15px;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 12px 42px 12px 40px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13.5px;
  font-weight: 500;
  outline: none;
  transition: all var(--transition-fast);
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.2);
  background: var(--bg-panel-solid);
}

.search-clear {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  display: none;
}

.search-input:not(:placeholder-shown) + .search-clear {
  display: block;
}

/* Autocomplete Dropdown */
.autocomplete-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 320px;
  overflow-y: auto;
  z-index: 100;
  display: none;
}

.autocomplete-results.show {
  display: block;
  animation: fadeIn 0.15s ease-out;
}

.result-item {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
}

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

.result-item:hover, .result-item.selected {
  background: var(--bg-hover);
}

.result-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--primary);
}

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

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

.result-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Category Quick Pills */
.category-pills {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.category-pills::-webkit-scrollbar { display: none; }

.cat-pill {
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.cat-pill:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.cat-pill.active {
  background: rgba(6, 182, 212, 0.2);
  border-color: var(--primary);
  color: var(--primary);
}

/* Section Cards */
.card-section {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 14px;
  transition: border-color var(--transition-fast);
}

.card-section:hover {
  border-color: var(--border-strong);
}

.card-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.badge-live {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

.badge-live::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 8px #ef4444;
  animation: pulseLive 1.5s infinite;
}

@keyframes pulseLive {
  0% { transform: scale(0.9); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.5; }
  100% { transform: scale(0.9); opacity: 1; }
}

/* Route Planner Panel */
.route-inputs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  margin-bottom: 12px;
}

.route-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.route-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.route-dot.start { background: var(--accent-bike); box-shadow: 0 0 8px var(--accent-bike); }
.route-dot.end { background: var(--accent-danger); box-shadow: 0 0 8px var(--accent-danger); }

.route-field {
  flex: 1;
  padding: 10px 38px 10px 12px;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: all var(--transition-fast);
}

.route-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.2);
}

.input-action-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--primary);
  cursor: pointer;
  padding: 6px;
  font-size: 14px;
  border-radius: 4px;
  transition: all var(--transition-fast);
  z-index: 2;
}

.input-action-btn:hover {
  background: rgba(6, 182, 212, 0.18);
  color: #38bdf8;
  transform: translateY(-50%) scale(1.1);
}

.btn-swap {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  transition: all var(--transition-fast);
  z-index: 3;
}

.btn-swap:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Route Transport Modes */
.mode-selector {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.mode-btn {
  flex: 1;
  padding: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.mode-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.mode-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.4);
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--primary), #2563eb);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 13.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.35);
  transition: all var(--transition-fast);
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Route Result Cards */
.route-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
  padding: 10px;
  background: var(--bg-panel-solid);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.stat-box {
  text-align: center;
}

.stat-box .val {
  font-size: 15px;
  font-weight: 800;
  color: var(--primary);
}

.stat-box .lbl {
  font-size: 10.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 2px;
}

/* Deep Search AI Analysis Panel */
.deep-search-box {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.08) 0%, rgba(99, 102, 241, 0.08) 100%);
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-top: 12px;
}

.deep-search-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

.ai-pill {
  background: linear-gradient(135deg, #06b6d4, #8b5cf6);
  color: #fff;
  font-size: 9.5px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.deep-insights-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.insight-item {
  font-size: 11.5px;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: 6px;
  line-height: 1.4;
}

.insight-item i {
  color: var(--accent-bike);
  margin-top: 2px;
  font-size: 12px;
}

/* Transit Bus List */
.bus-filter-pills {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 10px;
  scrollbar-width: none;
}
.bus-filter-pills::-webkit-scrollbar { display: none; }

.line-pill {
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.line-pill:hover, .line-pill.active {
  background: var(--accent-bus);
  color: #000;
  border-color: var(--accent-bus);
}

.bus-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.bus-card {
  padding: 10px 12px;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.bus-card:hover {
  background: var(--bg-hover);
  border-color: var(--border-glow);
  transform: translateX(2px);
}

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

.bus-badge {
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  background: #ff8400;
  min-width: 38px;
  text-align: center;
}

.bus-info-text .bus-line-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.bus-info-text .bus-dest {
  font-size: 11px;
  color: var(--text-muted);
}

.bus-card-right {
  text-align: right;
}

.bus-speed {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-bike);
  font-family: 'JetBrains Mono', monospace;
}

.bus-eta {
  font-size: 10.5px;
  color: var(--text-muted);
}

/* Floating Controls (Top Right & Bottom) */
.map-controls-top {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-controls-bottom {
  position: absolute;
  bottom: 24px;
  right: 16px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ctrl-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-fast);
}

.ctrl-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-glow);
  color: var(--primary);
  transform: scale(1.04);
}

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

/* Weather Widget Pill */
.weather-pill {
  height: 42px;
  padding: 0 14px;
  border-radius: var(--radius-full);
  background: var(--bg-panel);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.weather-pill:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

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

.weather-pill .city-label {
  font-size: 11px;
  color: var(--text-muted);
}

.weather-pill .humidity-badge {
  font-size: 11px;
  color: var(--primary);
  background: rgba(6, 182, 212, 0.12);
  padding: 2px 6px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 3px;
}

/* Time Machine Satellite Slider (Bottom Center) */
.time-machine-bar {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  background: var(--bg-panel);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 8px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-smooth);
}

.time-machine-bar.hidden {
  transform: translate(-50%, 100px);
  opacity: 0;
  pointer-events: none;
}

.tm-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-bus);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.tm-slider {
  width: 220px;
  accent-color: var(--accent-bus);
  cursor: pointer;
}

.tm-year {
  font-size: 13px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-primary);
  min-width: 48px;
}

/* Layer Selection Modal / Sheet (Pro & Atlas) */
.layer-modal {
  position: absolute;
  top: 68px;
  right: 16px;
  z-index: 50;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-lg);
  display: none;
  width: 340px;
  max-height: 80vh;
  overflow-y: auto;
}

.layer-modal.show {
  display: block;
  animation: fadeIn 0.2s ease-out;
}

.layer-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.layer-grid-pro {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.layer-card {
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  padding: 10px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.layer-card:hover {
  background: var(--bg-hover);
  border-color: var(--border-glow);
  transform: translateY(-2px);
}

.layer-card.active {
  border-color: var(--primary);
  background: var(--bg-active);
  box-shadow: 0 0 14px rgba(6, 182, 212, 0.25);
}

.layer-card-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--primary);
}

.layer-card-name {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.layer-card-desc {
  font-size: 9.5px;
  color: var(--text-muted);
}

/* Custom Marker Styling on Map */
.custom-bus-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.4s ease;
}

.bus-marker-pin {
  background: #0f172a;
  border: 2px solid #ff8400;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ff8400;
  font-size: 13px;
  box-shadow: 0 0 12px rgba(255, 132, 0, 0.6);
  position: relative;
}

.bus-marker-pin .bus-num {
  position: absolute;
  top: -8px;
  background: #ff8400;
  color: #000;
  font-size: 9px;
  font-weight: 900;
  padding: 1px 4px;
  border-radius: 4px;
  white-space: nowrap;
}

.custom-bike-icon {
  background: #064e3b;
  border: 2px solid #10b981;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
  font-size: 12px;
}

.user-pulse-marker {
  width: 20px;
  height: 20px;
  background: #3b82f6;
  border: 3px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.9);
  position: relative;
}

.user-pulse-marker::after {
  content: '';
  position: absolute;
  top: -8px;
  left: -8px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.4);
  animation: userPulse 2s infinite;
}

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

/* Custom Popup Card */
.leaflet-popup-content-wrapper {
  background: var(--bg-panel-solid) !important;
  color: var(--text-primary) !important;
  border-radius: var(--radius-md) !important;
  border: 1px solid var(--border-strong) !important;
  box-shadow: var(--shadow-lg) !important;
  padding: 0 !important;
}

.leaflet-popup-content {
  margin: 12px 14px !important;
  line-height: 1.4 !important;
}

.leaflet-popup-tip {
  background: var(--bg-panel-solid) !important;
}

.popup-btn {
  display: inline-block;
  padding: 6px 12px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: filter 0.15s ease;
}

.popup-btn:hover {
  filter: brightness(1.1);
}

/* Mobile Bottom Navigation Dock */
.mobile-bottom-dock {
  display: none;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(60px + var(--safe-area-bottom));
  padding-bottom: var(--safe-area-bottom);
  background: var(--bg-panel-solid);
  border-top: 1px solid var(--border-subtle);
  z-index: 40;
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.5);
}

.dock-item {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-secondary);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  border: none;
  transition: all var(--transition-fast);
}

.dock-item i {
  font-size: 17px;
}

.dock-item.active {
  color: var(--primary);
}

.dock-item.active i {
  transform: translateY(-2px);
  filter: drop-shadow(0 0 6px rgba(6, 182, 212, 0.6));
}

/* ==========================================================================
   MOBILE RESPONSIVE BREAKPOINT (< 768px)
   ========================================================================== */
@media (max-width: 768px) {
  .sidebar {
    top: auto;
    left: 0;
    right: 0;
    bottom: calc(60px + var(--safe-area-bottom));
    width: 100vw;
    max-width: 100vw;
    height: 52vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -8px 30px rgba(0,0,0,0.7);
    transform: translateY(0);
    z-index: 30;
  }

  .sidebar.collapsed {
    transform: translateY(calc(100% - 44px));
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar.expanded {
    height: 82vh;
  }

  .mobile-drag-bar {
    display: flex;
  }

  .mobile-bottom-dock {
    display: flex;
  }

  .nav-tabs {
    display: none; /* replaced by mobile dock */
  }

  .sidebar-header {
    padding: 10px 16px 8px;
  }

  .brand-logo .logo-badge {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }

  .brand-info h1 {
    font-size: 17px;
  }

  .map-controls-top {
    top: 12px;
    right: 12px;
    gap: 6px;
  }

  .weather-pill {
    height: 36px;
    padding: 0 10px;
    font-size: 12px;
  }

  .weather-pill .city-label {
    display: none;
  }

  .ctrl-btn {
    width: 38px;
    height: 38px;
    font-size: 14px;
  }

  .map-controls-bottom {
    bottom: calc(56vh + 10px);
    right: 12px;
    gap: 6px;
  }

  .time-machine-bar {
    bottom: calc(54vh + 10px);
    width: 92%;
    padding: 6px 14px;
  }

  .tm-slider {
    width: 130px;
  }

  .layer-modal {
    top: auto;
    bottom: calc(64px + var(--safe-area-bottom));
    left: 12px;
    right: 12px;
    width: auto;
    max-height: 70vh;
  }
}

/* ==========================================================================
   ALARM MODAL & SMART PROXIMITY STYLES
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease-out;
}

.modal-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 1px 1px var(--border-glow);
  overflow: hidden;
  animation: slideUpModal 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUpModal {
  from { transform: translateY(20px) scale(0.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-header {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.02);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.alarm-status-pill {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid #f59e0b;
  border-radius: var(--radius-full);
  padding: 8px 18px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.35);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
}

.alarm-status-pill.hidden {
  transform: translate(-50%, -60px);
  opacity: 0;
  pointer-events: none;
}

.alarm-siren-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.6);
  animation: sirenPulse 0.8s infinite alternate;
}

@keyframes sirenPulse {
  from { transform: scale(0.92); box-shadow: 0 0 15px rgba(239, 68, 68, 0.4); }
  to { transform: scale(1.1); box-shadow: 0 0 35px rgba(239, 68, 68, 0.9); }
}

/* ==========================================================================
   TeyMaps High-Tech Marker Clustering
   ========================================================================== */
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large {
  background-color: rgba(6, 182, 212, 0.25) !important;
  border-radius: 50% !important;
}
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div {
  background-color: #090d16 !important;
  border: 2px solid #06b6d4 !important;
  color: #38bdf8 !important;
  font-family: 'Outfit', sans-serif !important;
  font-weight: 800 !important;
  font-size: 12px !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 0 16px rgba(6, 182, 212, 0.6) !important;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.marker-cluster:hover div {
  transform: scale(1.15);
  border-color: #38bdf8 !important;
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.9) !important;
}
.marker-cluster-medium {
  background-color: rgba(245, 158, 11, 0.25) !important;
}
.marker-cluster-medium div {
  border-color: #f59e0b !important;
  color: #fbbf24 !important;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.6) !important;
}
.marker-cluster-large {
  background-color: rgba(225, 29, 72, 0.25) !important;
}
.marker-cluster-large div {
  border-color: #e11d48 !important;
  color: #fda4af !important;
  box-shadow: 0 0 16px rgba(225, 29, 72, 0.6) !important;
}

/* Brand POI Pin Badge */
.poi-brand-badge {
  display: inline-block;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 800;
  border-radius: 4px;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

/* Custom POI Marker with Text Label */
.poi-custom-marker {
  background: transparent !important;
  border: none !important;
}

.poi-marker-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.poi-marker-wrapper:hover {
  transform: translate(-50%, -54%) scale(1.14);
  z-index: 9999 !important;
}

.poi-marker-pin {
  background: #090d16;
  border: 2px solid var(--pin-color, #06b6d4);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--pin-color, #06b6d4);
  font-size: 13px;
  box-shadow: 0 0 14px var(--pin-glow, rgba(6, 182, 212, 0.6));
  position: relative;
  flex-shrink: 0;
}

.poi-marker-label {
  margin-top: 3px;
  background: rgba(10, 15, 30, 0.94);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #ffffff;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 12px;
  border: 1px solid var(--pin-border, rgba(6, 182, 212, 0.5));
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.7);
  font-family: 'Outfit', -apple-system, sans-serif;
  letter-spacing: 0.2px;
  pointer-events: none;
  line-height: 1.3;
}

.poi-marker-wrapper:hover .poi-marker-label {
  background: #0f172a;
  border-color: #38bdf8;
  color: #38bdf8;
  max-width: 220px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.9);
}

/* Duty Pharmacy Live Badge & Marker */
.duty-badge-live {
  position: absolute;
  top: -7px;
  right: -8px;
  background: #ef4444;
  color: #ffffff;
  font-size: 7px;
  font-weight: 900;
  padding: 1px 4px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  animation: pulse-glow 1.5s infinite;
}

.duty-card-item {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.duty-card-item:hover {
  background: rgba(30, 41, 59, 0.9);
  border-color: var(--primary);
  transform: translateY(-2px);
}

/* Traffic Incident Marker */
.incident-custom-icon {
  background: transparent !important;
  border: none !important;
}

.traffic-incident-marker {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.traffic-incident-marker:hover {
  transform: scale(1.18);
  z-index: 9999;
}

.incident-badge {
  position: absolute;
  bottom: -6px;
  background: #0f172a;
  color: #38bdf8;
  font-size: 8px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 8px;
  border: 1px solid #38bdf8;
  white-space: nowrap;
}

.vote-btn {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.vote-btn:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #38bdf8;
}

/* Incident Type Radio Selector */
.incident-type-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.incident-radio {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.8);
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.incident-radio input {
  accent-color: #f59e0b;
}

.incident-radio:has(input:checked) {
  border-color: #f59e0b;
  color: #ffffff;
  background: rgba(245, 158, 11, 0.15);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease-out;
}

.modal-card {
  background: #090d16;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8), 0 0 30px rgba(6, 182, 212, 0.15);
  border-radius: 14px;
  width: 100%;
  max-width: 440px;
  overflow: hidden;
}

.modal-header {
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.4);
}

.modal-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
}

.modal-close:hover {
  color: #ffffff;
}

/* Review Items */
.review-item {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px 10px;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 8px #ef4444; }
  50% { box-shadow: 0 0 16px #ef4444, 0 0 24px #ef444488; }
}

