/* ==========================================================================
   SSB BurnerWX Live Weather Station Dashboard - Stylesheet
   Inherits design tokens and glassmorphism system from ssb-hub/shared/css/theme.css
   ========================================================================== */

/* Main Dashboard Wrapper */
.burnerwx-wrapper {
  max-width: 1400px;
  margin: 0 auto;
  padding: 30px 24px 60px 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* Header & Top Bar */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding-bottom: 8px;
}

.main-header,
.app-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 10px 0;
  animation: fadeInDown var(--transition-slow);
}

/* Header layout, logo, typography & version badge are unified across the SSB suite via ../shared/css/theme.css */

/* ==========================================================================
   v0.80 compact layout
   ========================================================================== */

.burnerwx-wrapper {
  max-width: 1200px;
  padding: 20px 16px 48px 16px;
  gap: 14px;
}

.wx-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.wx-spacer { flex: 1 1 auto; }
.wx-mono { font-family: var(--font-mono); }
.wx-muted { color: var(--text-secondary); }
.wx-muted-2 { color: var(--text-muted); }

/* Panels */
.wx-panel {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  padding: 14px 16px 16px;
}

.wx-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-bottom: 10px;
}

.wx-panel-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Segmented controls */
.wx-seg {
  display: inline-flex;
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  overflow: hidden;
  font-size: 13px;
}

.wx-seg button {
  background: transparent;
  color: var(--text-secondary);
  border: 0;
  padding: 6px 10px;
  font: inherit;
  cursor: pointer;
  min-height: 32px;
}

.wx-seg button:hover { color: var(--text-primary); }

.wx-seg button.active {
  background: rgba(0, 242, 254, 0.14);
  color: var(--accent-cyan);
  font-weight: 600;
}

.wx-seg-sm { font-size: 12px; }
.wx-seg-sm button { padding: 4px 8px; min-height: 28px; }

/* Station line */
.wx-station-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}

.wx-station-select {
  background: var(--bg-glass);
  color: var(--text-primary);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  padding: 6px 10px;
  cursor: pointer;
}

.wx-station-select:focus { outline: none; border-color: var(--border-focus); }

.wx-station-meta { color: var(--text-muted); font-size: 13px; }

/* Status chip */
.wx-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(148, 163, 184, 0.12);
}

