/* ==========================================================================
   BOXAREA GIS DESIGN SYSTEM (VANILLA CSS)
   ========================================================================== */

:root {
  /* Color Palette - HSL curated values */
  --bg-primary: hsl(222, 47%, 7%);     /* Very dark navy */
  --bg-secondary: hsl(222, 35%, 11%);   /* Sleek panel color */
  --bg-tertiary: hsl(222, 28%, 16%);    /* Card/hover color */
  
  --border-light: rgba(255, 255, 255, 0.08);
  --border-focus: hsl(210, 100%, 55%);
  
  /* Text colors */
  --txt-primary: hsl(210, 40%, 98%);
  --txt-secondary: hsl(215, 20%, 75%);
  --txt-muted: hsl(215, 15%, 50%);
  
  /* Accent Colors */
  --accent-red: hsl(0, 85%, 55%);        /* Engines & Stations */
  --accent-cyan: hsl(180, 100%, 45%);     /* Trucks & Aerials */
  --accent-yellow: hsl(45, 100%, 50%);    /* Rescues & Squads */
  --accent-green: hsl(145, 80%, 45%);     /* EMS & Ambulances */
  --accent-orange: hsl(28, 100%, 55%);    /* Tankers & Water Tenders */
  --accent-purple: hsl(272, 72%, 67%);    /* Chiefs & Command */
  
  /* Fonts */
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', SFMono-Regular, Consolas, monospace;
  
  /* Shadows */
  --shadow-lg: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 15px rgba(255, 255, 255, 0.05);
  
  /* Transitions */
  --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);

  /* Theme-dependent backgrounds & accents */
  --bg-gradient: linear-gradient(180deg, rgba(11, 15, 25, 0.6) 0%, rgba(11, 15, 25, 0) 100%);
  --bg-detail-panel: rgba(17, 22, 37, 0.4);
  --bg-footer: rgba(11, 15, 25, 0.3);
  --bg-overlay: rgba(17, 22, 37, 0.85);
  --county-line-color: rgba(255, 255, 255, 0.35);
}

/* Light Theme overrides */
[data-theme="light"] {
  --bg-primary: hsl(222, 30%, 97%);     /* Softer cool gray background */
  --bg-secondary: hsl(0, 0%, 100%);     /* Pure white panels */
  --bg-tertiary: hsl(222, 25%, 92%);    /* Softer card hover background */
  
  --border-light: rgba(0, 0, 0, 0.08);   /* Darker borders for contrast */
  --border-focus: hsl(210, 95%, 45%);   /* High-contrast blue highlight */
  
  --txt-primary: hsl(222, 47%, 12%);    /* Near black main text */
  --txt-secondary: hsl(222, 15%, 32%);  /* Dark gray secondary text */
  --txt-muted: hsl(215, 10%, 52%);      /* Muted gray text */
  
  --shadow-lg: 0 10px 30px -10px rgba(0, 0, 0, 0.06);
  --shadow-glow: 0 0 12px rgba(0, 0, 0, 0.01);

  /* Richer, readable text colors for light backgrounds to ensure high contrast */
  --accent-red: hsl(0, 75%, 45%);        /* Richer red */
  --accent-cyan: hsl(195, 85%, 35%);     /* Darker teal/cyan */
  --accent-yellow: hsl(40, 85%, 40%);     /* Darker gold/yellow */
  --accent-green: hsl(145, 70%, 35%);     /* Darker forest green */
  --accent-orange: hsl(25, 85%, 45%);     /* Darker orange */
  --accent-purple: hsl(272, 60%, 50%);    /* Darker purple */
  
  --bg-gradient: linear-gradient(180deg, rgba(0, 0, 0, 0.02) 0%, rgba(0, 0, 0, 0) 100%);
  --bg-detail-panel: rgba(0, 0, 0, 0.01);
  --bg-footer: rgba(0, 0, 0, 0.02);
  --bg-overlay: rgba(255, 255, 255, 0.95);
  --county-line-color: rgba(0, 0, 0, 0.35);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--txt-primary);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* App Layout Grid */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* Sidebar Console */
.sidebar-console {
  position: relative;
  width: 440px;
  min-width: 440px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  height: 100%;
  box-shadow: var(--shadow-lg);
  z-index: 10;
  overflow-y: auto;
}

