/* RLM map page — night-dispatch chrome; keep Leaflet/popup behavior */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.map-section {
  padding: calc(var(--nav-h, 4.25rem) + 1.5rem) 0 2rem;
  min-height: 100vh;
  background: transparent;
}

.map-container {
  width: 100%;
  max-width: none;
  margin-inline: 0;
  padding-inline: var(--page-pad, clamp(1rem, 3.5vw, 2.5rem));
  box-sizing: border-box;
}

.map-header {
  text-align: left;
  margin-bottom: 1.5rem;
  max-width: 40rem;
}

.map-header h1 {
  font-family: var(--font-display, "Barlow Condensed", sans-serif);
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 0.95;
  color: var(--text, #f4efe6);
  margin: 0.35rem 0 0.65rem;
}

.map-header p {
  color: var(--text-muted, #a39a8c);
  font-size: 1.02rem;
}

.map-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line, rgba(255, 214, 160, 0.12));
  border-radius: 0.55rem;
  background: rgba(20, 26, 36, 0.85);
  backdrop-filter: blur(10px);
}

.control-group select {
  min-width: 14rem;
  padding: 0.7rem 0.9rem;
  border-radius: 0.4rem;
  border: 1px solid var(--line-strong, rgba(255, 214, 160, 0.22));
  background: #0c1017;
  color: var(--text, #f4efe6);
  font: inherit;
}

.control-group select:focus {
  outline: 2px solid rgba(255, 106, 43, 0.45);
  outline-offset: 1px;
}

.map-wrapper {
  position: relative;
  height: min(70vh, 640px);
  min-height: 420px;
  margin-bottom: 1rem;
  border-radius: 0.65rem;
  overflow: hidden;
  border: 1px solid var(--line, rgba(255, 214, 160, 0.12));
  background: #0a0e14;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

#map-container {
  width: 100%;
  height: 100%;
  min-height: 420px;
}

.leaflet-container {
  width: 100% !important;
  height: 100% !important;
  min-height: 420px;
  font-family: var(--font-body, "IBM Plex Sans", sans-serif);
  background: #0a0e14;
}

.map-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  min-width: 16rem;
  text-align: center;
  padding: 1.35rem 1.5rem;
  border-radius: 0.65rem;
  border: 1px solid var(--line, rgba(255, 214, 160, 0.12));
  background: rgba(12, 16, 23, 0.94);
  color: var(--text-muted, #a39a8c);
  backdrop-filter: blur(12px);
}

.loading-spinner {
  width: 2.25rem;
  height: 2.25rem;
  margin: 0 auto 0.85rem;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent, #ff6a2b);
  animation: mapSpin 0.9s linear infinite;
}

@keyframes mapSpin {
  to {
    transform: rotate(360deg);
  }
}

.progress-bar-container {
  width: 100%;
  height: 0.4rem;
  margin: 0.75rem 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-amber, #f0a202), var(--accent, #ff6a2b));
  transition: width 0.3s ease;
}

.loading-title {
  color: var(--text, #f4efe6);
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.loading-progress {
  font-size: 0.88rem;
  color: var(--text-muted, #a39a8c);
}

/* Popups */
.leaflet-popup-content-wrapper {
  background: #1a2230 !important;
  color: #f4efe6 !important;
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  max-width: 500px !important;
  min-width: min(400px, 90vw) !important;
  border: 1px solid rgba(255, 214, 160, 0.14);
}

.leaflet-popup-content {
  background: #1a2230 !important;
  color: #f4efe6 !important;
  margin: 0 !important;
  padding: 1.25rem !important;
  font-size: 13px !important;
  line-height: 1.45 !important;
  max-width: 500px !important;
  max-height: 500px !important;
  min-height: 200px !important;
  overflow-y: auto !important;
}

.leaflet-popup-tip {
  background: #1a2230 !important;
}

.poi-popup h4,
.poi-popup p:first-child,
.poi-popup strong,
.poi-popup .warning .label {
  color: #ff8a4c !important;
}

.poi-popup p {
  margin: 0.35rem 0 !important;
  color: #f4efe6 !important;
}

.poi-popup .warning .reason {
  color: #ffd166;
}

.poi-popup .note {
  color: #f0a202;
  font-style: italic;
  font-size: 12px;
}

.copy-coordinates {
  width: 100%;
  padding: 0.55rem;
  margin-top: 0.65rem;
  border: none;
  border-radius: 0.35rem;
  background: linear-gradient(135deg, #f0a202, #ff6a2b);
  color: #140b06;
  font-weight: 600;
  cursor: pointer;
}

.copy-coordinates:hover {
  filter: brightness(1.05);
}

.map-legend {
  padding: 0.9rem 1rem;
  border-radius: 0.55rem;
  border: 1px solid var(--line, rgba(255, 214, 160, 0.12));
  background: rgba(20, 26, 36, 0.85);
  margin-bottom: 1.5rem;
}

.legend-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.35rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted, #a39a8c);
  font-size: 0.92rem;
}

.legend-color {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.legend-color.fire {
  background: #ef4444;
}
.legend-color.police {
  background: #3b82f6;
}
.legend-color.ambulance {
  background: #10b981;
}
.legend-color.hospital {
  background: #a78bfa;
}
.legend-color.dispatch {
  background: #f59e0b;
}

.custom-marker {
  border: 3px solid #fff;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}
.custom-marker.fire {
  background: #ef4444;
}
.custom-marker.police {
  background: #3b82f6;
}
.custom-marker.ambulance {
  background: #10b981;
}
.custom-marker.hospital {
  background: #a78bfa;
}
.custom-marker.dispatch {
  background: #f59e0b;
}

.leaflet-control-zoom a {
  background: #141a24 !important;
  color: #f4efe6 !important;
  border-color: rgba(255, 214, 160, 0.18) !important;
}

.leaflet-control-zoom a:hover {
  background: #1a2230 !important;
  color: #ff6a2b !important;
}

@media (max-width: 768px) {
  .map-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .control-group select {
    width: 100%;
    min-width: 0;
  }

  .map-wrapper {
    height: 55vh;
    min-height: 320px;
  }
}

@media (max-width: 480px) {
  .map-wrapper {
    min-height: 280px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading-spinner {
    animation: none;
  }
}

@media print {
  .map-controls,
  .map-legend,
  .site-nav,
  .site-footer {
    display: none !important;
  }
}
