/* Base Reset & Variables */
:root {
  --bg-primary: #070B14;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-card-hover: rgba(51, 65, 85, 0.8);
  --border-subtle: rgba(148, 163, 184, 0.15);
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --text-dim: #64748B;
  --accent-sky: #38BDF8;
  --accent-emerald: #34D399;
  --accent-amber: #FBBF24;
  --accent-rose: #FB7185;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.screen-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 2.5rem 3.5rem;
  max-width: 1920px;
  margin: 0 auto;
  width: 100%;
}

.content-narrow {
  max-width: 1000px;
}

/* Header */
.tv-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
}

.locality {
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #FFFFFF;
}

.region {
  font-size: clamp(1rem, 1.5vw, 1.35rem);
  color: var(--text-muted);
  font-weight: 400;
}

.clock {
  font-size: clamp(2.5rem, 4.5vw, 4rem);
  font-weight: 300;
  letter-spacing: 0.05em;
  font-variant-numeric: tabular-nums;
  color: #FFFFFF;
  text-align: right;
}

.timezone-badge {
  font-size: 0.85rem;
  color: var(--text-dim);
  text-align: right;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Status Banner */
.status-banner {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #FDE68A;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.1rem;
}

.status-banner.hidden {
  display: none;
}

.status-banner.error {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #FECACA;
}

/* Main Layout */
.tv-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.current-hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 2.5rem;
  align-items: stretch;
}

/* Hero Left: Big Temp & Conditions */
.hero-left {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 24px;
  padding: 3rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  backdrop-filter: blur(16px);
}

.temp-row {
  display: flex;
  align-items: flex-start;
  line-height: 1;
}

.big-temp {
  font-size: clamp(6.5rem, 14vw, 11rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  color: #FFFFFF;
}

.temp-unit {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 300;
  color: var(--accent-sky);
  margin-left: 0.25rem;
  margin-top: 1rem;
}

.condition-label {
  font-size: clamp(1.8rem, 3.2vw, 2.75rem);
  font-weight: 500;
  color: #E2E8F0;
  margin-top: 0.5rem;
  margin-bottom: 2rem;
}

.hero-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.metric-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  padding: 0.6rem 1.25rem;
  border-radius: 9999px;
  font-size: 1.15rem;
  color: var(--text-muted);
}

.metric-pill strong {
  color: #FFFFFF;
  font-weight: 600;
}

/* Hero Right: Rain & Tomorrow Cards */
.hero-right {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.rain-card, .tomorrow-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 2rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  backdrop-filter: blur(16px);
}

.card-title {
  font-size: 1.15rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 1rem;
}

.rain-details {
  display: flex;
  align-items: center;
  justify-content: space-around;
  margin: 0.5rem 0;
}

.rain-col {
  text-align: center;
}

.rain-value {
  display: block;
  font-size: 2.8rem;
  font-weight: 700;
  color: #FFFFFF;
}

.rain-value small {
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--accent-sky);
}

