/* ============================================================
   RADOME 6 min - Modern Dark Theme
   SVG Map, Glassmorphism, Animations
   ============================================================ */

/* === VARIABLES === */
:root {
  --r-bg: #0a0e1a;
  --r-bg-surface: #0f1628;
  --r-card: rgba(15, 22, 40, 0.85);
  --r-card-border: rgba(58, 125, 255, 0.12);
  --r-glass: rgba(15, 22, 40, 0.6);
  --r-glass-border: rgba(255, 255, 255, 0.08);
  --r-text: #e8ecf7;
  --r-muted: #8ea1c6;
  --r-accent: #3a7dff;
  --r-accent-glow: rgba(58, 125, 255, 0.25);
  --r-red: #ef4444;
  --r-orange: #f97316;
  --r-green: #22c55e;
  --r-cyan: #22d3ee;
  --r-indigo: #6366f1;
  --r-purple: #8b5cf6;
  --r-radius: 18px;
  --r-radius-sm: 12px;
  --r-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

/* === LAYOUT CONTAINER === */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* === HERO === */
.r-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #0a0e1a 0%, #0f1628 30%, #141e3c 60%, #0f1628 100%);
  border-radius: var(--r-radius);
  padding: 3.5rem 2rem 3rem;
  margin-bottom: 2rem;
  text-align: center;
  color: #fff;
  border: 1px solid var(--r-card-border);
}

.r-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 700px 400px at 20% 50%, rgba(58, 125, 255, 0.12) 0%, transparent 70%),
    radial-gradient(ellipse 600px 350px at 80% 30%, rgba(99, 102, 241, 0.08) 0%, transparent 70%),
    radial-gradient(ellipse 400px 400px at 50% 80%, rgba(34, 211, 238, 0.05) 0%, transparent 70%);
  pointer-events: none;
}

.r-hero-wind {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.r-hero-icons {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.r-hero h1 {
  position: relative;
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  margin: 0 0 0.4rem;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff 0%, #c7d2fe 50%, #a5b4fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.r-hero-subtitle {
  position: relative;
  font-size: 1.1rem;
  opacity: 0.8;
  margin-bottom: 1.2rem;
  color: var(--r-muted);
}

.r-hero-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.6rem 1.2rem;
  border-radius: 50px;
  font-size: 0.92rem;
  font-weight: 500;
}

.r-live-dot {
  width: 10px;
  height: 10px;
  background: var(--r-green);
  border-radius: 50%;
  animation: r-pulse 2s ease-in-out infinite;
  box-shadow: 0 0 8px var(--r-green);
}

@keyframes r-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

@keyframes r-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-12px) rotate(3deg); }
}

/* === STAT CARDS === */
.r-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.r-stat-card {
  position: relative;
  background: var(--r-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--r-card-border);
  border-radius: 14px;
  padding: 1rem 0.8rem;
  text-align: center;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.r-stat-card {
  cursor: pointer;
}
.r-stat-card:nth-child(1) { cursor: default; }
.r-stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(58, 125, 255, 0.12);
}
.r-stat-card.hero-flip .r-stat-value,
.r-stat-card.hero-flip .r-stat-detail {
  animation: heroFlip 0.35s ease;
}
@keyframes heroFlip {
  0%   { transform: rotateX(0); opacity: 1; }
  45%  { transform: rotateX(90deg); opacity: 0; }
  55%  { transform: rotateX(-90deg); opacity: 0; }
  100% { transform: rotateX(0); opacity: 1; }
}

