/* ===========================
   MESOFLOW — Sabine-Neches Waterway
   Style: /mia design system adapted for SNW
   =========================== */

:root {
  --primary-blue:   #003366;
  --secondary-blue: #005785;
  --accent-blue:    #0099cc;
  --light-blue:     #e6f3ff;
  --noaa-blue:      #003087;

  --pin-ports:      #ff6600;
  --pin-water-level:#ffcc00;
  --pin-ndbc:       #3399ff;

  --channel-blue:   #0066cc;

  --text-dark:   #1a1a1a;
  --text-light:  #666666;
  --bg-light:    #f5f7fa;
  --bg-white:    #ffffff;
  --border-color:#ddd;

  --shadow:    0 2px 8px rgba(0,51,102,0.15);
  --shadow-lg: 0 4px 16px rgba(0,51,102,0.2);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg-light);
  color: var(--text-dark);
}

body {
  display: flex;
  flex-direction: column;
}

/* Prevent background scroll when bottom sheet is open */
body.sheet-body-locked { overflow: hidden; touch-action: none; }

/* ===== PROTOTYPE BANNER ===== */
.prototype-banner {
  position: relative;
  z-index: 1;
  background: rgba(204,0,0,0.9);
  color: var(--light-blue);
  text-align: center;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  border-radius: 4px;
  white-space: nowrap;
}

/* ===== FOG ADVISORY BANNER ===== */
.fog-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 20px;
  background: rgba(255,200,0,0.15);
  border-bottom: 2px solid #cc9900;
  font-size: 13px;
  color: #7a5500;
  flex-shrink: 0;
}

.fog-banner.fog-active {
  background: rgba(204,50,0,0.12);
  border-color: #cc3300;
  color: #8a1a00;
}

.fog-banner-icon { font-size: 20px; }

.fog-banner-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fog-advisory-text { font-weight: 700; }

.fog-asos-text {
  font-size: 11px;
  opacity: 0.85;
}

/* ===== MESOFLOW HEADER ===== */
.mesoflow-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100px;
  background: linear-gradient(135deg, #1a3a5c 0%, #2d5a7b 50%, #1a4a6e 100%);
  overflow: hidden;
  flex-shrink: 0;
}

.header-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(0,50,100,0.3) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,50,100,0.3) 1px, transparent 1px);
  background-size: 30px 30px;
  opacity: 0.5;
}

.header-currents {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.header-currents svg { width: 100%; height: 100%; }

@media (prefers-reduced-motion: reduce) {
  .header-currents { display: none; }
}

.header-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-left: 40px;
}

.mesoflow-title-link { text-decoration: none; }
.mesoflow-title-link:hover .mesoflow-title { opacity: 0.8; }
.mesoflow-title-logo {
  height: 74px;
  width: auto;
  display: block;
}

.mesoflow-title-link:hover .mesoflow-title-logo {
  opacity: 0.8;
}


.mesoflow-title {
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 48px;
  font-style: italic;
  font-weight: normal;
  color: #4a90c2;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
  letter-spacing: 2px;
}

.header-right {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  padding-right: 40px;
}

.header-title {
  font-size: 22px;
  font-weight: 600;
  color: #a0c4e8;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
  letter-spacing: 0.5px;
}

.header-subtitle {
  font-size: 13px;
  color: rgba(160,196,232,0.75);
  margin-top: 3px;
  letter-spacing: 0.5px;
}

/* ===== MAIN CONTAINER ===== */
.main-container {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ===== MAP PANEL (60%) ===== */
.map-panel {
  width: 60%;
  position: relative;
  border-right: 2px solid var(--border-color);
}

.map-container, #map {
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Legend */
.map-legend {
  position: absolute;
  top: 10px; left: 10px;
  z-index: 1000;
  background: rgba(255,255,255,0.95);
  border-radius: 6px;
  padding: 8px 10px;
  box-shadow: var(--shadow);
  font-size: 10px;
  max-width: 160px;
}

.map-legend h4 {
  font-size: 11px;
  color: var(--primary-blue);
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 3px;
  font-weight: 600;
}

.legend-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 4px;
}