/* Custom Scrollbar for Sidebar */
.sidebar-console::-webkit-scrollbar {
  width: 6px;
}
.sidebar-console::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
.sidebar-console::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 3px;
}
.sidebar-console::-webkit-scrollbar-thumb:hover {
  background: var(--txt-muted);
}

/* App Header */
.app-header {
  padding: 24px 28px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-gradient);
}

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

.logo-area h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--txt-primary);
}

.logo-area h1 span {
  color: var(--accent-red);
  background: linear-gradient(90deg, var(--accent-red) 0%, var(--accent-orange) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.status-dot {
  width: 10px;
  height: 10px;
  background-color: var(--accent-green);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-green);
}

.status-dot.pulsing {
  animation: pulse 2s infinite;
}

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

.subtitle {
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--txt-secondary);
  margin-top: 4px;
  opacity: 0.8;
}

/* Sections */
.console-section {
  padding: 24px 28px;
  border-bottom: 1px solid var(--border-light);
}

.section-title {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--txt-muted);
  margin-bottom: 16px;
  font-weight: 700;
}

/* Form Styling */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--txt-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.console-select {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  color: var(--txt-primary);
  padding: 10px 14px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.console-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.25);
}

/* Results Banner */
.query-results-banner {
  padding: 14px;
  border-radius: 6px;
  background-color: var(--bg-tertiary);
  border-left: 4px solid var(--txt-muted);
  font-size: 13px;
  color: var(--txt-secondary);
  line-height: 1.5;
  transition: var(--transition-smooth);
}

.query-results-banner.active {
  border-left-color: var(--accent-green);
  background-color: rgba(46, 204, 113, 0.05);
  color: var(--txt-primary);
}

/* Console Input and Button Styling */
.console-input {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  color: var(--txt-primary);
  padding: 10px 14px;
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
  transition: var(--transition-smooth);
  width: 100%;
}

.console-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.25);
}

.console-btn {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  color: var(--txt-primary);
  padding: 10px 16px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  outline: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.console-btn:hover {
  background-color: var(--border-light);
  border-color: var(--txt-muted);
}

.console-btn:active {
  transform: scale(0.98);
}

.console-btn.primary-btn {
  background-color: var(--accent-red);
  border-color: transparent;
}

.console-btn.primary-btn:hover {
  background-color: hsl(0, 85%, 60%);
  box-shadow: 0 0 10px rgba(235, 64, 52, 0.3);
}

.input-with-btn {
  display: flex;
  gap: 8px;
  width: 100%;
}

.autocomplete-wrapper {
  position: relative;
}

.address-suggestions-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.55);
  z-index: 1000;
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.address-suggestions-dropdown.hidden {
  display: none !important;
}

.address-suggestion-item {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--txt-primary);
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition-smooth);
}

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

.address-suggestion-item:hover, .address-suggestion-item.selected {
  background-color: var(--bg-tertiary);
  color: var(--accent-cyan);
}

.address-suggestion-item .suggestion-icon {
  font-size: 12px;
  color: var(--txt-muted);
  flex-shrink: 0;
}

.address-suggestion-item .suggestion-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-grow: 1;
}

.address-suggestion-item .suggestion-dist {
  margin-left: auto;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
  background: var(--bg-primary);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-light);
  flex-shrink: 0;
}

/* My Location chip button */
.location-chip-btn {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--accent-cyan);
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition-smooth);
}

.location-chip-btn:hover {
  background: rgba(0, 229, 255, 0.12);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.2);
}

.location-chip-btn .crosshair-icon {
  font-size: 13px;
  line-height: 1;
}

/* Google Search Button */
.console-btn.google-btn {
  background: hsl(217, 89%, 61%);
  border-color: transparent;
  color: #ffffff;
  padding: 10px 14px;
  font-weight: 700;
}

.console-btn.google-btn:hover {
  background: hsl(217, 89%, 68%);
  box-shadow: 0 0 10px rgba(66, 133, 244, 0.35);
}

