/* ── Leaflet tooltip overrides ── */
.ring-label {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: rgba(255,255,255,0.35);
  font-size: 11px;
  font-family: system-ui, sans-serif;
  white-space: nowrap;
}
.ring-label::before { display: none; }
.poi-label {
  background: rgba(15,17,23,0.75) !important;
  border: 1px solid rgba(255,255,255,0.1) !important;
  box-shadow: none !important;
  color: rgba(255,255,255,0.55);
  font-size: 11px;
  font-family: system-ui, sans-serif;
  padding: 2px 6px !important;
  border-radius: 4px;
  white-space: nowrap;
}
.poi-label::before { display: none; }
.ac-label {
  background: rgba(15,17,23,0.7) !important;
  border: none !important;
  box-shadow: none !important;
  padding: 2px 6px !important;
  border-radius: 3px;
  white-space: nowrap;
  pointer-events: none;
  font-family: system-ui, sans-serif;
  line-height: 1.4;
}
.ac-label::before { display: none; }
.ac-label-cs {
  font-size: 11px;
  font-weight: 500;
  color: rgba(255,255,255,0.75);
  letter-spacing: 0.03em;
}
.ac-label-meta {
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.02em;
}

/* ── Aircraft marker ── */
/* .ac-icon is a 44×44 hit area (comfortable touch target) that centres the
   visible 28×28 SVG. Rotation (set inline by _applyRotation) writes `transform`
   on .ac-icon; flex centring of the SVG doesn't depend on transform, so the
   two do not conflict. */
.ac-marker { overflow: visible !important; }
.ac-icon {
  width: 44px; height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ac-pulse-ring {
  position: absolute;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 2px solid rgba(239,68,68,0.75);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation: ac-pulse 1.5s ease-out infinite;
  pointer-events: none;
}
@keyframes ac-pulse {
  0%   { transform: translate(-50%, -50%) scale(0.7); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(2);   opacity: 0; }
}
/* Emergency squawk ring (7700/7600/7500). Must visually outscream the
   low-level ring (which is also red): thicker border, wider + faster pulse,
   a trailing second ring via ::before, and a glow. Mutually exclusive with
   .ac-pulse-ring — map.js never renders both at the same time. */
.ac-emergency-ring {
  position: absolute;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 3px solid #ef4444;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation: ac-emergency-pulse 1s ease-out infinite;
  pointer-events: none;
  box-shadow: 0 0 12px rgba(239,68,68,0.7);
}
.ac-emergency-ring::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(239,68,68,0.5);
  animation: ac-emergency-pulse 1s ease-out infinite 0.5s;
}
@keyframes ac-emergency-pulse {
  0%   { transform: translate(-50%, -50%) scale(0.6); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(2.5); opacity: 0; }
}
.ac-label-emergency {
  color: #ef4444;
  font-weight: 600;
}
/* Military overlay — upright badge, does not rotate with aircraft heading.
   Positioned at the visible SVG's top-right corner (SVG is centred in the
   44×44 .ac-icon → visible corner is inset 8px from the wrapper edge). */
.ac-mil-badge {
  position: absolute;
  top: 4px; right: 4px;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 13px;
  text-align: center;
  font-family: system-ui, sans-serif;
  border: 1px solid rgba(0,0,0,0.35);
  box-shadow: 0 0 3px rgba(0,0,0,0.5);
  pointer-events: none;
}
/* Military-block squawk overlay — amber to visually separate from the red
   'M' military badge (ICAO hex range) and the red emergency ring. Placed
   on the opposite corner (top-left) so it never stacks on top of .ac-mil-badge,
   though in practice only one of the two renders at a time. */
.ac-milsquawk-badge {
  position: absolute;
  top: 4px; left: 4px;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: #f59e0b;
  color: #1a1d23;
  font-size: 9px;
  font-weight: 700;
  line-height: 13px;
  text-align: center;
  font-family: system-ui, sans-serif;
  border: 1px solid rgba(0,0,0,0.35);
  box-shadow: 0 0 3px rgba(0,0,0,0.5);
  pointer-events: none;
}

/* ── Aircraft popup ── */
/* Leaflet's default popup wrapper is white with a sharp tip — override to match
   the dark theme used by the sidebar and status bar. */
.leaflet-popup-content-wrapper {
  background: rgba(15, 17, 23, 0.95);
  color: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}