.r-stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.r-stat-card:nth-child(1)::before { background: linear-gradient(90deg, var(--r-indigo), var(--r-purple)); }
.r-stat-card:nth-child(2)::before { background: linear-gradient(90deg, var(--r-red), var(--r-orange)); }
.r-stat-card:nth-child(3)::before { background: linear-gradient(90deg, var(--r-cyan), #0ea5e9); }
.r-stat-card:nth-child(4)::before { background: linear-gradient(90deg, var(--r-orange), #fbbf24); }
.r-stat-card:nth-child(5)::before { background: linear-gradient(90deg, #3b82f6, #06b6d4); }

.r-stat-icon {
  width: 38px;
  height: 38px;
  margin: 0 auto 0.5rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.r-stat-icon svg { width: 20px; height: 20px; }

.r-stat-card:nth-child(1) .r-stat-icon { background: rgba(99, 102, 241, 0.12); }
.r-stat-card:nth-child(2) .r-stat-icon { background: rgba(239, 68, 68, 0.12); }
.r-stat-card:nth-child(3) .r-stat-icon { background: rgba(34, 211, 238, 0.12); }
.r-stat-card:nth-child(4) .r-stat-icon { background: rgba(249, 115, 22, 0.12); }
.r-stat-card:nth-child(5) .r-stat-icon { background: rgba(59, 130, 246, 0.12); }

.r-stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 0.2rem;
}

.r-stat-card:nth-child(1) .r-stat-value { color: var(--r-indigo); }
.r-stat-card:nth-child(2) .r-stat-value { color: var(--r-red); }
.r-stat-card:nth-child(3) .r-stat-value { color: var(--r-cyan); }
.r-stat-card:nth-child(4) .r-stat-value { color: var(--r-orange); }
.r-stat-card:nth-child(5) .r-stat-value { color: #3b82f6; }

.r-stat-label {
  font-size: 0.78rem;
  color: var(--r-muted);
  font-weight: 500;
}

.r-stat-detail {
  font-size: 0.72rem;
  color: var(--r-muted);
  opacity: 0.7;
  margin-top: 0.2rem;
  line-height: 1.3;
}

/* === MAP SECTION === */
.r-map-section {
  background: var(--r-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--r-card-border);
  border-radius: var(--r-radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--r-shadow);
}

.r-map-section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(58, 125, 255, 0.1);
}

.r-map-section-header h2 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--r-text);
}

.r-map-section-badge {
  background: linear-gradient(135deg, var(--r-indigo), var(--r-purple));
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 50px;
}

/* Map toolbar */
.r-map-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  color: var(--r-muted);
  font-size: 0.92rem;
}

.r-map-toolbar-label {
  color: var(--r-text);
  font-weight: 500;
  margin-right: 4px;
}

.r-map-toolbar select {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--r-card-border);
  background: rgba(8, 12, 22, 0.85);
  color: var(--r-text);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s;
}

.r-map-toolbar select:focus {
  outline: none;
  border-color: var(--r-accent);
  box-shadow: 0 0 0 3px var(--r-accent-glow);
}

.r-timestamp {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  color: var(--r-muted);
}

/* Map wrapper */
.r-map-wrap {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(8, 13, 24, 0.8);
  border: 1px solid rgba(58, 125, 255, 0.15);
  display: flex;
  justify-content: center;
  align-items: center;
}

.r-map-wrap svg {
  width: 100%;
  max-width: 700px;
  height: auto;
}

.r-map-wrap svg path {
  cursor: pointer;
  transition: fill 0.3s ease;
}

.r-map-wrap svg path:hover {
  filter: brightness(1.15);
  stroke: #fff !important;
  stroke-width: 0.8 !important;
}

/* Map back button */
.r-map-back {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  background: rgba(99, 102, 241, 0.9);
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  display: none;
  align-items: center;
  gap: 0.4rem;
  transition: background 0.2s;
  z-index: 5;
  backdrop-filter: blur(6px);
}

.r-map-back:hover { background: rgba(99, 102, 241, 1); }

/* Tooltip */
.r-map-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(12, 17, 31, 0.95);
  color: var(--r-text);
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(58, 125, 255, 0.35);
  font-size: 0.88rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 20;
  white-space: nowrap;
  max-width: 300px;
  line-height: 1.4;
}

/* === LEGEND === */
.r-map-legend {
  margin-top: 1rem;
  position: relative;
  height: 40px;
}

.r-map-legend .legend-bar {
  display: flex;
  height: 14px;
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.r-map-legend .legend-segment {
  flex: 1;
  min-width: 0;
}

.r-map-legend .legend-labels {
  position: relative;
  height: 20px;
  margin-top: 4px;
}

.r-map-legend .legend-labels span {
  position: absolute;
  transform: translateX(-50%);
  font-size: 0.72rem;
  color: var(--r-muted);
  white-space: nowrap;
}

/* === SEARCH === */
.r-search-section {
  background: var(--r-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--r-card-border);
  border-radius: var(--r-radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.r-search-section h2 {
  margin: 0 0 0.75rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--r-text);
}

.r-search-section label {
  display: block;
  font-size: 0.88rem;
  color: var(--r-muted);
  margin-bottom: 6px;
}

.r-search-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--r-radius-sm);
  border: 1px solid rgba(58, 125, 255, 0.25);
  background: rgba(8, 12, 22, 0.85);
  color: var(--r-text);
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.r-search-input:focus {
  outline: none;
  border-color: var(--r-accent);
  box-shadow: 0 0 0 3px var(--r-accent-glow);
}

.r-search-input::placeholder {
  color: rgba(142, 161, 198, 0.5);
}

.r-search-results {
  margin-top: 10px;
  background: rgba(8, 12, 22, 0.95);
  border-radius: var(--r-radius-sm);
  border: 1px solid rgba(58, 125, 255, 0.2);
  max-height: 280px;
  overflow-y: auto;
}

.r-search-results .search-result {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.15s ease;
}

.r-search-results .search-result:last-child { border-bottom: none; }
.r-search-results .search-result:hover { background: rgba(58, 125, 255, 0.15); }
.r-search-results .search-result strong { display: block; font-weight: 600; color: var(--r-text); }
.r-search-results .search-result span { font-size: 0.84rem; color: var(--r-muted); }

/* === STATION POPUP === */
.station-popup {
  position: fixed;
  top: 40px;
  left: 40px;
  width: min(480px, 94vw);
  max-height: 85vh;
  overflow-y: auto;
  background: rgba(12, 17, 31, 0.96);
  border-radius: var(--r-radius);
  border: 1px solid rgba(58, 125, 255, 0.3);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px);
  z-index: 1000;
  color: var(--r-text);
  transition: opacity 0.2s ease, transform 0.2s ease;
  opacity: 0;
  transform: translateY(10px) scale(0.98);
}

.station-popup.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.station-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px 10px;
  border-bottom: 1px solid rgba(58, 125, 255, 0.15);
  cursor: move;
}