.console-btn.google-btn:disabled,
.console-btn.google-btn.disabled {
  background: rgba(45, 55, 72, 0.6) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: var(--txt-muted, #717d96) !important;
  cursor: not-allowed !important;
  opacity: 0.45 !important;
  pointer-events: none !important;
  box-shadow: none !important;
}

/* Pulsing User Location Marker */
.user-location-marker {
  width: 16px;
  height: 16px;
  background: hsl(205, 100%, 55%);
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 12px hsl(205, 100%, 55%);
  animation: user-loc-pulse 2s infinite ease-in-out;
}

@keyframes user-loc-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 180, 255, 0.7);
  }
  70% {
    box-shadow: 0 0 0 16px rgba(0, 180, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 180, 255, 0);
  }
}

.input-with-btn .console-input {
  flex-grow: 1;
}

.locator-results-banner {
  padding: 12px;
  border-radius: 6px;
  background-color: var(--bg-tertiary);
  border-left: 4px solid var(--txt-muted);
  font-size: 12px;
  color: var(--txt-secondary);
  margin-top: 12px;
  line-height: 1.4;
  transition: var(--transition-smooth);
}

.locator-results-banner.success {
  border-left-color: var(--accent-green);
  background-color: rgba(46, 204, 113, 0.05);
  color: var(--txt-primary);
}

.locator-results-banner.error {
  border-left-color: var(--accent-red);
  background-color: rgba(235, 64, 52, 0.05);
  color: var(--txt-primary);
}

/* Detail Panel / Placeholder */
.detail-panel {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  background-color: var(--bg-detail-panel);
}

.detail-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  flex-grow: 1;
}

.placeholder-icon {
  font-size: 36px;
  margin-bottom: 16px;
  opacity: 0.4;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
  100% { transform: translateY(0px); }
}

.detail-placeholder h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--txt-secondary);
  margin-bottom: 8px;
}

.detail-placeholder p {
  font-size: 13px;
  color: var(--txt-muted);
  max-width: 260px;
  line-height: 1.5;
}

.detail-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.detail-content.hidden {
  display: none !important;
}

.detail-header {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 12px;
  margin-bottom: 20px;
  overflow: hidden;
}

.detail-header > div:last-child {
  flex: 1;
  min-width: 0;
}

.box-badge-large {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  background-color: var(--bg-primary);
  border: 2px solid var(--accent-yellow);
  color: var(--accent-yellow);
  padding: 4px 10px;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(255, 191, 0, 0.15);
}

.detail-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--txt-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta-txt {
  font-size: 12px;
  color: var(--txt-muted);
  margin-top: 2px;
}

.meta-txt span {
  color: var(--txt-secondary);
  font-weight: 600;
}

.badge-county {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(0, 229, 255, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 229, 255, 0.3);
}

/* Box Card Action Buttons */
.box-card-actions {
  display: flex;
  gap: 8px;
  margin: 14px 0;
}

/* CAD Box Card Metadata Grid */
.box-card-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.box-meta-item {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  transition: var(--transition-smooth);
}

.box-meta-item:hover {
  border-color: var(--border-focus);
  background-color: var(--bg-tertiary);
}

.box-meta-item.full-width {
  grid-column: span 2;
}

.box-meta-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--txt-muted);
  margin-bottom: 4px;
}

.box-meta-val {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--txt-primary);
  word-break: break-all;
  line-height: 1.35;
}


/* Tabs */
.detail-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 16px;
}

.tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--txt-muted);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 0;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition-smooth);
}

.tab-btn:hover {
  color: var(--txt-secondary);
}

.tab-btn.active {
  color: var(--txt-primary);
  border-bottom-color: var(--border-focus);
}

.tab-content {
  display: none;
  flex-direction: column;
  gap: 12px;
}

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

/* Complement Summary */
.complement-summary {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.04);
  border: 1px dashed rgba(0, 229, 255, 0.2);
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 8px;
}

/* Dispatched list items */
.dispatched-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 350px;
  overflow-y: auto;
  padding-right: 4px;
}

.dispatched-list::-webkit-scrollbar {
  width: 4px;
}
.dispatched-list::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 2px;
}

/* Unified Unit tag styles */
.unit-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 6px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-light);
  transition: var(--transition-smooth);
}

.unit-card:hover {
  transform: translateX(4px);
  background-color: var(--bg-tertiary);
}

.unit-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.order-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--txt-muted);
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-secondary);
  border-radius: 50%;
  border: 1px solid var(--border-light);
}