.legend-header h4 { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.legend-subhead {
  font-size: 11px;
  color: var(--primary-blue);
  margin: 8px 0 4px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 3px;
  font-weight: 600;
}

.legend-collapse-btn {
  display: none;
  background: none; border: none;
  color: var(--text-light);
  font-size: 13px; cursor: pointer;
  padding: 2px 4px; line-height: 1; border-radius: 3px;
}

.legend-open-btn {
  display: none;
  position: absolute;
  top: 10px; left: 10px;
  z-index: 1000;
  background: rgba(255,255,255,0.95);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px; font-weight: 600;
  color: var(--primary-blue);
  cursor: pointer;
  box-shadow: var(--shadow);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 3px 0;
  font-size: 10px;
}

.legend-pin {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
  flex-shrink: 0;
}

.pin-ports       { background: var(--pin-ports); }
.pin-water-level { background: var(--pin-water-level); }
.pin-ndbc        { background: var(--pin-ndbc); }

.legend-speed-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.legend-line-blue {
  width: 20px; height: 3px;
  background: var(--channel-blue);
  border-radius: 2px;
  flex-shrink: 0;
  opacity: 0.8;
}

.legend-ship {
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 10px solid;
  display: inline-block;
  flex-shrink: 0;
}

/* ===== DATA PANEL (40%) ===== */
.data-panel {
  width: 40%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-white);
}

/* Station header — compact single-line strip */
.station-header {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0;
  padding: 5px 16px;
  background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 100%);
  color: white;
  flex-shrink: 0;
  min-height: 0;
  overflow: hidden;
}

#selectedStationName {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.station-header-sep {
  color: rgba(255,255,255,0.35);
  font-size: 13px;
  flex-shrink: 0;
}

#selectedStationInfo {
  font-size: 12px;
  opacity: 0.8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* Conditions Summary */
