/* ==========================================================================
   Moody Flight Briefing Dashboard - Design System & Styles
   Aesthetic: Fluid Organics with frosted glass overlays (glassmorphism)
   ========================================================================== */

:root {
  /* HSL Color System */
  --bg-color: #050608;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  
  /* Frosted Glass Bases */
  --glass-bg: rgba(10, 12, 16, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-hover: rgba(255, 255, 255, 0.16);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);

  /* Flight Weather Categories */
  --color-vfr: #10b981;    /* Emerald green */
  --color-mvfr: #3b82f6;   /* Blue */
  --color-ifr: #f59e0b;    /* Amber */
  --color-lifr: #ef4444;   /* Red */
  --color-warn: #f59e0b;
  --color-accent: #ff9f0a; /* Premium amber accent for UI selections */
  --color-accent-dim: rgba(255, 159, 10, 0.12);

  /* Fonts */
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  /* Dynamic Background Blobs */
  --blob-color-1: rgba(20, 80, 140, 0.2);
  --blob-color-2: rgba(40, 120, 90, 0.15);
  --blob-color-3: rgba(100, 40, 120, 0.15);
}

/* Dynamic gradient shifts depending on meteorological conditions */
.weather-cat-vfr {
  --blob-color-1: rgba(16, 185, 129, 0.12);
  --blob-color-2: rgba(6, 95, 70, 0.15);
}
.weather-cat-mvfr {
  --blob-color-1: rgba(59, 130, 246, 0.12);
  --blob-color-2: rgba(30, 58, 138, 0.15);
}
.weather-cat-ifr {
  --blob-color-1: rgba(245, 158, 11, 0.12);
  --blob-color-2: rgba(120, 53, 4, 0.15);
}
.weather-cat-lifr {
  --blob-color-1: rgba(239, 68, 68, 0.12);
  --blob-color-2: rgba(127, 29, 29, 0.15);
}

/* ==========================================================================
   Core Reset & Basic Styles
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 15.4px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

.mono {
  font-family: var(--font-mono);
}

/* ==========================================================================
   Fluid Organics Background Animation
   ========================================================================== */
.mesh-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  overflow: hidden;
  background: radial-gradient(circle at 50% 50%, #0c0f14, #040507);
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.8;
  mix-blend-mode: screen;
  transition: background 2s ease-in-out;
}

.blob-1 {
  top: -10%;
  left: -10%;
  width: 60vw;
  height: 60vw;
  background: var(--blob-color-1);
  animation: float-1 25s infinite alternate ease-in-out;
}

.blob-2 {
  bottom: -20%;
  right: -10%;
  width: 70vw;
  height: 70vw;
  background: var(--blob-color-2);
  animation: float-2 30s infinite alternate ease-in-out;
}

.blob-3 {
  top: 40%;
  left: 30%;
  width: 50vw;
  height: 50vw;
  background: var(--blob-color-3);
  animation: float-3 20s infinite alternate ease-in-out;
}

@keyframes float-1 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(20%, 15%) scale(1.15); }
}

@keyframes float-2 {
  0% { transform: translate(0, 0) scale(1.1); }
  100% { transform: translate(-15%, -20%) scale(0.9); }
}

@keyframes float-3 {
  0% { transform: translate(0, 0) rotate(0deg); }
  100% { transform: translate(10%, -10%) rotate(180deg); }
}

/* ==========================================================================
   Header Component
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(8, 10, 15, 0.4);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--glass-border);
  padding: 0.75rem 0;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 1.5rem;
  box-sizing: border-box;
}

.header-left h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-alerts {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 1rem;
  vertical-align: middle;
}

.header-alert-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  padding: 0;
}

.header-alert-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

/* Tab Switcher navigation */
.app-tabs {
  display: flex;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  padding: 0.25rem;
  border-radius: 30px;
}

.tab-btn {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.5rem 1.25rem;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  background: var(--color-accent);
  color: #f3f4f6;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(255, 159, 10, 0.25);
}

.tab-icon {
  width: 16px;
  height: 16px;
}

/* Header Right - Clocks HUD */
.header-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.clocks {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.2s ease;
}

.clocks:hover {
  opacity: 0.8;
}