.unit-tag {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
  border-width: 1px;
  border-style: solid;
}

.unit-tag.engine {
  background-color: rgba(235, 64, 52, 0.12);
  border-color: rgba(235, 64, 52, 0.4);
  color: var(--accent-red);
}

.unit-tag.truck {
  background-color: rgba(0, 229, 255, 0.12);
  border-color: rgba(0, 229, 255, 0.4);
  color: var(--accent-cyan);
}

.unit-tag.rescue {
  background-color: rgba(255, 191, 0, 0.12);
  border-color: rgba(255, 191, 0, 0.4);
  color: var(--accent-yellow);
}

.unit-tag.tanker {
  background-color: rgba(255, 127, 0, 0.12);
  border-color: rgba(255, 127, 0, 0.4);
  color: var(--accent-orange);
}

.unit-tag.ems {
  background-color: rgba(46, 204, 113, 0.12);
  border-color: rgba(46, 204, 113, 0.4);
  color: var(--accent-green);
}

.unit-tag.chief {
  background-color: rgba(165, 105, 189, 0.12);
  border-color: rgba(165, 105, 189, 0.4);
  color: var(--accent-purple);
}

.unit-station-lbl {
  font-size: 11px;
  color: var(--txt-muted);
}

.unit-status-pill {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-green);
  background-color: rgba(46, 204, 113, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Full Run Stream Styles */
.full-stream-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 350px;
  overflow-y: auto;
  padding-right: 4px;
}

.full-stream-container::-webkit-scrollbar {
  width: 4px;
}
.full-stream-container::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 2px;
}

.info-txt {
  font-size: 13px;
  color: var(--txt-secondary);
}

.stream-type-block {
  border-left: 2px solid var(--border-light);
  padding-left: 14px;
}

.stream-type-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--txt-muted);
  margin-bottom: 8px;
}

.stream-apparatus-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.stream-unit-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 6px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  color: var(--txt-secondary);
}

.stream-unit-pill.due-active {
  background-color: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.4);
  color: var(--border-focus);
}

/* Footer info */
.console-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--border-light);
  background-color: var(--bg-footer);
}

.console-footer p {
  font-size: 11px;
  color: var(--txt-muted);
  text-align: center;
}

/* Map Viewport Area */
.map-viewport {
  flex-grow: 1;
  position: relative;
  height: 100%;
}

#map {
  width: 100%;
  height: 100%;
  background-color: var(--bg-primary);
}

/* Customize Leaflet elements to blend with Dark GIS Theme */
.leaflet-container {
  background-color: var(--bg-primary) !important;
}

.leaflet-bar {
  border: 1px solid var(--border-light) !important;
  box-shadow: var(--shadow-lg) !important;
}

.leaflet-bar a {
  background-color: var(--bg-secondary) !important;
  color: var(--txt-primary) !important;
  border-bottom: 1px solid var(--border-light) !important;
  transition: var(--transition-smooth);
}

.leaflet-bar a:hover {
  background-color: var(--bg-tertiary) !important;
  color: var(--border-focus) !important;
}

.leaflet-popup-content-wrapper {
  background-color: var(--bg-secondary) !important;
  color: var(--txt-primary) !important;
  border: 1px solid var(--border-light) !important;
  border-radius: 8px !important;
  box-shadow: var(--shadow-lg) !important;
}

.leaflet-popup-tip {
  background-color: var(--bg-secondary) !important;
  border: 1px solid var(--border-light) !important;
}

.popup-station-card {
  padding: 6px;
}

.popup-station-card h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--accent-red);
}

.popup-station-card p {
  font-size: 11px;
  color: var(--txt-secondary);
  margin-bottom: 8px;
}

.popup-apparatus-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.popup-unit-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 4px;
  border-radius: 3px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-light);
  color: var(--txt-secondary);
}

/* Floating overlay legends */
.map-floating-overlay {
  position: absolute;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  background: var(--bg-overlay);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 14px 18px;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
}

.legend-box h4 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--txt-secondary);
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 6px;
}

.legend-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--txt-secondary);
}

.legend-color {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid transparent;
}

.county-line-legend {
  width: 14px;
  height: 0px;
  border-top: 2.5px dashed var(--county-line-color);
  margin-right: 2px;
  display: inline-block;
}