.station-popup-header h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.station-popup-actions {
  display: flex;
  gap: 8px;
}

.icon-button {
  background: rgba(8, 12, 22, 0.85);
  color: var(--r-text);
  border: 1px solid rgba(58, 125, 255, 0.3);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.15s;
  text-decoration: none;
}

.icon-button:hover { background: rgba(58, 125, 255, 0.2); }

.station-popup-content {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.station-popup-temp-block {
  text-align: center;
  padding: 12px 0;
}

.station-popup-temp {
  display: block;
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--r-accent);
}

.station-popup-temp-caption {
  font-size: 0.88rem;
  color: var(--r-muted);
}

.popup-metric-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.popup-metric-card {
  background: rgba(8, 13, 24, 0.9);
  border-radius: var(--r-radius-sm);
  padding: 12px;
  border: 1px solid rgba(58, 125, 255, 0.15);
}

.popup-metric-label {
  display: block;
  font-size: 0.82rem;
  color: var(--r-muted);
  margin-bottom: 4px;
  font-weight: 500;
}

.popup-metric-value {
  display: block;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--r-text);
}

.popup-metric-detail {
  display: block;
  font-size: 0.78rem;
  color: var(--r-muted);
  margin-top: 4px;
  opacity: 0.8;
}

.popup-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px;
}

.popup-tab {
  padding: 6px 12px;
  border-radius: 14px;
  border: 1px solid rgba(58, 125, 255, 0.2);
  background: rgba(8, 12, 22, 0.85);
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--r-muted);
  transition: all 0.15s;
}