.conditions-summary {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr 1fr 1fr;
  gap: 8px;
  padding: 12px 16px;
  background: var(--light-blue);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.condition-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 8px;
  background: white;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.condition-label {
  font-size: 10px;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.condition-value {
  font-size: 19px;
  font-weight: 700;
  color: var(--primary-blue);
  line-height: 1.2;
}

.condition-unit { font-size: 10px; color: var(--text-light); }

.current-combined {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
}

/* NDBC panel (SNW: context only, no live data) */
.ndbc-panel {
  padding: 12px 16px;
  border-top: 1px solid #e0e8f0;
  background: #f0f6ff;
  flex-shrink: 0;
}

.ndbc-panel h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--noaa-blue);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ndbc-note {
  font-size: 11px;
  color: var(--text-light);
  line-height: 1.5;
}

/* Current Meters Overview */
.current-meters-overview {
  padding: 12px 16px;
  background: #fff8f0;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.current-meters-overview h3 {
  font-size: 12px;
  color: var(--pin-ports);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
}

.meters-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.meter-card {
  background: white;
  border: 2px solid var(--pin-ports);
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.meter-card:hover          { transform: translateY(-2px); box-shadow: var(--shadow); }
.meter-card.selected       { background: #fff3e6; border-color: #cc5500; }
.meter-card-primary        { border-color: #cc5500; }

.meter-card.speed-green  { border-left: 4px solid #2ecc71; }
.meter-card.speed-yellow { border-left: 4px solid #FFD600; }
.meter-card.speed-red    { border-left: 4px solid #E53935; background: rgba(229,57,53,0.05); }

.meter-card.unavailable {
  background: #f5f5f5;
  border-color: #ccc;
  opacity: 0.7;
}

.meter-card.unavailable .meter-speed { color: #999; }
.meter-card.unavailable .meter-arrow { color: #ccc; }

.meter-name  { font-size: 13px; font-weight: 700; color: var(--primary-blue); margin-bottom: 5px; }
.meter-data  { display: flex; align-items: center; justify-content: center; gap: 5px; margin-bottom: 3px; }
.meter-speed { font-size: 20px; font-weight: 700; color: var(--pin-ports); }
.meter-unit  { font-size: 10px; color: var(--text-light); }
.meter-arrow { font-size: 17px; color: var(--pin-ports); transition: transform 0.3s; }
.meter-dir   { font-size: 10px; color: var(--text-light); }
.meter-depth { font-size: 9px; color: var(--text-light); }
.meter-model { font-size: 9px; color: #009966; font-style: italic; min-height: 12px; }

/* ── PORTS vs STOFS vs NGOFS2 comparison rows (on PORTS meter cards) ── */
.meter-model { display: flex; flex-direction: column; gap: 1px; font-style: normal; }
.cmp-row { font-size: 10px; font-weight: 600; line-height: 1.3; white-space: nowrap; }
.cmp-stofs  { color: #0072B2; }   /* blue — matches analysis plots */
.cmp-ngofs2 { color: #D55E00; }   /* orange — matches analysis plots */
.cmp-delta  { color: #888; font-weight: 400; }
.cmp-legend {
  font-size: 11px; line-height: 1.5; color: var(--primary-blue);
  background: var(--light-blue); border: 1px solid rgba(0,51,102,0.18);
  border-radius: 6px; padding: 8px 11px; margin: 4px 0 10px;
}
.cmp-legend .cmp-stofs  { font-weight: 700; }
.cmp-legend .cmp-ngofs2 { font-weight: 700; }
.arrow-legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px;
  margin-top: 7px; padding-top: 6px; border-top: 1px solid rgba(0,51,102,0.18);
}
.arrow-legend .al { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
.arrow-legend .al svg { vertical-align: middle; }
.arrow-legend .al-sub { color: var(--secondary-blue); font-weight: 400; font-size: 10px; }

/* ── USGS observed gauge card (Beaumont) — a normal meter-card + USGS label ── */
/* Blue accent on 3 sides; leave the LEFT bar to the speed-* classes (green/yellow/red). */
.meter-card.usgs-card {
  border-top-color: var(--accent-blue);
  border-right-color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
}
.usgs-badge {
  display: inline-block; background: var(--secondary-blue); color: #fff;
  font-size: 8px; font-weight: 800; letter-spacing: 0.5px;
  padding: 1px 5px; border-radius: 3px; margin-left: 4px; vertical-align: middle;
}
.usgs-obs { font-size: 9px; color: var(--secondary-blue); font-style: italic; margin-top: 3px; }

/* ── Water level vs MHW card (Port Arthur) — mirrors the Dispatch Conditions Board ── */
/* Charted bridge clearances are referenced to MHW: ft ABOVE MHW = ft of clearance lost. */
.meter-card.wl-mhw-card {
  text-align: left;
  cursor: default;
  border-color: var(--pin-water-level);
}
.meter-card.wl-mhw-card:hover { transform: none; box-shadow: none; }
.meter-card.wl-mhw-card.wl-above-card {
  border-color: #E53935;
  border-left: 4px solid #E53935;
  background: #fdf3f3;
}
.wl-mhw-title { font-size: 13px; font-weight: 800; color: var(--primary-blue); margin-bottom: 3px; padding-bottom: 3px; border-bottom: 1px solid var(--border-color); }
.wl-mhw-card .meter-name { margin-bottom: 2px; font-size: 11px; font-weight: 700; color: var(--text-light); }
.wl-mhw-stn  { display: block; font-size: 9px; font-weight: 600; color: var(--text-light); margin-top: 1px; }
.wl-mhw-now  { margin: 5px 0 4px; font-size: 11px; color: var(--text-dark); }
.wl-mhw-val  { font-size: 24px; font-weight: 800; color: var(--text-dark); }
.wl-mhw-val.wl-above { color: #E53935; }
.wl-mhw-val.wl-below { color: var(--text-dark); }
.wl-mhw-lbl  { font-size: 10px; color: var(--text-light); }
.wl-mhw-meta { font-style: italic; }

/* Charts Section */
.charts-section {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.charts-section::-webkit-scrollbar { width: 8px; }
.charts-section::-webkit-scrollbar-track { background: var(--bg-light); }
.charts-section::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }
.charts-section::-webkit-scrollbar-thumb:hover { background: #aaa; }

.chart-container {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
}

.chart-header h3  { font-size: 13px; font-weight: 600; color: var(--primary-blue); }
.chart-subtitle   { font-size: 10px; color: var(--text-light); }

.chart-wrapper { height: 180px; position: relative; }
.chart-wrapper canvas { width: 100% !important; height: 100% !important; }

.chart-legend-inline {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-light);
}

.legend-observed  { color: #cc0000; }
.legend-predicted { color: #0066cc; }

.diurnal-note {
  font-size: 10px;
  color: var(--text-light);
  text-align: center;
  margin-top: 4px;
  font-style: italic;
}

/* Marine Forecast Panel */
.forecast-panel { border-top: 1px solid #e0e8f0; flex-shrink: 0; }

.forecast-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  cursor: pointer;
  user-select: none;
  background: #f0f6ff;
}

.forecast-header:hover { background: #e4effe; }

.forecast-header h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--noaa-blue);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.forecast-office {
  font-size: 10px;
  font-weight: 400;
  color: #888;
  margin-left: 8px;
  text-transform: none;
  letter-spacing: 0;
}

.forecast-toggle {
  background: none; border: none;
  color: var(--noaa-blue);
  font-size: 12px; cursor: pointer;
  padding: 2px 6px;
}

.forecast-body { padding: 0 16px 12px; background: white; }

.forecast-zone-tabs {
  display: flex;
  gap: 6px;
  padding: 8px 0 6px;
}

.fz-tab {
  flex: 1;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid #c8daf0;
  border-radius: 4px;
  background: white;
  color: #555;
  cursor: pointer;
  transition: all 0.15s;
}

.fz-tab:hover  { background: #f0f6ff; color: var(--noaa-blue); }
.fz-tab.active { background: var(--noaa-blue); color: white; border-color: var(--noaa-blue); }

.forecast-warning {
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}

.warn-red   { background: #fff0f0; color: #c0000a; border: 1px solid #ffb3b3; }
.warn-amber { background: #fff8e0; color: #8a5a00; border: 1px solid #ffd966; }

.forecast-text {
  font-size: 12px;
  line-height: 1.6;
  color: #333;
  white-space: pre-wrap;
  max-height: 200px;
  overflow-y: auto;
}

.forecast-text strong { color: var(--noaa-blue); display: inline-block; margin-top: 8px; }
.forecast-meta { font-size: 10px; color: #999; margin-top: 6px; }

/* Data footer */
.data-footer {
  padding: 10px 16px;
  background: var(--bg-light);
  border-top: 1px solid var(--border-color);
  text-align: center;
  font-size: 11px;
  color: var(--text-light);
  flex-shrink: 0;
}

.data-footer p { margin: 2px 0; }

/* ===== PAGE FOOTER ===== */
.page-footer {
  height: 60px;
  background: var(--primary-blue);
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-size: 11px;
  padding: 10px 20px;
  text-align: center;
}

.page-footer .disclaimer       { font-size: 10px; opacity: 0.8; margin-top: 3px; }
.page-footer .footer-copyright { font-size: 10px; opacity: 0.6; margin-top: 4px; }

/* ===== LOADING STATE ===== */
.loading { opacity: 0.6; pointer-events: none; }

/* ===== LEAFLET CUSTOMIZATIONS ===== */
.leaflet-popup-content-wrapper { border-radius: 6px; box-shadow: var(--shadow-lg); }
.leaflet-popup-content { font-size: 12px; margin: 10px 12px; }

/* North arrow control (desktop only) */
.snw-north-arrow {
  background: rgba(255,255,255,0.9);
  border-radius: 4px;
  padding: 4px 5px;
  box-shadow: 0 1px 5px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}


.station-popup h4 { color: var(--primary-blue); margin-bottom: 6px; font-size: 13px; }
.station-popup p  { margin: 3px 0; color: var(--text-light); font-size: 11px; }
.station-popup .popup-value { font-weight: 600; color: var(--text-dark); }

/* ===== CAROUSEL ===== */
/* Desktop: normal scrollable column */
.carousel-controls { display: none; }

.carousel-track {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.carousel-btn {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 34px; height: 34px;
  font-size: 20px;
  color: var(--primary-blue);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
  line-height: 1;
}

.carousel-btn:hover    { background: var(--light-blue); }
.carousel-btn:disabled { color: #ccc; border-color: #eee; cursor: default; }

.carousel-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex: 1;
}

.carousel-label { font-size: 13px; font-weight: 600; color: var(--primary-blue); }

.carousel-dots { display: flex; gap: 7px; align-items: center; }

.carousel-dot {
  width: 8px; height: 8px;
  border-radius: 50%; border: none;
  background: #ccc;
  cursor: pointer; padding: 0;
  transition: background 0.2s, transform 0.2s;
}

.carousel-dot.active { background: var(--primary-blue); transform: scale(1.35); }

/* ===== SHEET BACKDROP ===== */
#sheet-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,15,45,0.5);
  z-index: 499;
}

#sheet-backdrop.visible { display: block; }

/* ===== SHEET HANDLE + CLOSE ===== */
.sheet-handle-bar {
  display: none;
  width: 40px; height: 4px;
  background: rgba(0,51,102,0.18);
  border-radius: 2px;
  margin: 10px auto 0;
  cursor: pointer;
  flex-shrink: 0;
}

.sheet-close-btn {
  display: none;
  position: absolute;
  top: 10px; right: 14px;
  background: rgba(255,255,255,0.2);
  border: none;
  color: rgba(255,255,255,0.85);
  border-radius: 50%;
  width: 28px; height: 28px;
  font-size: 14px;
  cursor: pointer;
  z-index: 10;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ===== PEEK STRIP (mobile only) ===== */
#peek-strip {
  display: none;
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(0,26,64,0.93);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 14px 14px 0 0;
  z-index: 100;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.peek-handle-bar {
  width: 36px; height: 3px;
  background: rgba(255,255,255,0.3);
  border-radius: 2px;
  margin: 8px auto 5px;
}

.peek-content {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px 12px;
  width: 100%;
}

.peek-meter {
  display: flex;
  align-items: baseline;
  gap: 3px;
  flex: 1;
  justify-content: center;
}

.peek-name  { font-size: 10px; color: rgba(255,255,255,0.55); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.peek-speed { font-size: 21px; font-weight: 700; color: #fff; line-height: 1; }
.peek-unit  { font-size: 10px; color: rgba(255,255,255,0.55); }
.peek-arrow { font-size: 13px; color: var(--accent-blue); }
.peek-divider { color: rgba(255,255,255,0.18); font-size: 22px; font-weight: 100; line-height: 1; }

.peek-cta {
  background: var(--accent-blue);
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 5px 13px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ===== RESPONSIVE: wide desktop (≤1200px) ===== */
@media (max-width: 1200px) {
  .conditions-summary { grid-template-columns: repeat(3, 1fr); }
}

/* ===== TABLET (≤899px) ===== */
@media (max-width: 899px) {
  .main-container {
    flex-direction: column;
  }

  .map-panel {
    width: 100%;
    height: 40%;
    min-height: 220px;
    border-right: none;
    border-bottom: 2px solid var(--border-color);
  }

  .data-panel { width: 100%; flex: 1; min-height: 0; overflow: hidden; }

  .page-footer { display: none; }

  .legend-collapse-btn { display: inline-flex; align-items: center; justify-content: center; }
  .map-legend.collapsed { display: none; }
  .legend-open-btn { display: block; }

  .conditions-summary { grid-template-columns: repeat(3, 1fr); }

  .meters-grid {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .meters-grid::-webkit-scrollbar { display: none; }
  .meter-card { min-width: 120px; flex-shrink: 0; }

  .carousel-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px 4px;
    gap: 8px;
    flex-shrink: 0;
  }

  .charts-section { overflow: hidden; padding: 0; }

  .carousel-track {
    flex-direction: row;
    gap: 0;
    transition: transform 0.3s ease;
    will-change: transform;
  }

  .carousel-slide {
    min-width: 100%;
    padding: 10px 14px;
    box-sizing: border-box;
  }
}

/* ===== PHONE (≤599px) ===== */
@media (max-width: 599px) {
  .mesoflow-header { height: 60px; }
  .mesoflow-title  { font-size: 26px; }
  .mesoflow-title-logo { height: 51px; }

  .header-content  { padding-left: 14px; }
  .header-title    { font-size: 11px; letter-spacing: 0; }
  .header-subtitle { display: none; }
  .header-right    { padding-right: 14px; }

  .fog-banner { padding: 6px 12px; font-size: 11px; }

  .main-container {
    flex-direction: row;
  }

  .map-panel { width: 100%; height: 100%; border-bottom: none; }

  #dataPanel {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    width: 100%;
    height: 82vh;
    z-index: 500;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 28px rgba(0,15,60,0.28);
    overflow: hidden;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    background: var(--bg-white);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  #dataPanel.sheet-open { transform: translateY(0); }

  .sheet-handle-bar { display: block; }
  .sheet-close-btn  { display: flex; }

  .station-header {
    position: relative;
    padding-right: 48px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .station-header h2 { font-size: 16px; }
  .station-header p  { font-size: 11px; }

  #peek-strip {
    display: flex;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .conditions-summary {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 10px 12px;
    scrollbar-width: none;
    flex-shrink: 0;
  }

  .conditions-summary::-webkit-scrollbar { display: none; }
  .condition-card      { min-width: 82px; flex-shrink: 0; }
  .condition-card-wide { min-width: 140px; }
  .condition-value     { font-size: 16px; }

  .meters-grid {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .meters-grid::-webkit-scrollbar { display: none; }
  .meter-card { min-width: 110px; flex-shrink: 0; }

  .current-meters-overview { flex-shrink: 0; padding: 10px 12px; }

  .carousel-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px 4px;
    gap: 8px;
    flex-shrink: 0;
  }

  .charts-section {
    overflow: hidden;
    padding: 0;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .carousel-track {
    flex-direction: row;
    gap: 0;
    transition: transform 0.3s ease;
    will-change: transform;
    flex: 1;
    min-height: 0;
  }

  .carousel-slide {
    min-width: 100%;
    padding: 8px 12px;
    box-sizing: border-box;
    overflow-y: auto;
    flex-shrink: 0;
  }

  .chart-wrapper  { height: 180px; }
  .data-footer    { display: none; }
  .page-footer    { display: none; }

  .forecast-panel { flex-shrink: 0; }
  .forecast-text  { max-height: 160px; }
}


/* ═══════════════════════════════════════════════════════════
   NGOFS2 v3.0 NOW CARDS
   ═══════════════════════════════════════════════════════════ */

.ofs-now-section {
  padding: 10px 12px 6px;
  background: linear-gradient(135deg, #001a33 0%, #002b52 100%);
  border-bottom: 2px solid #FF6B00;
}

.ofs-now-heading {
  font-size: 12px;
  font-weight: 700;
  color: #FF6B00;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin: 0 0 8px;
}

.ofs-now-source {
  font-size: 10px;
  font-weight: 400;
  color: #7ec8e3;
  text-transform: none;
  letter-spacing: 0;
  margin-left: 6px;
  background: rgba(0,153,204,0.2);
  padding: 1px 5px;
  border-radius: 3px;
}

.ofs-now-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ofs-station-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,107,0,0.3);
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.ofs-station-card.speed-green  { border-left: 4px solid #2ecc71; }
.ofs-station-card.speed-yellow { border-left: 4px solid #FFD600; }
.ofs-station-card.speed-red    { border-left: 4px solid #E53935; background: rgba(229,57,53,0.10); }

.ofs-station-card:hover {
  background: rgba(255,255,255,0.11);
  border-color: rgba(255,107,0,0.6);
}

.ofs-section-label {
  grid-column: 1 / -1;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  padding: 4px 2px 2px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 2px;
}

.ofs-card-header {
  display: flex;
  flex-direction: column;
  margin-bottom: 4px;
}

.ofs-card-name {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.2px;
}

.ofs-card-coords {
  font-size: 9px;
  color: #7ec8e3;
  margin-top: 1px;
  font-family: monospace;
}

.ofs-card-time {
  font-size: 9px;
  color: #FF6B00;
  font-weight: 600;
  margin-bottom: 6px;
}

.ofs-card-rows {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ofs-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 11px;
}

.ofs-label {
  color: #a0b8cc;
  font-size: 9px;
  min-width: 62px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.ofs-value {
  color: #e8f4ff;
  font-weight: 600;
}

.ofs-dir {
  color: #00A99D;
  font-size: 10px;
  font-weight: 600;
}

.ofs-model-run {
  font-size: 9px;
  color: rgba(255,255,255,0.4);
  margin-top: 7px;
  padding-top: 5px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

@media (max-width: 599px) {
  .ofs-now-grid {
    grid-template-columns: 1fr;
  }
}


/* ═══════════════════════════════════════════════════════════
   DATA PANEL TABS (v3.0)
   ═══════════════════════════════════════════════════════════ */

.data-tab-bar {
  display: flex;
  flex-shrink: 0;
  background: #001e3c;
  border-bottom: 2px solid #FF6B00;
}

.data-tab-btn {
  flex: 1;
  padding: 10px 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: rgba(160, 196, 232, 0.6);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.data-tab-btn:hover {
  color: #a0c4e8;
  background: rgba(255, 255, 255, 0.04);
}

.data-tab-btn.active {
  color: #FF6B00;
  border-bottom-color: #FF6B00;
  background: rgba(255, 107, 0, 0.06);
}

/* Tab panes */
.tab-pane {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  min-height: 0;
}

.tab-pane.active { display: flex; }

/* Forecast tab — panel always expanded, no toggle */
.forecast-panel-expanded {
  border-top: none;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.forecast-panel-expanded .forecast-header {
  cursor: default;
  padding: 12px 16px 10px;
}

.forecast-panel-expanded .forecast-header:hover {
  background: #f0f6ff;
}

.forecast-panel-expanded .forecast-body {
  display: block !important;
  flex: 1;
  overflow-y: auto;
}

.forecast-panel-expanded .forecast-text {
  max-height: none;
}

@media (max-width: 950px) {
  .forecast-panel-expanded .forecast-text { max-height: none; }
}

/* ── Travel Time Section ─────────────────────────────────────────────────── */
.travel-time-section {
  margin: 16px 0 8px;
  padding: 14px 16px 10px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #dde3ea;
}

.travel-heading {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #003087;
  margin: 0 0 10px;
}

.travel-source {
  font-weight: 400;
  color: #666;
  text-transform: none;
  letter-spacing: 0;
}

.travel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.travel-card {
  background: #fff;
  border: 1px solid #dde3ea;
  border-radius: 6px;
  padding: 10px 12px;
  border-left: 4px solid #ccc;
  transition: border-left-color 0.3s;
}

.travel-card.travel-green  { border-left-color: #27ae60; }
.travel-card.travel-yellow { border-left-color: #f39c12; }
.travel-card.travel-red    { border-left-color: #e74c3c; }

.travel-direction {
  font-size: 0.72rem;
  color: #555;
  font-weight: 600;
  margin-bottom: 4px;
}

.travel-duration {
  font-size: 1.6rem;
  font-weight: 700;
  color: #1a2a4a;
  line-height: 1.1;
}

.travel-unit {
  font-size: 0.85rem;
  font-weight: 400;
  color: #666;
}

.travel-vs {
  font-size: 0.70rem;
  color: #888;
  margin-top: 4px;
}

.travel-updated {
  font-size: 0.68rem;
  color: #aaa;
  margin-top: 8px;
  text-align: right;
}

/* ── Travel Time — Planned Departure Picker ──────────────────────────────── */
.travel-planned {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #dde3ea;
}

.travel-planned-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 6px;
}

.travel-planned-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.travel-planned-controls input[type="datetime-local"] {
  flex: 1;
  padding: 5px 8px;
  font-size: 0.80rem;
  border: 1px solid #ccd3dc;
  border-radius: 4px;
  color: #1a2a4a;
  background: #fff;
}

.travel-planned-controls button {
  padding: 5px 14px;
  font-size: 0.80rem;
  font-weight: 600;
  background: #003087;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}

.travel-planned-controls button:hover  { background: #004db3; }
.travel-planned-controls button:disabled { opacity: 0.6; cursor: default; }

.travel-planned-result {
  margin-top: 8px;
  background: #f0f4ff;
  border-radius: 5px;
  padding: 8px 10px;
}

.travel-planned-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 2px 0;
}

.travel-planned-dir  { font-size: 0.73rem; color: #555; }
.travel-planned-min  { font-size: 1.1rem; font-weight: 700; color: #1a2a4a; }
.travel-planned-unit { font-size: 0.75rem; color: #666; }

.travel-planned-note {
  font-size: 0.68rem;
  color: #888;
  margin-top: 5px;
}

/* ===========================
   OFS FORECAST TABLE (inline 6-hour forecast in each Conditions Now card)
   =========================== */
.ofs-card-body {
  display: flex;
  flex-direction: row;
  gap: 10px;
  align-items: flex-start;
}
.ofs-forecast-table {
  flex: 1;
  min-width: 0;
}
.ofs-forecast-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
}
.ofs-forecast-table th {
  color: rgba(100,200,255,0.7);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid rgba(255,107,0,0.35);
  padding: 0 3px 2px;
  text-align: right;
  white-space: nowrap;
}
.ofs-forecast-table th:first-child { text-align: left; }
.ofs-forecast-table td {
  color: #e8f4ff;
  padding: 2px 3px;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.ofs-forecast-table td:first-child {
  text-align: left;
  color: rgba(200,230,255,0.65);
  font-size: 9px;
}
.ofs-forecast-table tbody tr:nth-child(even) {
  background: rgba(255,255,255,0.04);
}
@media (max-width: 380px) {
  .ofs-card-body { flex-direction: column; }
}

/* ── Mini map popups (click-to-reveal for all station + arrow markers) ── */
.popup-mini .leaflet-popup-content-wrapper {
  background: rgba(8, 18, 32, 0.93);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 5px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.65);
  padding: 0;
}
.popup-mini .leaflet-popup-content {
  margin: 7px 10px;
  font-size: 11px;
  line-height: 1.45;
}
.popup-mini .leaflet-popup-tip-container { margin-top: -1px; }
.popup-mini .leaflet-popup-tip { background: rgba(8,18,32,0.93); }
.station-popup-mini {
  color: #deeeff;
  white-space: nowrap;
}
.station-popup-mini b { color: #fff; font-size: 12px; }
.popup-mini .leaflet-popup-close-button { color: rgba(255,255,255,0.4) !important; top: 2px !important; right: 4px !important; }
.alert-popup { color: #deeeff; white-space: normal; }
.alert-popup b { font-size: 12px; display: inline-block; margin-bottom: 2px; }
.alert-popup-wrap .leaflet-popup-content { margin: 8px 12px; }
.alert-popup { line-height: 1.4; }

/* ── NGOFS2 chevron arrows ── */
.ofs-chevron-svg {
  display: block;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.55));
}
.ofs-arrow-ngofs2 .ofs-arrow-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── NWS active-alert bar (pilots page) ─────────────────────── */
.nws-alert-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 7px 14px; background: var(--light-blue);
  border-bottom: 1px solid rgba(0,51,102,0.18);
}
.nws-alert-lead { font-size: 12px; font-weight: 800; color: var(--primary-blue); letter-spacing: .3px; }
.nws-alert-chip {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  background: #fff; border: 1px solid rgba(0,51,102,0.18); border-left: 5px solid #999;
  border-radius: 6px; padding: 4px 10px; font-family: inherit;
}
.nws-alert-chip:hover { background: #f4f9ff; }
.nws-alert-evt { font-size: 12px; font-weight: 700; }
.nws-alert-exp { font-size: 11px; color: var(--gray-text, #666); }

/* Along/cross-channel row on STOFS now-cards */
.ofs-row-chan .ofs-chan { font-variant-numeric: tabular-nums; color: var(--primary-blue); font-weight: 600; }

/* View switch — cross-link between Pilot Map and Dispatch Board */
.view-eyebrow {
  font-size: 10px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase;
  color: rgba(160,196,232,0.9);
}
.view-switch {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 8px;
  padding: 6px 13px; border-radius: 999px; text-decoration: none;
  font-size: 13px; font-weight: 700; color: #eaf4ff;
  background: rgba(255,255,255,0.12); border: 1px solid rgba(160,196,232,0.55);
  transition: background .15s, border-color .15s;
}
.view-switch:hover { background: rgba(255,255,255,0.22); border-color: rgba(200,225,250,0.9); }
.view-switch:focus-visible { outline: 2px solid #cfe6f5; outline-offset: 2px; }
@media (max-width: 640px) {
  .view-eyebrow { display: none; }
  .view-switch { margin-top: 4px; padding: 4px 10px; font-size: 11px; }
}

/* Header layout v2 — title block on the left, big view name + bigger switch */
.header-content { flex-direction: row; align-items: center; gap: 22px; }
.header-titles { display: flex; flex-direction: column; }
.view-eyebrow-lg {
  font-size: 30px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase;
  color: #d4ebfb; text-shadow: 1px 1px 4px rgba(0,0,0,0.35); line-height: 1.02;
}
.header-right { flex-direction: row; align-items: center; }
.view-switch-lg {
  margin-top: 0; font-size: 16px; font-weight: 800; padding: 11px 22px; gap: 8px;
}
.view-switch-lg span { font-size: 18px; }
@media (max-width: 700px) {
  .view-eyebrow-lg { font-size: 18px; letter-spacing: 1px; }
  .header-subtitle { display: none; }
  .view-switch-lg { font-size: 13px; padding: 8px 14px; min-width: 0; }
  .header-content { gap: 12px; }
}

/* Final touches — shared header type (Bruno Ace titles), matched buttons */
.view-eyebrow-lg {
  font-family: 'Bruno Ace', 'Segoe UI', Roboto, sans-serif;
}
.view-switch-lg { min-width: 190px; justify-content: center; }

/* NWS alert chips — expandable inline panel (matches /sab/dispatch) */
.nws-alert-caret { font-size: 10px; color: var(--gray-text, #666); transition: transform .15s; }
.nws-alert-chip.open .nws-alert-caret { transform: rotate(180deg); }
.nws-alert-panel {
  flex-basis: 100%; width: 100%; margin-top: 6px;
  background: #fff; border: 1px solid rgba(0,51,102,0.18); border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0,51,102,.10); padding: 10px 13px;
}
.nws-alert-panel[hidden] { display: none; }
.nws-ad-head { font-size: 13px; font-weight: 700; color: var(--primary-blue, #003366); line-height: 1.35; margin-bottom: 4px; }
.nws-area-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12px; color: var(--gray-text, #555); line-height: 1.4; padding: 2px 0; }
.nws-zoom { flex: none; cursor: pointer; font-family: inherit; font-size: 11px; font-weight: 700; color: #fff; background: var(--primary-blue, #003366); border: none; border-radius: 5px; padding: 3px 9px; }
.nws-zoom:hover { background: #0077be; }