/* Incident Locator Beacon Marker styles */
.incident-beacon-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.incident-beacon {
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background-color: var(--accent-red);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 12px var(--accent-red);
  transform: translate(-5px, -5px);
  z-index: 999;
}

.incident-beacon-pulse {
  position: absolute;
  width: 48px;
  height: 48px;
  background-color: var(--accent-red);
  border-radius: 50%;
  opacity: 0.4;
  animation: beacon-pulse 1.8s infinite ease-out;
  pointer-events: none;
  z-index: 998;
}

.station-color {
  width: 26px;
  height: 14px;
  background: linear-gradient(135deg, #b71c1c 0%, #7f0000 100%);
  border: 1.5px solid rgba(255, 210, 120, 0.75);
  border-radius: 3px;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.active-box-color {
  background-color: rgba(46, 204, 113, 0.25);
  border-color: var(--accent-green);
  box-shadow: 0 0 6px rgba(46, 204, 113, 0.5);
}

.selected-box-color {
  background-color: hsla(50, 100%, 60%, 0.50);
  border-color: hsl(50, 100%, 55%);
  box-shadow: 0 0 6px hsla(50, 100%, 60%, 0.4);
}

.normal-box-color {
  background-color: rgba(120, 160, 255, 0.30);
  border-color: rgba(120, 160, 255, 0.5);
}

/* Station badge — fire department style */
.station-pin-container {
  display: block;
  overflow: visible !important;
}

.station-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 3px 7px;
  background: linear-gradient(135deg, rgba(183, 28, 28, 0.72) 0%, rgba(127, 0, 0, 0.72) 100%);
  border: 1.5px solid rgba(255, 210, 120, 0.55);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 9.5px;
  font-weight: 900;
  color: #fff;
  letter-spacing: 0.4px;
  white-space: nowrap;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  box-shadow: 0 2px 6px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.15);
  transition: filter 0.15s;
  user-select: none;
}

.station-pin:hover {
  filter: brightness(1.2);
}

/* Light theme — keep red badge, slightly brighter */
[data-theme="light"] .station-pin {
  box-shadow: 0 2px 6px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.2);
}

.station-pin-label { display: none; }

/* Station cluster badge — slate-blue, clearly NOT a single station */
.station-cluster-container {
  display: block;
  overflow: visible !important;
}

.station-cluster {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 4px 9px;
  background: linear-gradient(135deg, rgba(30, 60, 120, 0.85) 0%, rgba(15, 35, 80, 0.85) 100%);
  border: 1.5px solid rgba(120, 180, 255, 0.65);
  border-radius: 12px;       /* rounder than the station badge */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 900;
  color: #fff;
  letter-spacing: 0.3px;
  white-space: nowrap;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  box-shadow: 0 2px 8px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.12);
  transition: filter 0.15s;
  user-select: none;
}

.station-cluster:hover {
  filter: brightness(1.2);
}

/* Suppress Leaflet's default cluster marker CSS */
.leaflet-marker-icon.station-cluster-container {
  background: none !important;
  border: none !important;
}

/* Subtle Locate Marker */
.subtle-locate-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.subtle-locate-ring {
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid var(--accent-cyan);
  border-radius: 50%;
  opacity: 0.8;
  box-shadow: 0 0 8px var(--accent-cyan);
  animation: beacon-pulse 2s infinite ease-out;
}

.subtle-locate-dot {
  width: 6px;
  height: 6px;
  background-color: var(--accent-cyan);
  border-radius: 50%;
  box-shadow: 0 0 4px var(--accent-cyan);
  z-index: 10;
}

/* Floating Settings Controls (Top Right of Screen) */
.map-settings-control {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.map-settings-trigger-btn {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-light);
  color: var(--txt-primary);
  font-size: 18px;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
  transition: var(--transition-smooth);
  outline: none;
}

.map-settings-trigger-btn:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--border-focus);
  transform: rotate(45deg);
}

.settings-menu {
  position: absolute;
  top: 48px;
  right: 0;
  width: 280px;
  z-index: 2000;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(12px);
  transition: var(--transition-smooth);
}

