/* =========================================================================
   Map page (#map fills viewport below header)
   ========================================================================= */

#map {
  flex: 1;
  width: 100%;
  background: var(--bg-dark);
}

/* =========================================================================
   Custom pin markers (ported from map-old)
   ========================================================================= */

.custom-marker {
  display: flex;
  align-items: center;
  justify-content: center;
}

.custom-marker-wrapper {
  position: relative;
  display: inline-block;
}

.marker-pin {
  width: 24px;
  height: 24px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px var(--shadow-lg);
  border: 2px solid rgba(255, 255, 255, 0.5);
}

.marker-pin.station {
  background: var(--type-station);
}

.marker-pin.ccp {
  background: var(--tag-ccp-text);
}
.marker-pin.als {
  background: var(--tag-als-text);
}
.marker-pin.bls {
  background: var(--tag-bls-text);
}
.marker-pin.mixed {
  background: var(--tag-mixed-text);
}
.marker-pin.soc {
  background: var(--tag-soc-text);
}

.marker-pin.muted {
  background: var(--muted-marker) !important;
  opacity: 0.4 !important;
}

.marker-inner {
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
  transform: rotate(45deg);
}

/* =========================================================================
   Leaflet control overrides (ported from map-old)
   ========================================================================= */

.leaflet-control-zoom {
  border: none !important;
  box-shadow: 0 4px 15px var(--shadow-md) !important;
}

.leaflet-control-zoom a {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
}

.leaflet-control-zoom a:hover {
  background: var(--bg-hover) !important;
}

.leaflet-control-zoom-in {
  border-radius: 8px 8px 0 0 !important;
}

.leaflet-control-zoom-out {
  border-radius: 0 0 8px 8px !important;
}

.leaflet-control-attribution {
  background: var(--bg-card) !important;
  color: var(--text-secondary) !important;
  font-size: 0.7rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px 0 0 0;
}

.leaflet-control-attribution a {
  color: var(--accent-blue) !important;
}

/* =========================================================================
   Legend (ported from map-old; hidden until JS relocates it into Leaflet's
   bottom-left control container)
   ========================================================================= */

.legend {
  visibility: hidden;
  width: fit-content;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 4px 20px var(--shadow-md);
}

.leaflet-bottom .legend {
  visibility: visible;
}

.legend h3 {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.legend-item:last-child {
  margin-bottom: 0;
}

.legend-marker {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .legend {
    padding: 0.6rem;
  }
  .legend h3 {
    margin-bottom: 0.4rem;
    font-size: 0.75rem;
  }
  .legend-item {
    margin-bottom: 0.15rem;
    font-size: 0.7rem;
  }
}
