/* ============================================================
   WEATHER.CSS
   eIAWS — Enterprise Integrated Aviation Weather System
   I.M. Systems Group
   Aviation & weather-specific UI components
   ============================================================ */

/* ----------------------------------------------------------
   RAW METAR TERMINAL DISPLAY
   ---------------------------------------------------------- */
/* The METAR glow used to pulse (an 8 s infinite box-shadow animation). Animating a blurred
   shadow forces a repaint on every frame and kept the page at 150%+ CPU, so it is now a
   static glow. */

.metar-box {
  background-color: #000000;
  color: var(--color-accent-primary);
  font-family: var(--font-mono);
  font-size: var(--text-base);
  padding: var(--space-4);
  border-radius: var(--border-radius-md);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-x: auto;
  box-shadow: 0 0 15px rgba(2, 170, 252, 0.55);
  margin-top: var(--space-4);
  margin-bottom: var(--space-4);
}

/* ----------------------------------------------------------
   FLIGHT CATEGORY — Glossy circular badge
   ---------------------------------------------------------- */
.station-badge-and-cat {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.flight-cat-badge {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: var(--text-base);
  font-weight: var(--weight-extrabold);
  color: #ffffff;
  letter-spacing: 0.05em;
  flex-shrink: 0;
  position: relative;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
  box-shadow:
    0 4px 15px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255,255,255,0.35),
    inset 0 -2px 4px rgba(0,0,0,0.2);
  transition: var(--transition-standard);
}

.flight-cat-badge::before {
  content: '';
  position: absolute;
  top: 8%; left: 15%;
  width: 70%; height: 40%;
  background: linear-gradient(to bottom, rgba(255,255,255,0.45) 0%, rgba(255,255,255,0.05) 100%);
  border-radius: 50%;
  pointer-events: none;
}