/* Caret/Arrow for Settings Menu Dropdown */
.settings-menu::before {
  content: '';
  position: absolute;
  top: -6px;
  right: 15px;
  width: 10px;
  height: 10px;
  background-color: var(--bg-secondary);
  border-left: 1px solid var(--border-light);
  border-top: 1px solid var(--border-light);
  transform: rotate(45deg);
  z-index: 2001;
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 8px;
  margin-bottom: 14px;
}

.settings-header h3 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--txt-primary);
}

.close-x-btn {
  background: none;
  border: none;
  color: var(--txt-muted);
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  transition: var(--transition-smooth);
}

.close-x-btn:hover {
  color: var(--accent-red);
}

/* Helper utilities */
.hidden {
  display: none !important;
}

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

/* Midnight Command Theme */
[data-theme="midnight-alert"] {
  --bg-primary: hsl(0, 12%, 4%);
  --bg-secondary: hsl(0, 12%, 8%);
  --bg-tertiary: hsl(0, 12%, 14%);
  
  --border-light: rgba(255, 51, 51, 0.15);
  --border-focus: hsl(0, 100%, 55%);
  
  --txt-primary: hsl(0, 20%, 98%);
  --txt-secondary: hsl(0, 20%, 80%);
  --txt-muted: hsl(0, 10%, 52%);
  
  --shadow-lg: 0 10px 30px -10px rgba(0, 0, 0, 0.9);
  --shadow-glow: 0 0 15px rgba(255, 51, 51, 0.08);

  --accent-red: hsl(0, 100%, 55%);
  --accent-cyan: hsl(0, 100%, 50%);
  --accent-yellow: hsl(15, 100%, 50%);
  --accent-green: hsl(0, 100%, 45%);
  --accent-orange: hsl(10, 100%, 50%);
  --accent-purple: hsl(340, 100%, 45%);

  --bg-gradient: linear-gradient(180deg, rgba(255, 51, 51, 0.08) 0%, rgba(0, 0, 0, 0) 100%);
  --bg-detail-panel: rgba(255, 51, 51, 0.02);
  --bg-footer: rgba(255, 51, 51, 0.04);
  --bg-overlay: rgba(10, 5, 5, 0.92);
  --county-line-color: rgba(255, 51, 51, 0.5);
}

[data-theme="midnight-alert"] #map {
  filter: grayscale(1) sepia(1) hue-rotate(315deg) saturate(3) brightness(0.65) contrast(1.25);
}

/* CAD Terminal Theme */
[data-theme="cad-terminal"] {
  --bg-primary: #020602;
  --bg-secondary: #050b05;
  --bg-tertiary: #0c180c;
  
  --border-light: rgba(51, 255, 51, 0.2);
  --border-focus: #33ff33;
  
  --txt-primary: #33ff33;
  --txt-secondary: #22dd22;
  --txt-muted: #118811;
  
  --shadow-lg: 0 10px 30px -10px rgba(0, 0, 0, 0.95);
  --shadow-glow: 0 0 12px rgba(51, 255, 51, 0.15);

  --accent-red: #33ff33;
  --accent-cyan: #33ff33;
  --accent-yellow: #33ff33;
  --accent-green: #33ff33;
  --accent-orange: #33ff33;
  --accent-purple: #33ff33;

  --font-sans: 'JetBrains Mono', SFMono-Regular, Consolas, monospace;
  
  --bg-gradient: linear-gradient(180deg, rgba(51, 255, 51, 0.05) 0%, rgba(0, 0, 0, 0) 100%);
  --bg-detail-panel: rgba(51, 255, 51, 0.01);
  --bg-footer: rgba(51, 255, 51, 0.03);
  --bg-overlay: rgba(2, 6, 2, 0.92);
  --county-line-color: rgba(51, 255, 51, 0.4);
}

[data-theme="cad-terminal"] #map {
  filter: grayscale(1) sepia(1) hue-rotate(75deg) saturate(3.5) brightness(0.65) contrast(1.25);
}

/* ==========================================================================
   COLLAPSIBLE SIDEBAR & CONSOLE SECTIONS
   ========================================================================== */

/* Collapsible Sidebar Console */
.sidebar-console {
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.3s, width 0.3s;
}

.sidebar-console.collapsed {
  margin-left: -440px;
  border-right: none;
}