.clock-date {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.clock-times {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.clock-item {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.clock-val {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: 0.5px;
  white-space: nowrap;
}


.clock-divider {
  width: 1px;
  height: 20px;
  background: var(--glass-border);
}

.controls-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.controls-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.last-refreshed {
  position: fixed;
  bottom: 1rem;
  right: 1.25rem;
  z-index: 999;
  font-size: 0.6rem;
  color: var(--text-muted);
  opacity: 0.5;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.refresh-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--text-main);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.refresh-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--glass-border-hover);
}

.refresh-icon.spinning {
  animation: spin 1s infinite linear;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes wx-strike-fade {
  0%   { opacity: 1; transform: scale(1.4); }
  30%  { opacity: 0.9; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.4); }
}

/* ==========================================================================
   Layout Containers
   ========================================================================== */
.app-main {
  padding: 1.5rem;
  max-width: 1600px;
  margin: 0 auto;
  min-height: calc(100vh - 120px);
}

.tab-panel {
  display: none;
  width: 100%;
}

.tab-panel.active {
  display: block;
}

.tab-panel.flex-panel {
  display: flex;
  height: calc(100vh - 140px);
}

/* ==========================================================================
   Glassmorphic Cards
   ========================================================================== */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: var(--glass-shadow);
  transition: border-color 0.3s ease;
}

.glass-card:hover {
  border-color: var(--glass-border-hover);
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Divider inside card */
.border-top-divider {
  border-top: 1px solid var(--glass-border);
  margin-top: 1rem;
  padding-top: 1rem;
}

.border-bottom-divider {
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 1rem;
  padding-bottom: 1rem;
}

/* ==========================================================================
   Tab 1: Weather Grid Layout
   ========================================================================== */
.weather-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 1.5rem;
  align-items: start;
}

.weather-col {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Category Alert Card */
.status-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 1.5rem;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--text-muted);
  box-shadow: 0 0 10px var(--text-muted);
}

.weather-cat-vfr .status-dot { background-color: var(--color-vfr); box-shadow: 0 0 12px var(--color-vfr); }
.weather-cat-mvfr .status-dot { background-color: var(--color-mvfr); box-shadow: 0 0 12px var(--color-mvfr); }
.weather-cat-ifr .status-dot { background-color: var(--color-ifr); box-shadow: 0 0 12px var(--color-ifr); }
.weather-cat-lifr .status-dot { background-color: var(--color-lifr); box-shadow: 0 0 12px var(--color-lifr); }

.status-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.weather-cat-vfr .status-title { color: var(--color-vfr); }
.weather-cat-mvfr .status-title { color: var(--color-mvfr); }
.weather-cat-ifr .status-title { color: var(--color-ifr); }
.weather-cat-lifr .status-title { color: var(--color-lifr); }

.status-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Crosswind Dashboard Card */
.crosswind-card .crosswind-display {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 2rem;
}

.wind-telemetry {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.5rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  padding: 1.25rem;
  border-radius: 8px;
  min-width: 140px;
}

.telemetry-block {
  display: flex;
  flex-direction: column;
}

.telemetry-block .t-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.telemetry-block .t-val {
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 0.2rem;
}