.flight-cat-badge.cat-vfr  { background: radial-gradient(circle at 40% 35%, #4ade80, #15803d); }
.flight-cat-badge.cat-mvfr { background: radial-gradient(circle at 40% 35%, #60a5fa, #1d4ed8); }
.flight-cat-badge.cat-ifr  { background: radial-gradient(circle at 40% 35%, #f87171, #b91c1c); }
.flight-cat-badge.cat-lifr { background: radial-gradient(circle at 40% 35%, #e879f9, #a21caf); }

/* ----------------------------------------------------------
   FLIGHT INFO DETAILS PANEL
   ---------------------------------------------------------- */
.flight-info-details {
  padding: var(--space-3);
  background-color: rgba(0, 0, 0, 0.25);
  border-radius: var(--border-radius-md);
  font-size: var(--text-xs);
  color: #d1d5db;
  display: none;
  line-height: 1.8;
}

.flight-info-details.show {
  display: block;
}

.flight-info-details p {
  margin: 0;
}

/* ----------------------------------------------------------
   CONDITION SUMMARY TAGS
   ---------------------------------------------------------- */
.condition-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--border-radius-pill);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

/* ----------------------------------------------------------
   WEATHER TIMELINE
   ---------------------------------------------------------- */
.weather-timeline-dots {
  display: flex;
  gap: var(--space-1);
  align-items: center;
}

.weather-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ----------------------------------------------------------
   DISCLAIMER
   ---------------------------------------------------------- */
.disclaimer {
  margin-top: var(--space-6);
  padding: var(--space-3) var(--space-4);
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: var(--border-radius-md);
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
}

/* ----------------------------------------------------------
   WIND ICON CONTAINER
   ---------------------------------------------------------- */
.wind-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
}

/* ----------------------------------------------------------
   LOGIN MODAL
   ---------------------------------------------------------- */
.login-modal {
  position: fixed;
  inset: 0;
  background-color: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.login-content {
  background-color: var(--bg-panel);
  border-radius: var(--border-radius-xl);
  padding: var(--space-8);
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-color-subtle);
}

.login-header {
  text-align: center;
  margin-bottom: var(--space-6);
}

.login-header h2 {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--color-accent-primary);
  margin-bottom: var(--space-1);
}

.auth-form h3 {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.form-description {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}

.auth-button {
  width: 100%;
  padding: var(--space-3);
  border-radius: var(--border-radius-md);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  transition: var(--transition-fast);
  margin-bottom: var(--space-3);
  border: none;
}

.auth-button.primary {
  background-color: var(--color-action);
  color: var(--text-primary);
}

.auth-button.primary:hover {
  background-color: var(--color-action-hover);
}

.auth-button.secondary {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.auth-button.secondary:hover {
  background-color: var(--bg-card);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin: var(--space-4) 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--border-color);
}

.error-message {
  color: var(--text-danger);
  font-size: var(--text-sm);
  text-align: center;
  min-height: 20px;
  margin-top: var(--space-2);
}

.forgot-password-link {
  background: none;
  border: none;
  color: var(--color-action-light);
  font-size: var(--text-sm);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.trial-info {
  text-align: center;
  margin-top: var(--space-4);
  color: var(--text-muted);
  font-size: var(--text-xs);
}

/* ----------------------------------------------------------
   MAP RESET BUTTON
   ---------------------------------------------------------- */
.leaflet-reset-btn {
  width: 30px;
  height: 30px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: #fff;
  text-decoration: none;
}

.leaflet-reset-btn:hover {
  background: #f4f4f4;
}

/* ----------------------------------------------------------
   MAP LAYER SWITCHER — collapsible sidebar
   ---------------------------------------------------------- */
.leaflet-layer-switcher {
  position: relative;
}

.layer-switcher-btn {
  width: 34px;
  height: 34px;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 1px 5px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #333;
  transition: background 0.15s ease;
}

.layer-switcher-btn:hover,
.layer-switcher-btn.active {
  background: #e8f4fd;
  color: #0369a1;
}

.layer-switcher-panel {
  display: none;
  position: absolute;
  left: 40px;
  top: 0;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  padding: 10px 14px;
  min-width: 200px;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 1000;
}

.layer-switcher-panel.open {
  display: block;
}

/* Invisible bridge so cursor can move from btn to panel */
.layer-switcher-panel::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 0;
  width: 8px;
  height: 100%;
}

.layer-switcher-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #888;
  padding: 4px 0 2px;
}

.layer-switcher-divider {
  border-top: 1px solid #e5e7eb;
  margin: 6px 0;
}

.layer-switcher-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 4px;
  font-size: 13px;
  font-family: var(--font-sans);
  color: #333;
  cursor: pointer;
  white-space: nowrap;
  border-radius: 4px;
  transition: background 0.1s;
}

.layer-switcher-item:hover {
  background: #f3f4f6;
}

.layer-switcher-item-sub {
  padding-left: 20px;
  font-size: 12px;
  color: #666;
}

.layer-switcher-item input {
  cursor: pointer;
  accent-color: var(--color-action);
  flex-shrink: 0;
}

/* ----------------------------------------------------------
   RADAR TIMESTAMP
   ---------------------------------------------------------- */
.radar-timestamp {
  text-align: center;
  color: var(--text-primary);
  font-size: var(--text-lg);
  padding: var(--space-4) 0 var(--space-2);
}

/* ----------------------------------------------------------
   SIGMET LAYER — hazard badges & popup (layers/sigmet.js)
   Badge markers follow the same divIcon pattern as
   tropicalCyclone.js's marker icon, but text-based (no SVG
   asset) — see sigmet.js header comment for why.
   Raw SIGMET text block styled like .metar-box above: dark
   monospace terminal, since both are raw aviation product text.
   ---------------------------------------------------------- */
.sigmet-badge-wrap {
  background: none;
  border: none;
}

.sigmet-badge {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-family: var(--font-sans);
  font-weight: var(--weight-bold);
  font-size: var(--text-xs);
  border: 2px solid #ffffff;
  box-shadow: var(--shadow-sm);
}

/* Cap the popup's own width so Leaflet can't auto-size the wrapper to
   the raw SIGMET text's longest unwrapped line — without this, the
   wrapper sizes to content BEFORE word-break applies inside it, and
   long lines like "IAH-30W ACT-40WSW MEM" bleed past the box edge. */
.leaflet-popup-content-wrapper:has(.sigmet-popup) {
  max-width: 320px;
}

.sigmet-popup {
  width: 280px;
  max-width: 280px;
  box-sizing: border-box;
  font-family: var(--font-sans);
}

.sigmet-popup h3 {
  margin: 0 0 var(--space-2) 0;
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--bg-surface);
}

.sigmet-popup p {
  margin: var(--space-1) 0;
  font-size: var(--text-sm);
  color: var(--bg-surface);
  overflow-wrap: break-word;
}

.sigmet-raw {
  display: block;
  margin-top: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.4;
  max-height: 140px;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  background-color: #000000;
  color: var(--color-accent-primary);
  border-radius: var(--border-radius-md);
  padding: var(--space-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  box-sizing: border-box;
}

/* ----------------------------------------------------------
   TROPICAL CYCLONE POPUPS — layers/tropicalCyclone.js
   .tc-popup (current position) and .tc-popup-small (observed
   track points + forecast points) read the storm's intensity
   color from the --tc-color custom property set inline by
   tropicalCyclone.js (getIntensityColor()) — same color
   language as the track line and circle markers, so the popup
   itself visually reports the storm's current strength.

   Deliberately distinct from .sigmet-popup: a colored accent
   bar + card layout here vs. SIGMET's plain white card with a
   dark terminal block, since TC content is clean structured
   data with no raw-text dump to display.
   ---------------------------------------------------------- */
.tc-popup,
.tc-popup-small {
  --tc-color: var(--color-accent-primary); /* fallback if unset */
  font-family: var(--font-sans);
  color: var(--bg-surface);
  box-sizing: border-box;
}

.tc-popup {
  width: 260px;
  max-width: 260px;
  padding-top: var(--space-2);
  border-top: 4px solid var(--tc-color);
}

.tc-popup-small {
  width: 220px;
  max-width: 220px;
  padding-top: var(--space-1);
  border-top: 3px solid var(--tc-color);
}

.tc-popup h3 {
  margin: var(--space-1) 0 var(--space-2) 0;
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--bg-surface);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.tc-popup h3::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--tc-color);
  flex-shrink: 0;
}

.tc-popup-small h4 {
  margin: var(--space-1) 0 var(--space-1) 0;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--bg-surface);
}

.tc-popup p,
.tc-popup-small p {
  margin: 2px 0;
  font-size: var(--text-sm);
  overflow-wrap: break-word;
}

.tc-popup-small p {
  font-size: var(--text-xs);
}

.tc-popup p strong,
.tc-popup-small p strong {
  color: var(--text-label);
  font-weight: var(--weight-medium);
}

/* ----------------------------------------------------------
   STORM MARKER ICON — layers/tropicalCyclone.js getStormIcon()
   No styling previously existed on .tc-icon; the marker image
   was rendering with no shadow/positioning treatment. A subtle
   drop-shadow keeps the symbol legible against any basemap
   (especially the dark basemap, where the SVG's own dark
   strokes would otherwise have no separation from the tiles).
   ---------------------------------------------------------- */
.tc-icon {
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.6));
}