/* Floating Sidebar Toggle Button */
.sidebar-toggle-btn {
  position: absolute;
  top: 84px; /* Placed cleanly below Leaflet zoom controls */
  left: 16px;
  z-index: 2000;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-light);
  color: var(--txt-primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
  transition: var(--transition-smooth);
  outline: none;
}

.sidebar-toggle-btn:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--border-focus);
  color: var(--border-focus);
}

/* Collapsible Console Sections (Query & Locator) */
.collapsible-section .toggle-title {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  transition: color 0.2s ease;
}

.collapsible-section .toggle-title:hover {
  color: var(--txt-primary);
}

.collapsible-section .chevron {
  font-size: 10px;
  display: inline-block;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--txt-muted);
}

.collapsible-section.collapsed .chevron {
  transform: rotate(-90deg);
}

.collapsible-section.collapsed .section-content {
  display: none !important;
}

/* Dynamic Map Glow/Pulse Animations for Active & Selected Areas */
@keyframes pulse-selected {
  0% {
    opacity: 0.50;
  }
  50% {
    opacity: 0.95;
  }
  100% {
    opacity: 0.50;
  }
}
.selected-box-active {
  animation: pulse-selected 2.5s infinite ease-in-out;
}

@keyframes pulse-due {
  0% {
    opacity: 0.25;
  }
  50% {
    opacity: 0.75;
  }
  100% {
    opacity: 0.25;
  }
}
.due-box-active {
  animation: pulse-due 5s infinite ease-in-out;
}

/* Auth Modal and Section Styling */
.auth-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.3s ease;
}

.auth-modal-overlay.hidden {
  display: none !important;
}

.auth-modal-content {
  background-color: var(--bg-panel);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
}

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

.auth-modal-header h3 {
  margin: 0;
  font-family: var(--font-outfit);
  font-size: 18px;
  font-weight: 700;
  color: var(--txt-primary);
}

.auth-modal-body {
  padding: 20px;
}

.auth-modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-light);
  font-size: 12px;
  text-align: center;
}

.auth-modal-footer p {
  margin: 0;
}

.auth-modal-footer a {
  color: var(--border-focus);
  text-decoration: none;
  font-weight: 600;
}

.auth-modal-footer a:hover {
  text-decoration: underline;
}

.auth-error-msg {
  background-color: rgba(235, 64, 52, 0.1);
  border: 1px solid var(--accent-red);
  color: var(--accent-red);
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 12px;
  margin-bottom: 12px;
}

.user-auth-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 4px 8px;
}

#user-auth-status {
  font-size: 11px;
  color: var(--txt-muted);
  margin: 0;
}

/* User Profile Header Widget Styling */
.user-profile-widget, .user-profile-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 8px 12px;
  margin: 10px 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: var(--transition-smooth);
}

.user-profile-widget:hover, .user-profile-bar:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background-color: var(--bg-tertiary);
}

.user-profile-widget .user-avatar, .user-profile-bar .user-avatar {
  font-size: 15px;
  background: var(--bg-primary);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-light);
  flex-shrink: 0;
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
}

.user-profile-widget .user-info, .user-profile-bar .user-info {
  flex-grow: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.user-profile-widget .user-name, .user-profile-bar .user-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--txt-primary);
  font-family: var(--font-outfit);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.3px;
}

.user-profile-widget .user-role, .user-profile-bar .user-role {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

#btn-profile-auth {
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  border-radius: 4px;
}

/* Forest Recon Theme */
[data-theme="forest-recon"] {
  --bg-primary: hsl(120, 15%, 5%);
  --bg-secondary: hsl(120, 15%, 8%);
  --bg-tertiary: hsl(120, 15%, 13%);
  
  --border-light: rgba(180, 140, 60, 0.15);
  --border-focus: hsl(38, 70%, 55%);
  
  --txt-primary: hsl(120, 20%, 95%);
  --txt-secondary: hsl(120, 15%, 75%);
  --txt-muted: hsl(120, 10%, 48%);
  
  --shadow-lg: 0 10px 30px -10px rgba(0, 0, 0, 0.95);
  --shadow-glow: 0 0 15px rgba(180, 140, 60, 0.08);

  --accent-red: hsl(0, 80%, 50%);
  --accent-cyan: hsl(180, 70%, 45%);
  --accent-yellow: hsl(38, 70%, 55%);
  --accent-green: hsl(120, 60%, 45%);
  --accent-orange: hsl(25, 80%, 50%);
  --accent-purple: hsl(290, 60%, 50%);

  --bg-gradient: linear-gradient(180deg, rgba(180, 140, 60, 0.05) 0%, rgba(0, 0, 0, 0) 100%);
  --bg-detail-panel: rgba(180, 140, 60, 0.01);
  --bg-footer: rgba(180, 140, 60, 0.03);
  --bg-overlay: rgba(5, 8, 5, 0.92);
  --county-line-color: rgba(180, 140, 60, 0.4);
}

