/* ================================================================
   JARVIS UI — MAPS CSS
   Leaflet overrides + HUD map controls + marker animations
================================================================ */

/* ── Leaflet popup override ──────────────────────────────────── */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip-container,
.leaflet-popup-tip {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}
.leaflet-popup-content {
  margin: 0 !important;
  width: auto !important;
}
.j-leaflet-popup .leaflet-popup-content-wrapper {
  background: transparent !important;
}

/* ── Leaflet tooltip ─────────────────────────────────────────── */
.j-leaflet-tooltip.leaflet-tooltip {
  background: var(--j-bg-card);
  border: 1px solid var(--j-accent-35);
  border-radius: 0;
  color: var(--j-accent);
  font-family: 'Courier New', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 8px;
  white-space: nowrap;
  box-shadow: 0 0 8px var(--j-accent-18);
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
}
.j-leaflet-tooltip.leaflet-tooltip::before {
  border-top-color: var(--j-accent-35) !important;
}
.j-map-tooltip {
  font-family: 'Courier New', monospace;
  font-size: 10px;
  color: var(--j-accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ── Marker animations ───────────────────────────────────────── */
@keyframes j-marker-drop {
  0%   { transform: translateY(-30px); opacity: 0; }
  60%  { transform: translateY(4px);   opacity: 1; }
  80%  { transform: translateY(-2px); }
  100% { transform: translateY(0);     opacity: 1; }
}
@keyframes j-marker-pulse-ring {
  0%   { transform: scale(0.5); opacity: 0.9; }
  100% { transform: scale(2.5); opacity: 0; }
}
@keyframes j-marker-bounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

.j-leaflet-marker {
  background: transparent !important;
  border: none !important;
}
.j-marker-drop {
  animation: j-marker-drop 0.5s ease-out;
}
.j-pulse-ring {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid var(--j-accent);
  animation: j-marker-pulse-ring 1.6s ease-out infinite;
  pointer-events: none;
}

/* ── HUD map container ───────────────────────────────────────── */
.j-map-container {
  position: relative;
  background: var(--j-bg);
  overflow: hidden;
  font-family: 'Courier New', monospace;
}

/* Corner brackets on map container */
.j-map-container::before {
  content: '';
  position: absolute; top: 0; left: 0;
  width: 16px; height: 16px;
  border-top: 1px solid var(--j-accent);
  border-left: 1px solid var(--j-accent);
  z-index: 1000;
  pointer-events: none;
  animation: j-corner-blink 3s ease-in-out infinite;
}
.j-map-container::after {
  content: '';
  position: absolute; bottom: 0; right: 0;
  width: 16px; height: 16px;
  border-bottom: 1px solid var(--j-accent);
  border-right: 1px solid var(--j-accent);
  z-index: 1000;
  pointer-events: none;
  animation: j-corner-blink 3s ease-in-out infinite 0.6s;
}

/* ── HUD map controls ────────────────────────────────────────── */
.j-map-controls {
  position: absolute;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: all;
}
.j-map-controls.top-right    { top: 10px; right: 10px; }
.j-map-controls.top-left     { top: 10px; left: 10px; }
.j-map-controls.bottom-right { bottom: 10px; right: 10px; }
.j-map-controls.bottom-left  { bottom: 10px; left: 10px; }

.j-map-btn {
  width: 32px; height: 32px;
  background: var(--j-bg-card);
  border: 1px solid var(--j-accent-35);
  color: var(--j-accent);
  font-size: 14px;
  font-family: 'Courier New', monospace;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  clip-path: polygon(5px 0, 100% 0, calc(100% - 5px) 100%, 0 100%);
  box-shadow: 0 0 6px var(--j-accent-12);
}
.j-map-btn:hover {
  background: var(--j-accent-18);
  border-color: var(--j-accent);
  box-shadow: 0 0 12px var(--j-accent-25);
}
.j-map-btn.active {
  background: var(--j-accent-25);
  border-color: var(--j-accent);
}
.j-map-btn-wide {
  width: auto;
  padding: 0 10px;
  font-size: 9px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  height: 28px;
}

/* ── Map legend ──────────────────────────────────────────────── */
.j-map-legend {
  position: absolute;
  z-index: 1000;
  background: var(--j-bg-card);
  border: 1px solid var(--j-border);
  padding: 10px 12px;
  font-family: 'Courier New', monospace;
  font-size: 9px;
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
  max-width: 180px;
  pointer-events: all;
}
.j-map-legend.bottom-left  { bottom: 10px; left: 10px; }
.j-map-legend.bottom-right { bottom: 10px; right: 10px; }
.j-map-legend.top-left     { top: 10px; left: 10px; }
.j-map-legend-title {
  font-size: 8px;
  color: var(--j-accent);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--j-border-dim);
}
.j-map-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  color: var(--j-text-secondary);
}
.j-map-legend-swatch {
  width: 10px; height: 10px;
  flex-shrink: 0;
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

/* ── HUD status bar (inside map) ─────────────────────────────── */
.j-map-status-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 1000;
  background: linear-gradient(0deg, var(--j-bg) 0%, transparent 100%);
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: 'Courier New', monospace;
  font-size: 9px;
  color: var(--j-accent-50);
  letter-spacing: 0.08em;
  pointer-events: none;
}

/* ── Choropleth color classes ────────────────────────────────── */
.j-choropleth-0 { fill: var(--j-accent-05); }
.j-choropleth-1 { fill: var(--j-accent-12); }
.j-choropleth-2 { fill: var(--j-accent-18); }
.j-choropleth-3 { fill: var(--j-accent-25); }
.j-choropleth-4 { fill: var(--j-accent-35); }
.j-choropleth-5 { fill: var(--j-accent-50); }

/* ── Leaflet tile layer z-index fix ──────────────────────────── */
.leaflet-tile-pane { z-index: 200 !important; }
.leaflet-overlay-pane { z-index: 400 !important; }
.leaflet-marker-pane  { z-index: 600 !important; }
.leaflet-popup-pane   { z-index: 800 !important; }