.leaflet-popup-content { margin: 10px 12px; }
.leaflet-popup-tip {
  background: rgba(15, 17, 23, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.leaflet-popup-close-button { color: rgba(255, 255, 255, 0.4) !important; }
.leaflet-popup-close-button:hover { color: rgba(255, 255, 255, 0.85) !important; }

.popup-body { font-family: system-ui, sans-serif; font-size: 13px; line-height: 1.6; }
.popup-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.popup-divider { border: none; border-top: 1px solid rgba(255, 255, 255, 0.1); margin: 6px 0; }
.popup-table { width: 100%; border-collapse: collapse; }
.popup-label { color: rgba(255, 255, 255, 0.4); padding-right: 10px; }
.popup-source--local { color: var(--color-local); }
.popup-source--api   { color: var(--color-api); }
.popup-mil { color: #ef4444; font-weight: 600; margin-left: 8px; }
.popup-milsquawk {
  display: inline-block;
  margin-left: 6px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 600;
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: 3px;
  letter-spacing: 0.02em;
}
.popup-emergency {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.45);
  border-radius: 4px;
  padding: 4px 8px;
  font-weight: 700;
  margin-bottom: 6px;
  font-size: 13px;
  text-align: center;
  letter-spacing: 0.03em;
}

.popup-follow {
  display: block;
  margin-top: 8px;
  width: 100%;
  padding: 5px 10px;
  font-size: 12px;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
}
.popup-follow:hover { background: rgba(255, 255, 255, 0.08); }
.popup-follow.active {
  background: var(--color-api);
  color: #0f1117;
  border-color: var(--color-api);
}

.popup-links {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.popup-links a {
  color: var(--color-api);
  text-decoration: none;
  font-size: 12px;
  padding: 3px 8px;
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: 3px;
}
.popup-links a:hover { background: rgba(96, 165, 250, 0.15); }

/* ── Leaflet controls (zoom + centre) — dark theme to match the status bar ── */
.leaflet-bar {
  background: rgba(15, 17, 23, 0.9) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 4px !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4) !important;
}
.leaflet-bar a,
.leaflet-bar a:link,
.leaflet-bar a:visited {
  background-color: transparent !important;
  color: rgba(255, 255, 255, 0.75) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}
.leaflet-bar a:last-child { border-bottom: none !important; }
.leaflet-bar a:hover {
  background-color: rgba(255, 255, 255, 0.08) !important;
  color: #fff !important;
}
.leaflet-bar a.leaflet-disabled {
  background-color: transparent !important;
  color: rgba(255, 255, 255, 0.25) !important;
}

/* Centre-control SVG uses currentColor → inherits .leaflet-bar a color above. */
.center-ctrl a {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

/* Geolocation control — same sizing as centre, plus a loading-pulse state
   while navigator.geolocation resolves (can take several seconds on mobile). */
.geoloc-ctrl a {
  display: flex !important;
  align-items: center;
  justify-content: center;
}
.geoloc-ctrl.is-loading a {
  animation: geoloc-pulse 1s ease-in-out infinite;
}
@keyframes geoloc-pulse {
  0%, 100% { color: rgba(255, 255, 255, 0.5); }
  50%      { color: rgba(255, 255, 255, 1); }
}

/* ── Basemap switcher (custom Leaflet control, top-left) ──
   Collapsed state: single icon button, same footprint as zoom/centre.
   Expanded state: panel to the right with comfortably large tap targets. */
.basemap-ctrl { position: relative; }
.basemap-ctrl .basemap-toggle {
  display: flex !important;
  align-items: center;
  justify-content: center;
}
.basemap-panel {
  display: none;
  position: absolute;
  top: 0;
  left: calc(100% + 6px);
  background: rgba(15, 17, 23, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  padding: 4px;
  min-width: 130px;
  flex-direction: column;
  gap: 2px;
}
.basemap-ctrl.expanded .basemap-panel { display: flex; }
.basemap-panel button {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  padding: 10px 14px;
  text-align: left;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  border-radius: 3px;
  min-height: 40px;
  touch-action: manipulation;
}
.basemap-panel button:hover,
.basemap-panel button:active { background: rgba(255, 255, 255, 0.08); color: #fff; }
.basemap-panel button.active {
  color: var(--color-api);
  background: rgba(96, 165, 250, 0.12);
}

/* Attribution (bottom-right): default white bar clashes with the dark map — tone down. */
.leaflet-control-attribution {
  background: rgba(15, 17, 23, 0.7) !important;
  color: rgba(255, 255, 255, 0.45) !important;
}
.leaflet-control-attribution a { color: rgba(255, 255, 255, 0.65) !important; }