.rain-caption {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.rain-divider {
  width: 1px;
  height: 48px;
  background: var(--border-subtle);
}

.rain-note {
  font-size: 0.85rem;
  color: var(--text-dim);
  text-align: center;
  margin-top: 0.5rem;
}

.tomorrow-body {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tomorrow-cond {
  font-size: 1.6rem;
  font-weight: 500;
  color: #FFFFFF;
  max-width: 60%;
}

.tomorrow-temps {
  font-size: 2.4rem;
  font-weight: 700;
}

.t-max {
  color: #FFFFFF;
}

.t-sep {
  color: var(--text-dim);
  margin: 0 0.25rem;
}

.t-min {
  color: var(--text-muted);
  font-weight: 400;
}

/* Timeline: Next Hours */
.timeline-section {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 2rem;
  backdrop-filter: blur(16px);
}

.section-title {
  font-size: 1.15rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.hourly-track {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 1rem;
}

.hourly-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 1.25rem 0.75rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.hourly-item .hour {
  font-size: 1.1rem;
  color: var(--text-muted);
  font-weight: 500;
}

.hourly-item .hour-temp {
  font-size: 1.6rem;
  font-weight: 700;
  color: #FFFFFF;
}

.hourly-item .hour-cond {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.hourly-item .hour-rain {
  font-size: 0.85rem;
  color: var(--accent-sky);
  font-weight: 600;
}

/* Multisource Section & Shadow Consensus */
.multisource-section {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 2.25rem;
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.multisource-header {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.title-with-pill {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.title-with-pill .section-title {
  margin-bottom: 0;
}

.shadow-pill {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: var(--accent-sky);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  letter-spacing: 0.03em;
}

.multisource-sub {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.4;
}

/* Consensus Box */
.consensus-box {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 16px;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.consensus-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.cons-left-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.box-label {
  font-size: 1.2rem;
  font-weight: 600;
  color: #FFFFFF;
}

.box-model-tag {
  font-size: 0.85rem;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.badge-insufficient {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #FDE68A;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  letter-spacing: 0.05em;
}

.badge-sufficient {
  background: rgba(52, 211, 153, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.4);
  color: #A7F3D0;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
}

.consensus-metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.cons-col {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
}

.cons-val {
  display: block;
  font-size: 1.8rem;
  font-weight: 700;
  color: #FFFFFF;
  margin-bottom: 0.25rem;
}

.cons-val.rain-yes {
  color: var(--accent-sky);
}

.cons-val.rain-no {
  color: var(--text-muted);
}

.cons-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.cons-explanation {
  font-size: 0.95rem;
  color: #CBD5E1;
  line-height: 1.5;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border-left: 3px solid var(--accent-sky);
}

/* Comparison Container & Grid */
.comparison-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.subsection-title {
  font-size: 1.1rem;
  color: var(--text-muted);
  font-weight: 600;
}

.comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}

.model-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.model-card:hover {
  border-color: rgba(148, 163, 184, 0.35);
  transform: translateY(-2px);
}

.model-card.role-primary_operational {
  border-color: rgba(56, 189, 248, 0.4);
  background: rgba(56, 189, 248, 0.05);
}

.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.card-name {
  font-size: 1rem;
  font-weight: 600;
  color: #FFFFFF;
}

.card-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.card-badge.badge-primary {
  background: rgba(56, 189, 248, 0.2);
  color: var(--accent-sky);
  border: 1px solid rgba(56, 189, 248, 0.5);
}

.card-badge.available {
  background: rgba(52, 211, 153, 0.15);
  color: #A7F3D0;
}

.card-badge.disabled_shadow {
  background: rgba(100, 116, 139, 0.2);
  color: #94A3B8;
}

.card-badge.credentials_required {
  background: rgba(239, 68, 68, 0.15);
  color: #FCA5A5;
}

.card-temp-main {
  font-size: 2rem;
  font-weight: 700;
  color: #FFFFFF;
}

.card-cond-text {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.card-bottom-metrics {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.9rem;
}

.card-rain {
  font-weight: 600;
  color: #FFFFFF;
}

.card-prob {
  color: var(--accent-sky);
  font-size: 0.8rem;
}

.card-notes {
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.3;
}

/* Skeleton Cards */
.skeleton-card {
  min-height: 180px;
  background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

/* Skeleton Loading */
.skeleton {
  min-height: 120px;
  background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Footer */
.tv-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 1rem;
  color: var(--text-dim);
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.model-badge {
  color: var(--text-muted);
}

.freshness-indicator {
  color: var(--accent-emerald);
}

.freshness-indicator.stale {
  color: var(--accent-amber);
}

.freshness-indicator.error {
  color: var(--accent-rose);
}

.sources-link, .btn-back {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.sources-link:hover, .btn-back:hover {
  color: #FFFFFF;
  border-color: var(--border-subtle);
  background: rgba(255, 255, 255, 0.05);
}

/* Sources Page Specific */
.sources-main {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  line-height: 1.6;
}

.info-block {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 2rem;
}

.info-block h2 {
  font-size: 1.4rem;
  color: var(--accent-sky);
  margin-bottom: 1rem;
}

.info-block p {
  color: #CBD5E1;
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

.specs-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 1.1rem;
  color: #CBD5E1;
}

.alert-box {
  background: rgba(56, 189, 248, 0.1);
  border-left: 4px solid var(--accent-sky);
  padding: 1rem 1.25rem;
  border-radius: 4px 8px 8px 4px;
  color: #E0F2FE;
  margin-top: 1rem;
}

.catalog-table-wrap {
  overflow-x: auto;
  margin-top: 1rem;
}

.catalog-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  text-align: left;
}

.catalog-table th, .catalog-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.catalog-table th {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}

.catalog-table td {
  color: #E2E8F0;
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
  .screen-container {
    padding: 1.5rem;
  }
  .current-hero {
    grid-template-columns: 1fr;
  }
  .hero-left {
    padding: 2rem;
  }
}

@media (max-width: 640px) {
  .tv-header {
    flex-direction: column;
    gap: 0.5rem;
  }
  .clock, .timezone-badge {
    text-align: left;
  }
  .hero-metrics {
    flex-direction: column;
  }
  .rain-details {
    flex-direction: column;
    gap: 1rem;
  }
  .rain-divider {
    display: none;
  }
  .multisource-section {
    padding: 1.5rem;
  }
  .consensus-metrics-row {
    grid-template-columns: 1fr 1fr;
  }
}