.popup-tab:hover { border-color: rgba(58, 125, 255, 0.4); color: var(--r-text); }
.popup-tab.active { background: rgba(58, 125, 255, 0.35); border-color: rgba(58, 125, 255, 0.6); color: #fff; }

.station-popup-body { padding: 0 16px 16px; }

.station-popup-section { margin-bottom: 12px; }
.station-popup-section h3 { margin: 0 0 8px; font-size: 0.92rem; color: var(--r-muted); font-weight: 600; }

.station-popup-list {
  list-style: none;
  padding: 0;
  margin: 0;
  background: rgba(8, 12, 22, 0.85);
  border-radius: var(--r-radius-sm);
  border: 1px solid rgba(58, 125, 255, 0.12);
  overflow: hidden;
}

.station-popup-list li {
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(58, 125, 255, 0.08);
}

.station-popup-list li:last-child { border-bottom: none; }
.station-popup-list li:nth-child(odd) { background: rgba(12, 17, 31, 0.4); }
.station-popup-list li span { color: var(--r-muted); font-size: 0.9rem; }
.station-popup-list li strong { color: var(--r-text); font-weight: 600; font-size: 0.9rem; }

.popup-empty {
  color: var(--r-muted);
  font-style: italic;
  text-align: center;
  padding: 16px;
}

/* Trend */
.station-popup-trend { margin: 8px 0 12px; }
.station-popup-trend-header { display: flex; justify-content: space-between; color: var(--r-muted); font-size: 0.88rem; margin-bottom: 6px; }
.trend-chart { background: rgba(12, 17, 31, 0.6); border: 1px solid rgba(58, 125, 255, 0.12); border-radius: 8px; padding: 8px; }
.trend-chart svg { display: block; width: 100%; height: 140px; }
.station-popup-trend path { stroke: var(--r-accent); stroke-width: 2.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.station-popup-trend circle { fill: #fff; stroke: var(--r-accent); stroke-width: 1.5; }
.station-popup-trend-meta { display: flex; gap: 14px; margin-top: 8px; flex-wrap: wrap; }
.trend-metric { flex: 1; min-width: 100px; }
.trend-metric-label { color: var(--r-muted); font-size: 0.84rem; display: block; margin-bottom: 2px; }
.trend-metric-value { font-weight: 600; display: block; }

/* Obs 6min table */
.scroll-table { max-height: 400px; overflow: auto; border-radius: 10px; border: 1px solid rgba(58, 125, 255, 0.15); background: rgba(8, 13, 24, 0.6); }
table.obs6min-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
table.obs6min-table thead th { position: sticky; top: 0; background: rgba(12, 17, 31, 0.98); color: var(--r-muted); font-weight: 600; text-align: center; padding: 10px 6px; border-bottom: 2px solid rgba(58, 125, 255, 0.25); z-index: 10; white-space: nowrap; font-size: 0.8rem; }
table.obs6min-table thead th:first-child { text-align: left; padding-left: 10px; }
table.obs6min-table td { padding: 7px 6px; border-bottom: 1px solid rgba(58, 125, 255, 0.06); white-space: nowrap; text-align: center; }
table.obs6min-table td:first-child { text-align: left; padding-left: 10px; font-weight: 600; }
table.obs6min-table tbody tr:nth-child(odd) { background: rgba(12, 17, 31, 0.3); }
table.obs6min-table tbody tr:hover { background: rgba(58, 125, 255, 0.12); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 500; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { background: rgba(58, 125, 255, 0.15); border: 1px solid rgba(58, 125, 255, 0.25); border-radius: 12px; padding: 5px 11px; font-size: 0.82rem; color: var(--r-text); }
.chip .count { font-weight: 600; color: var(--r-accent); }
.muted { color: var(--r-muted); font-size: 0.88rem; }

/* === ANIMATIONS === */
.fade-up {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

.fade-up-d1 { transition-delay: 0.1s; }
.fade-up-d2 { transition-delay: 0.2s; }
.fade-up-d3 { transition-delay: 0.3s; }
.fade-up-d4 { transition-delay: 0.4s; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* === RESPONSIVE === */
@media (max-width: 1100px) {
  .r-stats { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 980px) {
  .r-stats { grid-template-columns: repeat(2, 1fr); }
  .r-map-section { padding: 1rem; }
  .r-hero { padding: 2.5rem 1.5rem 2rem; }
}

@media (max-width: 680px) {
  .r-stats { grid-template-columns: 1fr; }
  .r-map-toolbar { flex-direction: column; align-items: flex-start; }
  .r-hero { padding: 2rem 1rem 1.5rem; }
  .r-hero h1 { font-size: 1.8rem; }
  .station-popup {
    position: fixed;
    top: auto !important;
    bottom: 0;
    left: 0 !important;
    right: 0;
    width: 100%;
    max-height: 70vh;
    border-radius: var(--r-radius) var(--r-radius) 0 0;
  }
  .r-map-legend .legend-labels span { font-size: 0.65rem; }
}

/* === SECTION TITLE === */
.r-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--r-muted);
  margin-bottom: 1rem;
}

/* === DECORATIVE SVG CLOUDS IN HERO === */
.r-hero-cloud {
  position: absolute;
  pointer-events: none;
  opacity: 0.06;
}