/* Runway selector button styles */
.runway-selection {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.rwy-selector-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.btn-group {
  display: flex;
  gap: 0.5rem;
}

.rwy-select-btn {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
}

.rwy-select-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.rwy-select-btn.active {
  background: var(--color-accent-dim);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.vector-widget {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wind-dial {
  width: 220px;
  height: 220px;
  flex-shrink: 0;
}

.dial-border {
  fill: none;
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 2px;
}

.dial-center {
  fill: var(--text-main);
}

.dial-helipad {
  fill: rgba(255, 255, 255, 0.05);
  stroke: #ffffff;
  stroke-width: 1.5px;
  opacity: 1;
}

.dial-helipad-circle {
  fill: none;
  stroke: rgba(255, 255, 255, 0.4);
  stroke-width: 1px;
  stroke-dasharray: 2,2;
  opacity: 0.8;
}

.dial-h-label {
  fill: var(--color-accent);
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 800;
  text-anchor: middle;
}

.dial-approach-path {
  stroke: rgba(255, 255, 255, 0.15);
  stroke-width: 1px;
}

.dial-label {
  fill: var(--text-dim);
  font-size: 10px;
  font-weight: 600;
  text-anchor: middle;
}

.dial-label.rwy-lbl {
  fill: var(--color-accent);
  font-size: 8px;
}

.wind-arrow-chevron {
  fill: var(--color-accent);
  filter: drop-shadow(0 0 4px var(--color-accent-dim));
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.vector-stats {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.v-stat {
  display: flex;
  flex-direction: column;
}

.v-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.v-val {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
}

.v-val.alert {
  color: var(--color-lifr);
  text-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

.v-val.tailwind {
  color: var(--color-ifr);
}

.v-sub {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
}

/* Local Weather Warnings */
.alerts-card {
  border: 1px solid rgba(245, 158, 11, 0.3);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.05);
}

.alert-title {
  color: var(--color-ifr);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.alert-pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--color-ifr);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px var(--color-ifr);
  animation: pulse-warning 2s infinite;
}

@keyframes pulse-warning {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(245, 158, 11, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
  }
}

.alert-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.hko-alert-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-left: 4px solid var(--color-ifr);
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  transition: all 0.2s ease-in-out;
}

.hko-alert-item:hover {
  transform: translateY(-2px);
  border-color: rgba(245, 158, 11, 0.4);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15);
}

.hko-alert-icon-container {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 4px;
}

.hko-alert-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.hko-alert-details {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.hko-alert-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 0.025em;
}

.hko-alert-status {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
}


/* ATIS Decoded Details */
.atis-card {
  padding: 0.75rem 0.5rem;
}

.atis-card .card-head-row,
.wx-card .card-head-row,
.radar-card .card-head-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 0.5rem;
  margin-bottom: 0.75rem;
}

.atis-card .card-title,
.wx-card .card-head-row .card-title,
.radar-card .card-head-row .card-title {
  margin-bottom: 0;
}

.atis-tabs {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  padding: 0.2rem;
  border-radius: 6px;
  height: 1.8rem;
  box-sizing: border-box;
}

.atis-tab-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.atis-tab-btn.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.atis-info-grid {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  margin-bottom: 1.25rem;
}

.atis-letter-box {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Dynamic color scheme based on runway active ends */
.atis-letter-box.rwy-07 {
  background: radial-gradient(circle at center, #2e4c80, #1b2e54);
  border: 1px solid #4a74b8;
}

.atis-letter-box.rwy-25 {
  background: radial-gradient(circle at center, #806020, #4d3a12);
  border: 1px solid #b38d3b;
}

.atis-letter-box.rwy-other {
  background: radial-gradient(circle at center, #2e2f30, #151617);
  border: 1px solid var(--glass-border-hover);
}

.atis-letter-box .letter-label {
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  opacity: 0.7;
}

.atis-letter-box .letter-val {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
}

.atis-meta-stats {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

.meta-label {
  color: var(--text-muted);
}

.meta-val {
  font-weight: 500;
}

.meta-val.highlight {
  color: var(--color-accent);
}

.atis-decoded-indicators {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 0;
  min-width: 95px;
}

.atis-badge {
  display: inline-flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.2);
  padding: 0 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--glass-border);
  height: 1.8rem;
  box-sizing: border-box;
  font-size: 0.75rem;
  font-weight: 600;
}

.atis-badge .highlight {
  color: #facc15 !important;
}

.d-ind {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  padding: 0.4rem 0.55rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  flex: 1;
  border-radius: 0;
  min-width: 0;
  overflow: hidden;
}

.atis-decoded-indicators .d-ind:not(:first-child) {
  border-top: none;
}

.atis-decoded-indicators .d-ind:first-child {
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
}

.atis-decoded-indicators .d-ind:last-child {
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
}

.d-ind .d-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.d-ind .d-val {
  font-size: 1.2rem;
  font-weight: 700;
  margin-top: 0.15rem;
  line-height: 1.15;
  white-space: pre-line;
  word-break: break-all;
  overflow-wrap: break-word;
}

.d-ind .d-val.alert {
  color: var(--color-ifr);
}

.atis-notes {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
  margin-bottom: 1.25rem;
}

.atis-note-bubble {
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.03);
  border-left: 2.5px solid var(--text-dim);
  padding: 0.4rem 0.75rem;
  border-radius: 0 4px 4px 0;
}

.atis-note-bubble.warning {
  border-left-color: var(--color-ifr);
  background: rgba(245, 158, 11, 0.05);
}

/* Collapsible Raw Sections */
.raw-expandable {
  margin-top: 0.5rem;
}

.expand-toggle-btn {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.expand-toggle-btn:hover {
  color: var(--text-main);
}

.toggle-arrow {
  font-size: 0.65rem;
}

.raw-text-block {
  background: #020304;
  border: 1px solid var(--glass-border);
  padding: 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  margin-top: 0.5rem;
  max-height: 250px;
  overflow-y: auto;
}

/* METAR TAF grid layout styling */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.wx-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.wx-table th {
  padding: 0.5rem 0.4rem;
  border-bottom: 2px solid var(--glass-border);
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}

.wx-table td {
  padding: 0.45rem 0.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
  font-size: 0.82rem;
}

.metar-row-tr {
  background: rgba(255, 159, 10, 0.04);
  border-left: 3px solid var(--color-accent);
}

.taf-row-tr.past-period {
  opacity: 0.45;
}

.time-range {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.time-range .arrow {
  color: var(--text-dim);
  font-size: 0.75rem;
}

.cloud-stack {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.badge-teal {
  background: rgba(16, 185, 129, 0.15);
  color: var(--color-vfr);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-base {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--glass-border);
}

.badge-tempo {
  background: rgba(245, 158, 11, 0.15);
  color: var(--color-ifr);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-becmg {
  background: rgba(59, 130, 246, 0.15);
  color: var(--color-mvfr);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-prob {
  background: rgba(239, 68, 68, 0.15);
  color: var(--color-lifr);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Visibility colors */
.vis-lifr { color: var(--color-lifr); font-weight: 700; }
.vis-ifr { color: var(--color-ifr); font-weight: 600; }
.vis-mvfr { color: var(--color-mvfr); }
.vis-vfr { color: var(--color-vfr); }

/* METAR/TAF Period Display */
.metar-obs-block {
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.taf-valid-header {
  font-size: 0.78rem;
  color: var(--text-dim);
  padding: 0.4rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.taf-period-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.taf-period-block {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.taf-period-block.active-period {
  border-left: 3px solid var(--color-vfr);
  background: rgba(0,200,200,0.04);
}

.taf-period-block.past-period {
  opacity: 0.45;
}

.taf-type-col {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  align-items: flex-start;
}

.taf-type-subtitle {
  font-size: 0.68rem;
  color: var(--text-dim);
  font-style: italic;
}

.taf-time-col {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: var(--text-main);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.taf-time-period {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
  white-space: nowrap;
}

.taf-time-sep {
  color: var(--text-dim);
}

.taf-time-end {
  display: inline-flex;
  flex-direction: row;
  align-items: baseline;
  line-height: 1;
  gap: 0.3rem;
}

.taf-next-day {
  font-size: 0.65rem;
  color: var(--text-dim, rgba(255,255,255,0.45));
  letter-spacing: 0.03em;
  line-height: 1.2;
}

.taf-cond-col {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
}

.cond-row-inline {
  display: flex;
  flex-direction: row;
  gap: 1.5rem;
  align-items: center;
}

.cond-item {
  white-space: nowrap;
}

.cond-label {
  color: var(--text-dim);
  font-size: 0.75rem;
  margin-right: 0.2rem;
}

.cloud-low { color: var(--color-lifr); }
.cloud-mid { color: var(--color-ifr); }

@media (max-width: 768px) {
  .taf-period-block {
    grid-template-columns: 1fr;
  }
}

.raw-wx-block {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.raw-segment {
  background: #020304;
  border: 1px solid var(--glass-border);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
}

.raw-title {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.raw-segment p {
  font-size: 0.8rem;
  line-height: 1.5;
}

/* MAP card — Leaflet mini-map replacing static HKO radar image */
.wx-map-instance {
  width: 100%;
  height: 640px;
  border-radius: 0 0 12px 12px;
}

.leaflet-container {
  background: #0a0c10 !important;
  font-family: var(--font-sans) !important;
}

/* Weather layer toggle buttons */
.wx-layer-toggles {
  display: flex;
  gap: 0.35rem;
}

.wx-layer-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.wx-layer-btn svg {
  width: 100%;
  height: 100%;
}

.wx-layer-btn:hover {
  border-color: var(--glass-border-hover);
  color: var(--text-main);
}

.wx-layer-btn.active {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: var(--color-accent-dim);
}

/* Lightning active tints the button amber-gold */
.wx-layer-btn.active[title="Lightning"] {
  border-color: #f59e0b;
  color: #f59e0b;
  background: rgba(245,158,11,0.12);
}

/* Rain active — blue tint */
.wx-layer-btn.active[title="Rain Radar"] {
  border-color: #3b82f6;
  color: #3b82f6;
  background: rgba(59,130,246,0.12);
}

/* Wind active — green tint */
.wx-layer-btn.active[title="Wind"] {
  border-color: #10b981;
  color: #10b981;
  background: rgba(16,185,129,0.12);
}

/* HKO radar image container (kept for any legacy reference) */
.radar-image-container {
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--glass-border);
  background: #000;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.radar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.95;
  filter: contrast(1.1) brightness(0.9);
}

.radar-overlay-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  padding: 0.4rem 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

.loading-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 0;
  color: var(--text-muted);
  gap: 1rem;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.05);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 1s infinite linear;
}

/* ==========================================================================
   Tab 2: Map Dashboard Layout
   ========================================================================== */
.map-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  width: 100%;
  height: 100%;
  gap: 1rem;
}

.map-sidebar {
  display: flex;
  flex-direction: column;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  height: 100%;
  overflow: hidden;
}

.sidebar-section {
  padding: 1rem;
}

.flex-scroll-section {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  color: var(--text-main);
}

.sidebar-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.notam-textarea {
  width: 100%;
  height: 120px;
  background: #020304;
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  padding: 0.5rem;
  color: var(--text-main);
  font-size: 0.75rem;
  line-height: 1.4;
  resize: none;
  margin-bottom: 0.5rem;
  outline: none;
}

.notam-textarea:focus {
  border-color: var(--color-accent);
}

.primary-btn {
  width: 100%;
  background: var(--color-accent);
  color: #050608;
  font-family: var(--font-sans);
  font-weight: 600;
  padding: 0.6rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.primary-btn:hover {
  box-shadow: 0 4px 12px rgba(180, 255, 50, 0.3);
  opacity: 0.9;
}

.section-subtitle {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.notam-source-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  text-transform: none;
  letter-spacing: 0.03em;
  border: 1px solid transparent;
  transition: background 0.3s ease;
}
.notam-source-badge.live {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.4);
  color: #86efac;
}
.notam-source-badge.preloaded {
  background: rgba(234, 179, 8, 0.12);
  border-color: rgba(234, 179, 8, 0.35);
  color: #fde68a;
}

/* NOTAM Sidebar cards list */
.notam-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.notam-update-time {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--glass-border);
}

.notam-filter-bar {
  display: flex;
  gap: 0.3rem;
}

.notam-filter-pill {
  padding: 0.25rem 0.5rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.18s ease;
}

.notam-filter-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border-color: var(--glass-border-hover);
}

.notam-filter-pill.active {
  background: var(--color-accent-dim);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.notam-cards-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.notam-card-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.notam-card-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--glass-border-hover);
}

.notam-card-item.selected {
  background: var(--color-accent-dim);
  border-color: var(--color-accent);
}

.notam-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}

.notam-id {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-main);
}

.notam-badge {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.notam-badge.danger { background: rgba(239, 68, 68, 0.15); color: var(--color-lifr); }
.notam-badge.warning { background: rgba(245, 158, 11, 0.15); color: var(--color-ifr); }
.notam-badge.info { background: rgba(59, 130, 246, 0.15); color: var(--color-mvfr); }

.notam-card-summary {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: 0.2rem;
}

.notam-card-body-snippet {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.notam-card-footer {
  margin-top: 0.4rem;
}

.geo-coord-badge {
  display: inline-block;
  font-size: 0.65rem;
  color: var(--color-accent);
  background: var(--color-accent-dim);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-weight: 600;
}

/* Map Frame and Canvas */
.map-container-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

.map-instance {
  width: 100%;
  height: 100%;
  background-color: #0c0f14;
}

/* HUD Overlay on Map */
.map-hud-overlay {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  width: 200px;
  padding: 0.75rem;
  background: rgba(10, 12, 16, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  box-shadow: var(--glass-shadow);
}

.hud-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 0.35rem;
  margin-bottom: 0.5rem;
}

.hud-control-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.hud-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-main);
  user-select: none;
}

.hud-checkbox-label input {
  accent-color: var(--color-accent);
}

.chk-label.highlight-radar {
  color: var(--color-accent);
  font-weight: 600;
}

/* Customize Leaflet elements to dark mode */
.leaflet-container {
  font-family: var(--font-sans) !important;
}

.leaflet-bar {
  border: 1px solid var(--glass-border) !important;
  box-shadow: var(--glass-shadow) !important;
}

.leaflet-bar a {
  background-color: var(--glass-bg) !important;
  color: var(--text-main) !important;
  border-bottom: 1px solid var(--glass-border) !important;
}

.leaflet-bar a:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
}

/* Map Popups custom glass design */
.leaflet-popup-content-wrapper {
  background: rgba(12, 15, 20, 0.9) !important;
  backdrop-filter: blur(10px) !important;
  border: 1px solid var(--glass-border) !important;
  color: var(--text-main) !important;
  border-radius: 8px !important;
  box-shadow: var(--glass-shadow) !important;
}

.leaflet-popup-content {
  width: auto !important;
  max-width: none !important;
  margin: 12px 16px !important;
}

.leaflet-popup-tip {
  background: rgba(12, 15, 20, 0.9) !important;
  border: 1px solid var(--glass-border) !important;
}

.popup-notam-content {
  font-size: 0.8rem;
  transition: all 0.2s ease;
  width: 420px;
}

.popup-selected .popup-notam-text {
  max-height: 240px; /* 100% increase from 120px */
  font-size: 0.8rem;
}

.popup-notam-title {
  font-weight: 700;
  color: var(--color-ifr);
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
}

.popup-selected .popup-notam-title {
  font-size: 1rem;
}

.popup-notam-text {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.4;
  white-space: pre-wrap;
  max-height: 120px;
  overflow-y: auto;
  background: #020304;
  padding: 0.35rem;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.popup-landing-title {
  font-weight: 700;
  color: var(--color-accent);
  font-size: 0.85rem;
}

.popup-landing-body {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.atis-vector-layout {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: space-between;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.app-footer-info {
  display: flex;
  justify-content: center;
  padding: 1rem;
  font-size: 0.7rem;
  color: var(--text-dim);
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 1024px) {
  .weather-grid {
    grid-template-columns: 1fr;
  }
  
  .map-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 240px 1fr;
  }
  
  .tab-panel.flex-panel {
    height: calc(100vh - 120px);
  }
  
  .map-sidebar {
    height: 240px;
  }
}

@media (max-width: 768px) {
  .app-header {
    background: rgba(8, 10, 15, 0.85) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
  }
  
  body.light-theme .app-header {
    background: rgba(255, 255, 255, 0.9) !important;
  }

  .header-inner {
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    padding: 0 1.25rem;
  }

  .app-main {
    padding: 1.5rem 0.75rem;
  }

  .clocks {
    padding-right: 0;
  }
  
  .clocks .clock-divider {
    display: none;
  }
  
  .clocks.time-mode-L .clock-item-utc {
    display: none;
  }
  
  .clocks.time-mode-Z .clock-item-hkt {
    display: none;
  }
  
  .header-left {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  
  .app-tabs {
    width: 100%;
    align-self: stretch;
    display: flex;
  }
  
  .app-tabs .tab-btn {
    flex: 1;
    justify-content: center;
  }

  .app-tabs .tab-text {
    display: none;
  }
  
  .header-right {
    width: 100%;
    align-self: stretch;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    box-sizing: border-box;
  }

  .atis-vector-layout {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }

  .vector-widget {
    order: 1; /* Helipad SVG on top */
  }
  
  .atis-decoded-indicators:first-of-type {
    order: 2; /* Wind, VIS, QNH row directly below SVG */
  }
  
  .atis-decoded-indicators:last-of-type {
    order: 3; /* Cloud, WX row at the bottom */
  }
  
  .atis-decoded-indicators {
    width: 100%;
    flex-direction: row;
    gap: 0.5rem;
  }
  
  .atis-decoded-indicators .d-ind {
    flex: 1;
    border-radius: 6px !important;
    border: 1px solid var(--glass-border) !important;
  }
  
  .wind-telemetry {
    grid-template-columns: 1fr;
  }
  
  .vector-widget {
    flex-direction: column;
  }
}



/* ==========================================================================
   Light Mode Theme Overrides
   ========================================================================== */
body.light-theme {
  --bg-color: #f1f5f9;
  --text-main: #0f172a;
  --text-muted: #334155;
  --text-dim: #64748b;
  
  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(15, 23, 42, 0.08);
  --glass-border-hover: rgba(15, 23, 42, 0.16);
  --glass-shadow: 0 8px 32px 0 rgba(15, 23, 42, 0.06);

  --color-accent: #1d4ed8; /* Premium high-contrast blue for light mode */
  --color-accent-dim: rgba(29, 78, 216, 0.08);

  --blob-color-1: rgba(29, 78, 216, 0.04);
  --blob-color-2: rgba(59, 130, 246, 0.04);
  --blob-color-3: rgba(16, 185, 129, 0.04);
}

body.light-theme .mesh-bg {
  background: radial-gradient(circle at 50% 50%, #f8fafc, #cbd5e1);
}

body.light-theme .app-header {
  background: rgba(255, 255, 255, 0.5);
  border-bottom-color: var(--glass-border);
}

body.light-theme .tab-btn.active {
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(29, 78, 216, 0.25);
}

body.light-theme .theme-toggle-btn,
body.light-theme .refresh-btn {
  background: rgba(15, 23, 42, 0.04);
  color: #0f172a;
  border-color: var(--glass-border);
}

body.light-theme .theme-toggle-btn:hover,
body.light-theme .refresh-btn:hover {
  background: rgba(15, 23, 42, 0.08);
  border-color: var(--glass-border-hover);
}

body.light-theme .raw-text-block,
body.light-theme .raw-segment,
body.light-theme .notam-textarea,
body.light-theme .popup-notam-text {
  background: #f8fafc;
  color: #0f172a;
  border-color: var(--glass-border);
}

body.light-theme .atis-tab-btn.active {
  background: rgba(15, 23, 42, 0.06);
  color: #0f172a;
}

body.light-theme .atis-badge,
body.light-theme .d-ind {
  background: rgba(15, 23, 42, 0.04);
}

body.light-theme .atis-badge .highlight {
  color: #2563eb !important;
}

body.light-theme .hko-alert-item {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(15, 23, 42, 0.05);
}

body.light-theme .hko-alert-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

body.light-theme .atis-note-bubble {
  background: rgba(15, 23, 42, 0.03);
}

body.light-theme .leaflet-popup-content-wrapper,
body.light-theme .leaflet-popup-tip {
  background: rgba(255, 255, 255, 0.95) !important;
  color: #0f172a !important;
  border: 1px solid var(--glass-border) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1) !important;
}

body.light-theme .leaflet-popup-close-button {
  color: #64748b !important;
}

body.light-theme .dial-border {
  stroke: rgba(15, 23, 42, 0.08);
}
body.light-theme .dial-center {
  fill: #0f172a;
}
body.light-theme .dial-approach-path {
  stroke: rgba(15, 23, 42, 0.1);
}
body.light-theme .dial-helipad {
  fill: rgba(0, 0, 0, 0.03);
  stroke: rgba(15, 23, 42, 0.2);
}
body.light-theme .dial-helipad-circle {
  stroke: rgba(15, 23, 42, 0.2);
}
body.light-theme .dial-label {
  fill: #475569;
}
body.light-theme .wind-arrow-chevron {
  filter: drop-shadow(0 0 4px rgba(29, 78, 216, 0.2));
}

body.light-theme .map-hud-overlay {
  background: rgba(255, 255, 255, 0.85);
}

/* Theme Toggle Button Style */
.theme-toggle-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  margin-right: 0.25rem;
}

.theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--glass-border-hover);
}

.theme-icon {
  width: 16px;
  height: 16px;
}