[data-theme="forest-recon"] #map {
  filter: grayscale(1) sepia(1) hue-rotate(50deg) saturate(2) brightness(0.65) contrast(1.15);
}

/* Cyberpunk Neon Theme */
[data-theme="cyberpunk-neon"] {
  --bg-primary: hsl(280, 30%, 4%);
  --bg-secondary: hsl(280, 30%, 7%);
  --bg-tertiary: hsl(280, 30%, 12%);
  
  --border-light: rgba(255, 0, 128, 0.2);
  --border-focus: hsl(320, 100%, 50%);
  
  --txt-primary: hsl(180, 100%, 50%);
  --txt-secondary: hsl(320, 100%, 65%);
  --txt-muted: hsl(280, 20%, 55%);
  
  --shadow-lg: 0 10px 30px -10px rgba(0, 0, 0, 0.95);
  --shadow-glow: 0 0 15px rgba(255, 0, 128, 0.15);

  --accent-red: hsl(0, 100%, 60%);
  --accent-cyan: hsl(180, 100%, 50%);
  --accent-yellow: hsl(50, 100%, 50%);
  --accent-green: hsl(120, 100%, 50%);
  --accent-orange: hsl(30, 100%, 50%);
  --accent-purple: hsl(320, 100%, 50%);

  --bg-gradient: linear-gradient(180deg, rgba(255, 0, 128, 0.08) 0%, rgba(0, 0, 0, 0) 100%);
  --bg-detail-panel: rgba(255, 0, 128, 0.02);
  --bg-footer: rgba(255, 0, 128, 0.04);
  --bg-overlay: rgba(12, 4, 16, 0.94);
  --county-line-color: rgba(255, 0, 128, 0.5);
}

[data-theme="cyberpunk-neon"] #map {
  filter: grayscale(1) sepia(1) hue-rotate(240deg) saturate(2.5) brightness(0.6) contrast(1.3);
}

/* Ocean Patrol Theme */
[data-theme="ocean-patrol"] {
  --bg-primary: hsl(210, 24%, 4%);
  --bg-secondary: hsl(210, 24%, 8%);
  --bg-tertiary: hsl(210, 24%, 13%);
  
  --border-light: rgba(0, 210, 255, 0.15);
  --border-focus: hsl(190, 100%, 50%);
  
  --txt-primary: hsl(210, 30%, 96%);
  --txt-secondary: hsl(190, 100%, 75%);
  --txt-muted: hsl(210, 15%, 52%);
  
  --shadow-lg: 0 10px 30px -10px rgba(0, 0, 0, 0.95);
  --shadow-glow: 0 0 15px rgba(0, 210, 255, 0.08);

  --accent-red: hsl(0, 85%, 55%);
  --accent-cyan: hsl(190, 100%, 50%);
  --accent-yellow: hsl(45, 100%, 50%);
  --accent-green: hsl(140, 75%, 45%);
  --accent-orange: hsl(20, 90%, 55%);
  --accent-purple: hsl(270, 75%, 55%);

  --bg-gradient: linear-gradient(180deg, rgba(0, 210, 255, 0.06) 0%, rgba(0, 0, 0, 0) 100%);
  --bg-detail-panel: rgba(0, 210, 255, 0.01);
  --bg-footer: rgba(0, 210, 255, 0.03);
  --bg-overlay: rgba(5, 7, 10, 0.92);
  --county-line-color: rgba(0, 210, 255, 0.45);
}

[data-theme="ocean-patrol"] #map {
  filter: grayscale(1) sepia(1) hue-rotate(180deg) saturate(2.5) brightness(0.6) contrast(1.2);
}
