/* SCAN A SIGNAL — live visual effects (NASA control-room style).
   Pure CSS, no JS animation. Performance-first:
   - GPU-accelerated transforms (translate/scale)
   - filter:drop-shadow only on the ~30 pulsing port cores and the single
     selected vessel marker; everything else is static.
   - Animations are short (≤ 2 s) and reusable, avoiding compositor churn.
*/

/* ════════════════════════════════════════════════════════════════════
   1. PORTS MAJEURS PULSANTS
   Red core (#FF4444) with an expanding halo. Tooltip on hover only.
   ════════════════════════════════════════════════════════════════════ */
.ss-port-marker {
  position: relative;
  width: 12px; height: 12px;
  display: flex; align-items: center; justify-content: center;
  pointer-events: auto;
  cursor: pointer;
}
.ss-port-marker .ss-port-core {
  position: relative;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #FF4444;
  box-shadow:
    0 0 0 1px rgba(255, 68, 68, 0.85),
    0 0 6px rgba(255, 68, 68, 0.65);
  z-index: 2;
}
.ss-port-marker::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: rgba(255, 68, 68, 0.35);
  transform: translate(-50%, -50%);
  animation: ss-port-halo 2s ease-out infinite;
  pointer-events: none;
  z-index: 1;
}
@keyframes ss-port-halo {
  0%   { width: 12px; height: 12px; opacity: 0.55; }
  70%  { width: 28px; height: 28px; opacity: 0.05; }
  100% { width: 32px; height: 32px; opacity: 0; }
}

/* Tooltip styling — Leaflet's default tooltip skin is overridden so it
   matches the rest of the dark UI. */
.leaflet-tooltip.ss-port-tip {
  background: rgba(14, 22, 35, 0.92);
  border: 1px solid rgba(255, 68, 68, 0.45);
  color: #F4F7FA;
  font-size: 11px;
  letter-spacing: 0.05em;
  padding: 4px 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.55);
}
.leaflet-tooltip.ss-port-tip::before { display: none; }
.ss-port-tip strong { color: #FF6B6B; font-weight: 600; }

/* ════════════════════════════════════════════════════════════════════
   2. VESSEL TRAIL (cyan dashed polyline, opacity gradient)
   Per-segment opacity is set in JS — this rule just gives the dash style.
   ════════════════════════════════════════════════════════════════════ */
.ss-vessel-trail {
  stroke: #00E5FF;
  stroke-width: 1.5;
  fill: none;
  stroke-dasharray: 4 6;
  filter: drop-shadow(0 0 3px rgba(0, 229, 255, 0.45));
}

/* ════════════════════════════════════════════════════════════════════
   3. RADAR LOCK ON SELECTED VESSEL
   When the marker has class --locked, three concentric rings expand
   outward in a sonar pattern, layered over the existing ::before/::after
   halo from scan_signal.css.
   ════════════════════════════════════════════════════════════════════ */
.ss-vessel-marker--locked {
  z-index: 9999;
}
.ss-vessel-marker--locked::before {
  width: 32px; height: 32px;
  border: 2px solid #00E5FF;
  border-radius: 50%;
  position: absolute;
  top: 50%; left: 50%;
  opacity: 0.9;
  animation: ss-radar-lock 1.8s ease-out infinite;
  content: "";
  pointer-events: none;
}
.ss-vessel-marker--locked::after {
  width: 32px; height: 32px;
  border: 1.5px solid rgba(0, 229, 255, 0.5);
  border-radius: 50%;
  position: absolute;
  top: 50%; left: 50%;
  opacity: 0.7;
  animation: ss-radar-lock 1.8s ease-out infinite 0.6s;
  content: "";
  pointer-events: none;
}
.ss-vessel-marker--locked .ss-radar-ring-3 {
  position: absolute;
  top: 50%; left: 50%;
  width: 32px; height: 32px;
  border: 1px solid rgba(0, 229, 255, 0.35);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0.6);
  animation: ss-radar-lock 1.8s ease-out infinite 1.2s;
  pointer-events: none;
}
@keyframes ss-radar-lock {
  0%   { transform: translate(-50%, -50%) scale(0.6); opacity: 0.85; }
  60%  { opacity: 0.25; }
  100% { transform: translate(-50%, -50%) scale(2.2); opacity: 0; }
}

/* ════════════════════════════════════════════════════════════════════
   4. AIS PING FLASH — fired when a fresh PositionReport lands.
   Class is added briefly (~320ms) by JS then removed.
   ════════════════════════════════════════════════════════════════════ */
.ss-vessel-marker--ping .ss-ping-burst {
  position: absolute;
  top: 50%; left: 50%;
  width: 8px; height: 8px;
  background: #FFFFFF;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  animation: ss-ping-flash 320ms ease-out forwards;
  pointer-events: none;
  z-index: 10;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.85);
}
@keyframes ss-ping-flash {
  0%   { transform: translate(-50%, -50%) scale(0);   opacity: 1; }
  50%  { transform: translate(-50%, -50%) scale(2);   opacity: 0.85; }
  100% { transform: translate(-50%, -50%) scale(3.2); opacity: 0; }
}

/* ════════════════════════════════════════════════════════════════════
   5. SPEED-PROPORTIONAL GLOW
   Drop-shadow on the core SVG, scaled by SOG bucket.
   ════════════════════════════════════════════════════════════════════ */
.ss-vessel-marker--speed-stationary .core { filter: none; }
.ss-vessel-marker--speed-slow .core {
  filter: drop-shadow(0 0 4px rgba(0, 229, 255, 0.55));
}
.ss-vessel-marker--speed-cruise .core {
  filter: drop-shadow(0 0 8px rgba(0, 229, 255, 0.75));
}
.ss-vessel-marker--speed-fast .core {
  filter:
    drop-shadow(0 0 12px rgba(0, 229, 255, 0.95))
    drop-shadow(0 0 20px rgba(0, 229, 255, 0.45));
}

/* Reduced-motion: disable expanding animations, keep static visibility. */
@media (prefers-reduced-motion: reduce) {
  .ss-port-marker::after,
  .ss-vessel-marker--locked::before,
  .ss-vessel-marker--locked::after,
  .ss-vessel-marker--locked .ss-radar-ring-3,
  .ss-vessel-marker--ping .ss-ping-burst {
    animation: none;
  }
}
