/* web-v2/css/components/map.css */

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

.map-container {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Layer toggle buttons */
.map-layer-controls {
  position: absolute;
  top: .5rem;
  left: .5rem;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
.map-layer-btn {
  font-family: var(--font-mono);
  font-size: .55rem;
  letter-spacing: .08em;
  padding: .2rem .35rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-muted);
  cursor: pointer;
  opacity: .8;
  transition: color .15s, border-color .15s, opacity .15s;
}
.map-layer-btn:hover, .map-layer-btn.on {
  color: var(--accent);
  border-color: var(--accent-dim);
  opacity: 1;
}

/* Active alert floating chip (mobile / fullscreen) */
.map-alert-chip {
  position: absolute;
  bottom: .5rem;
  left: .5rem;
  z-index: 500;
  font-family: var(--font-mono);
  font-size: .5rem;
  padding: .2rem .4rem;
  background: var(--bg-surface);
  border: 1px solid var(--threat-rockets);
  border-radius: 3px;
  color: var(--threat-rockets);
  box-shadow: var(--threat-rockets-glow);
}

/* Leaflet popup overrides */
.leaflet-popup-content-wrapper {
  background: var(--bg-surface) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border) !important;
  border-radius: 4px !important;
  font-family: var(--font-mono) !important;
  font-size: .7rem !important;
  box-shadow: none !important;
}
.leaflet-popup-tip { background: var(--bg-surface) !important; }
.leaflet-popup-close-button { color: var(--text-muted) !important; }

/* City name tooltip — all !important to override Leaflet defaults */
.city-tip {
  background:    rgba(10, 22, 40, .9)          !important;
  border:        1px solid rgba(255,255,255,.15) !important;
  color:         #c8d8f0                         !important;
  font-size:     11px                            !important;
  font-weight:   600                             !important;
  padding:       3px 8px                         !important;
  border-radius: 4px                             !important;
  box-shadow:    0 2px 8px rgba(0,0,0,.4)        !important;
}
.city-tip::before { border-top-color: rgba(10,22,40,.9) !important; }

/* Remove Leaflet focus outline on polygon click */
.leaflet-interactive:focus { outline: none; }

/* ── City history panel ── */
#cityPanel {
  position:      absolute;
  z-index:       1200;
  display:       none;
  background:    rgba(8, 18, 36, .97);
  border:        1px solid rgba(100, 160, 220, .28);
  border-radius: 8px;
  box-shadow:    0 8px 32px rgba(0,0,0,.8);
  color:         #c8d8f0;
  padding:       10px 14px;
  min-width:     190px;
  max-width:     270px;
  max-height:    240px;
  overflow-y:    auto;
  font-family:   -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size:     12px;
  line-height:   1.55;
  pointer-events: all;
}
#cityPanel::-webkit-scrollbar { width: 3px; }
#cityPanel::-webkit-scrollbar-thumb { background: #1a2d4d; border-radius: 3px; }
.cp-close {
  position:   absolute;
  top:        6px;
  right:      10px;
  cursor:     pointer;
  font-size:  16px;
  color:      #5a7a9e;
  line-height: 1;
  background: none;
  border:     none;
  padding:    0;
}
.cp-close:hover { color: #c8d8f0; }
@media (max-width: 360px) {
  #cityPanel { min-width: 160px; max-width: calc(100vw - 24px); font-size: 11px; }
}

/* ── Alert polygon animations (ported from web/index.html) ── */

/* Animations disabled — causes FPS drops with many active polygons */
.anim-rocket, .anim-drone, .anim-pre { animation: none; }

/* Glow disabled — causes FPS issues when many polygons are visible */
/* Classes kept for backwards compat but no filter applied */
.alert-glow-red, .alert-glow-purple, .alert-glow-orange, .alert-glow-blue { filter: none; }

/* All-clear: slow fade to nothing */
@keyframes _anim-clear-fade { 0% { opacity: 1; } 100% { opacity: 0; } }
.alert-polygon--clearing { animation: _anim-clear-fade 5s ease-out forwards; }

/* ── Alert polygon hover popup ── */
.zone-hover-popup .leaflet-popup-content-wrapper {
  background:     rgba(10, 22, 40, 0.96) !important;
  border:         1px solid #1e3554 !important;
  border-radius:  5px !important;
  padding:        0 !important;
  box-shadow:     0 4px 20px rgba(0,0,0,.7) !important;
  pointer-events: none; /* prevent cursor-into-popup from firing mouseout on the polygon */
}
.zone-hover-popup .leaflet-popup-tip-container { display: none; }
.zone-hover-popup .leaflet-popup-content { margin: 0; padding: 8px 10px; min-width: 120px; }
.zhp-header  { margin-bottom: 3px; }
.zhp-name    { color: #e8f0fe; font-weight: 700; font-size: 12px; }
.zhp-cat     { font-size: 11px; margin-bottom: 5px; }
.zhp-cities  { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 5px; }
.zhp-tag     { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15); border-radius: 3px; padding: 1px 5px; font-size: 10px; color: #a8b8cc; }
.zhp-time    { font-size: 10px; color: #4a6a8e; }

/* ── Trajectory layers ── */
.leaflet-trajectoryPane-pane,
.leaflet-trajectoryPane-pane svg,
.leaflet-trajectoryPane-pane canvas,
.leaflet-trajectoryPane-pane path { pointer-events: none !important; }
.leaflet-trajectoryPane-pane .leaflet-interactive { pointer-events: auto !important; }

.missile-head-pulse {
  animation: missile-pulse 1.5s ease-in-out infinite;
  filter: drop-shadow(0 0 4px rgba(255, 60, 60, 0.7));
}
@keyframes missile-pulse {
  0%, 100% { transform: scale(1);   filter: drop-shadow(0 0 4px rgba(255, 60, 60, 0.7)); }
  50%      { transform: scale(1.4); filter: drop-shadow(0 0 10px rgba(255, 60, 60, 0.4)); }
}

.trajectory-fade {
  transition: opacity 8s ease-out !important;
  opacity: 0 !important;
}

