/* Leaflet overrides */
#map { width: 100%; height: 100%; background: var(--bg-primary); }
.leaflet-container { background: var(--bg-primary); font-family: "IBM Plex Mono", monospace; outline: none; }
.leaflet-container a { color: var(--accent-primary); }

/* Tile crispness on dark theme */
.leaflet-tile-pane { filter: saturate(0.85); }
:root[data-theme="light"] .leaflet-tile-pane { filter: none; }

/* Strip Leaflet's default white box around divIcons */
.leaflet-div-icon,
.vessel-icon-wrap,
.infra-icon-wrap,
.event-icon-wrap,
.chokepoint-badge-wrap {
  background: transparent !important;
  border: none !important;
}

/* Zoom + scale controls */
.leaflet-bar {
  background: var(--bg-card) !important;
  border: 1px solid var(--border) !important;
  box-shadow: none !important;
  border-radius: 2px !important;
}
.leaflet-bar a {
  background: transparent !important;
  color: var(--text-primary) !important;
  border-bottom: 1px solid var(--border) !important;
  width: 32px !important; height: 32px !important;
  line-height: 32px !important;
}
.leaflet-bar a:last-child { border-bottom: none !important; }
.leaflet-bar a:hover { background: var(--bg-secondary) !important; color: var(--accent-primary) !important; }

.leaflet-control-scale-line {
  background: var(--map-overlay) !important;
  color: var(--text-secondary) !important;
  border: 1px solid var(--border) !important;
  border-top: none !important;
  font-family: "IBM Plex Mono"; font-size: 10px;
  text-shadow: none !important;
}
.leaflet-control-attribution {
  background: var(--map-overlay) !important;
  color: var(--text-muted) !important;
  font-family: "IBM Plex Mono"; font-size: 9px !important;
  padding: 2px 6px !important;
}
.leaflet-control-attribution a { color: var(--text-secondary) !important; }

/* Popup styling (used by Leaflet.draw tooltips) */
.leaflet-popup-content-wrapper {
  background: var(--map-overlay) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border);
  border-radius: 2px;
  backdrop-filter: blur(10px);
}
.leaflet-popup-tip { background: var(--border) !important; }

/* Draw plugin tooltip */
.leaflet-draw-tooltip {
  background: var(--map-overlay) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border) !important;
  font-family: "IBM Plex Mono"; font-size: 10px;
  letter-spacing: 0.06em;
}
.leaflet-draw-tooltip:before { border-right-color: var(--border) !important; }

/* ─────────────────────────────────────────── VESSEL MARKERS */
.vessel-marker {
  width: 0; height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 14px solid var(--accent-primary);
  filter: drop-shadow(0 0 4px rgba(0, 212, 255, 0.6));
  cursor: pointer;
  transition: transform 200ms ease-out;
  transform-origin: center 60%;
}
.vessel-marker:hover { filter: drop-shadow(0 0 8px currentColor) brightness(1.3); }
.vessel-marker.anchored { opacity: 0.55; }
.vessel-marker.large    { border-left-width: 7px; border-right-width: 7px; border-bottom-width: 16px; }
.vessel-marker.xlarge   { border-left-width: 8px; border-right-width: 8px; border-bottom-width: 19px; }
.vessel-marker.xxlarge  { border-left-width: 9px; border-right-width: 9px; border-bottom-width: 22px; }

.vessel-marker.t-crude { border-bottom-color: #FF6B35; }
.vessel-marker.t-lng   { border-bottom-color: #00D4FF; }
.vessel-marker.t-lpg   { border-bottom-color: #B44FFF; }
.vessel-marker.t-chem  { border-bottom-color: #FFD700; }
.vessel-marker.t-bulk  { border-bottom-color: #7AC4A0; }
.vessel-marker.t-ctr   { border-bottom-color: #E8F0F7; }

/* ─────────────────────────────────────────── INFRA MARKERS */
.infra-marker {
  width: 14px; height: 14px;
  border-radius: 2px;
  background: var(--bg-card);
  border: 1.5px solid var(--accent-energy);
  box-shadow: 0 0 6px rgba(255, 107, 53, 0.5);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px;
  color: var(--accent-energy);
  font-weight: 700;
  line-height: 1;
  transition: transform 150ms;
}
.infra-marker:hover { transform: scale(1.4); }
.infra-marker.lng_terminal { border-color: #00D4FF; color: #00D4FF; box-shadow: 0 0 6px rgba(0,212,255,0.5); }
.infra-marker.oil_refinery { border-color: #FF6B35; color: #FF6B35; }
.infra-marker.port         { border-color: #00FF8C; color: #00FF8C; box-shadow: 0 0 6px rgba(0,255,140,0.4); border-radius: 50%; }
.infra-marker.coal_mine    { border-color: #888;    color: #888; }
.infra-marker.spr          { border-color: #FFD700; color: #FFD700; box-shadow: 0 0 6px rgba(255,215,0,0.4); }
.infra-marker.oil_field    { border-color: #B44FFF; color: #B44FFF; }
.infra-marker.oil_pipeline { border-color: #FF6B35; color: #FF6B35; }
.infra-marker.gas_pipeline { border-color: #00D4FF; color: #00D4FF; }

/* ─────────────────────────────────────────── EVENT MARKERS */
.event-marker {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent-danger);
  position: relative;
  cursor: pointer;
  box-shadow: 0 0 0 2px rgba(255, 59, 92, 0.4);
}
.event-marker::after {
  content: "";
  position: absolute; inset: -4px;
  border: 2px solid var(--accent-danger);
  border-radius: 50%;
  animation: eventPulse 1.8s infinite ease-out;
}
.event-marker.hurricane  { background: #00D4FF; box-shadow: 0 0 0 2px rgba(0,212,255,0.4); }
.event-marker.hurricane::after  { border-color: #00D4FF; }
.event-marker.earthquake { background: var(--accent-energy); box-shadow: 0 0 0 2px rgba(255,107,53,0.4); }
.event-marker.earthquake::after { border-color: var(--accent-energy); }
.event-marker.wildfire   { background: #FFD700; box-shadow: 0 0 0 2px rgba(255,215,0,0.4); }
.event-marker.wildfire::after   { border-color: #FFD700; }

/* ─────────────────────────────────────────── CHOKEPOINT BADGE */
.chokepoint-badge {
  background: var(--map-overlay);
  border: 1px solid var(--accent-primary);
  padding: 4px 10px;
  font-family: "Inter"; font-size: 10px;
  font-weight: 700; letter-spacing: 0.08em;
  color: var(--accent-primary);
  border-radius: 2px;
  pointer-events: none;
  white-space: nowrap;
  text-align: center;
  display: inline-block;
}
.chokepoint-badge .name {
  display: block;
  font-size: 9px;
  color: var(--text-secondary);
  margin-bottom: 2px;
}
.chokepoint-badge.alert     { border-color: var(--accent-danger); color: var(--accent-danger); }
.chokepoint-badge.congested { border-color: var(--accent-gold);   color: var(--accent-gold); }