.wx-status-dot { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
.wx-status-label { font-weight: 600; color: #cbd5e1; }
.wx-status-age { color: var(--text-secondary); }

.wx-status-chip.is-live { background: rgba(16, 185, 129, 0.12); border-color: rgba(16, 185, 129, 0.35); }
.wx-status-chip.is-live .wx-status-dot { background: var(--accent-green); }
.wx-status-chip.is-live .wx-status-label { color: #6ee7b7; }

.wx-status-chip.is-stale { background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.45); }
.wx-status-chip.is-stale .wx-status-dot { background: var(--accent-orange); }
.wx-status-chip.is-stale .wx-status-label { color: #fbbf24; }

.wx-status-chip.is-fault { background: rgba(244, 63, 94, 0.12); border-color: rgba(244, 63, 94, 0.45); }
.wx-status-chip.is-fault .wx-status-dot { background: var(--accent-red); }
.wx-status-chip.is-fault .wx-status-label { color: #fda4af; }

/* Banner */
.wx-banner {
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.14);
  color: #fde68a;
}

.wx-banner.is-offline { border-color: rgba(148, 163, 184, 0.4); background: rgba(148, 163, 184, 0.14); color: #e2e8f0; }
.wx-banner.is-fault { border-color: rgba(244, 63, 94, 0.4); background: rgba(244, 63, 94, 0.14); color: #fecdd3; }

/* Now panel */
.wx-now {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px 32px;
  padding: 18px 20px;
}

.wx-now-wind { display: flex; align-items: center; gap: 18px; flex: 0 0 auto; }
.wx-now-main { display: flex; flex-direction: column; gap: 2px; }

.wx-eyebrow {
  font-size: 12px;
  color: var(--text-secondary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.wx-big-row { display: flex; align-items: baseline; gap: 6px; }

.wx-big {
  font-family: var(--font-mono);
  font-size: 52px;
  font-weight: 600;
  line-height: 1;
  color: var(--text-primary);
}

.wx-big-unit { font-size: 18px; color: var(--text-secondary); }
.wx-dir-line { font-size: 16px; font-weight: 600; }
.wx-dir-line .wx-muted { font-weight: 400; font-size: 14px; }

.wx-stats {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 12px 24px;
  flex: 1 1 400px;
  min-width: 0;
}

.wx-stats dt { font-size: 12px; color: var(--text-secondary); }

.wx-stats dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}

.wx-stats dd.wx-gust { color: #fbbf24; }
.wx-stats dd .wx-dd-note { font-family: var(--font-sans); font-size: 12px; font-weight: 400; color: var(--text-muted); }

.wx-now-side {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  flex: 0 0 auto;
  font-size: 13px;
}

.wx-metar { font-family: var(--font-mono); color: var(--text-secondary); }
.wx-cone-line { color: #6ee7b7; }
.wx-cone-line.is-out { color: var(--text-secondary); }

/* Dial */
.wx-dial { flex: 0 0 auto; }
.wx-dial-ring { fill: rgba(255, 255, 255, 0.02); stroke: rgba(255, 255, 255, 0.12); stroke-width: 1; }
.wx-dial-cone { fill: rgba(16, 185, 129, 0.14); }
.wx-dial-sector { fill: none; stroke: var(--accent-cyan); stroke-width: 4; stroke-linecap: round; opacity: 0.55; }
.wx-dial-tick { font-family: var(--font-mono); font-size: 9px; fill: var(--text-muted); }
.wx-dial-arrow polygon { fill: var(--accent-cyan); }
.wx-dial-arrow line { stroke: var(--accent-cyan); stroke-width: 2; }
.wx-dial-hub { fill: var(--text-primary); }
.wx-dial.is-calm .wx-dial-arrow { display: none; }

/* Stale / offline: fade the readings, grey the arrow */
.wx-now.is-old .wx-now-main,
.wx-now.is-old .wx-stats,
.wx-now.is-old .wx-metar,
.wx-now.is-old .wx-cone-line { opacity: 0.45; }
.wx-now.is-old .wx-dial-arrow polygon { fill: #64748b; }
.wx-now.is-old .wx-dial-arrow line { stroke: #64748b; }
.wx-now.is-old .wx-dial-sector { stroke: #64748b; }
.wx-fault-val { color: #fb7185 !important; }

/* Averages grid */
.wx-table-scroll { overflow-x: auto; }

.wx-grid {
  display: grid;
  grid-template-columns: 56px repeat(var(--cols, 12), minmax(50px, 1fr));
  min-width: calc(56px + var(--cols, 12) * 50px);
  font-family: var(--font-mono);
  font-size: 13px;
  text-align: center;
}

.wx-grid .g-label {
  text-align: left;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 12px;
  padding: 5px 0;
}

.wx-grid .g-time { color: var(--text-secondary); font-size: 12px; padding: 5px 0; }
.wx-grid .g-time.is-hour { color: var(--text-primary); font-weight: 600; }
.wx-grid .g-cell { padding: 5px 0; border-right: 1px solid rgba(7, 8, 14, 0.6); }
.wx-grid .g-spd { font-weight: 600; }
.wx-grid .g-gst { border-top: 1px solid rgba(7, 8, 14, 0.6); position: relative; }
.wx-grid .g-gst.is-gusty::after { content: '▲'; position: absolute; top: 1px; right: 3px; font-size: 8px; color: #fff; }
.wx-grid .g-sub { padding: 4px 0; color: #cbd5e1; }
.wx-grid .g-sub-2 { padding: 4px 0; color: var(--text-secondary); font-size: 12px; }
.wx-grid .g-gap { color: var(--text-muted); padding: 5px 0; font-size: 12px; background: rgba(255, 255, 255, 0.03); }
.wx-grid .g-newest { box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.6); }

.wx-grid .g-dir { padding: 5px 0 3px; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.wx-grid .g-dir svg { display: block; }
.wx-grid .g-dir span { font-size: 11px; color: #cbd5e1; }

.wx-grid .g-bar { position: relative; height: 72px; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.wx-grid .g-bar .bar-range { position: absolute; left: 30%; right: 30%; border-radius: 2px; }
.wx-grid .g-bar .bar-avg { position: absolute; left: 20%; right: 20%; height: 2px; background: var(--text-primary); }

/* Speed colour scale (Boulder site profile: ideal 3-8, max launch 15 mph) */
.spd-calm { background: rgba(79, 172, 254, 0.28); }
.spd-ideal { background: rgba(16, 185, 129, 0.34); }
.spd-moderate { background: rgba(245, 158, 11, 0.38); }
.spd-caution { background: rgba(249, 115, 22, 0.48); }
.spd-blown { background: rgba(244, 63, 94, 0.55); }
.spd-extreme { background: rgba(217, 70, 239, 0.6); }

.wx-key {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  align-items: center;
  margin-top: 10px;
}

.wx-key-item { display: inline-flex; align-items: center; gap: 5px; }
.wx-swatch { width: 14px; height: 10px; display: inline-block; }
.wx-key-note { color: var(--text-muted); }

/* Charts */
.wx-legend { display: inline-flex; gap: 12px; font-size: 12px; color: var(--text-secondary); }
.wx-line-swatch { width: 14px; display: inline-block; }
.wx-ls-wind { height: 3px; background: var(--accent-cyan); }
.wx-ls-gust { height: 8px; background: rgba(251, 191, 36, 0.35); }
.wx-ls-lull { height: 0; border-top: 2px dashed #94a3b8; }

.wx-chart { position: relative; }
.wx-chart-wind { height: 190px; }
.wx-chart-dir { height: 84px; margin-bottom: 14px; }
.wx-chart-small { height: 110px; }

.wx-chart-pair {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px 20px;
}

.wx-chart-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

/* Station health */
.wx-health {
  font-size: 12px;
  color: var(--text-muted);
  padding: 0 4px;
}

.wx-health summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  cursor: pointer;
  list-style: none;
  align-items: center;
}

.wx-health summary::-webkit-details-marker { display: none; }
.wx-health-title { color: var(--text-secondary); }
.wx-health .wx-mono { color: var(--text-secondary); }
.wx-health-toggle { margin-left: auto; color: var(--accent-blue); }
.wx-health[open] .wx-health-toggle { color: var(--accent-cyan); }
.wx-health .wx-chart-small { margin-top: 10px; }
.wx-tier { color: var(--text-secondary); }
.wx-tier.is-reserve { color: #fbbf24; font-weight: 600; }
.wx-tier.is-critical { color: #fb7185; font-weight: 600; }
.wx-health:has(.wx-tier.is-reserve) .wx-health-title,
.wx-health:has(.wx-tier.is-critical) .wx-health-title { color: var(--text-primary); }

@media (max-width: 640px) {
  .wx-now { padding: 16px; gap: 16px; }
  .wx-big { font-size: 44px; }
  .wx-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); flex-basis: 100%; }
  .wx-dial { width: 96px; height: 96px; }
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(6, 8, 16, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* Modal Content Box */
.modal-content {
  background: linear-gradient(135deg, rgba(16, 22, 40, 0.95) 0%, rgba(10, 13, 26, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  border-radius: 24px;
  width: 92%;
  max-width: 520px;
  padding: 36px;
  transform: scale(0.95) translateY(15px);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.modal-overlay.active .modal-content {
  transform: scale(1) translateY(0);
}

/* Modal Close Button */
.modal-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.2rem;
  line-height: 28px;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

/* Modal Header */
.modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 16px;
}

.modal-header-icon {
  width: 28px;
  height: 28px;
  color: var(--accent-cyan);
}

.modal-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0;
}

/* Modal Body */
.modal-body p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0 0 16px 0;
}

.modal-body strong {
  color: #ffffff;
  font-weight: 600;
}

.station-meta-info {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 16px;
  padding: 20px;
  margin-top: 20px;
}

.station-meta-info h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin: 0 0 12px 0;
}

.station-meta-info ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.station-meta-info li {
  font-size: 0.9rem;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
}

.station-meta-info li strong {
  color: var(--text-muted);
  font-weight: 500;
}

/* Modal Footer */
.modal-footer {
  margin-top: 28px;
  display: flex;
}

.github-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.github-link-btn:hover {
  background: #ffffff;
  color: #0b0d19;
  border-color: #ffffff;
  box-shadow: 0 10px 25px rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.github-link-btn i {
  width: 18px;
  height: 18px;
}

/* ==========================================================================
   Clickable Version Badge & Changelog Modal
   ========================================================================== */
.clickable-version {
  cursor: pointer;
  transition: all var(--transition-fast);
}

.clickable-version:hover {
  background: rgba(0, 242, 254, 0.2) !important;
  color: var(--accent-cyan) !important;
  border-color: var(--accent-cyan) !important;
  transform: translateY(-1px);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.3);
}

.changelog-modal-body {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 8px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.changelog-entry {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 16px;
}

.changelog-entry:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.changelog-entry-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.entry-version {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  background: rgba(0, 242, 254, 0.15);
  color: var(--accent-cyan);
  border-radius: 6px;
  border: 1px solid rgba(0, 242, 254, 0.3);
}

.entry-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.changelog-entry ul {
  margin: 0;
  padding-left: 18px;
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.changelog-entry li {
  margin-bottom: 6px;
}

.changelog-entry li strong {
  color: #ffffff;
}

.changelog-entry li code {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 0.82rem;
  color: var(--accent-cyan);
}
