/* GeoSphere Austria Native Explorer — layered on /www/native-explorer.css */

#geosphere-app {
  --geosphere-accent: #0c4a6e;
  --geosphere-accent-soft: #e0f2fe;
  --geosphere-tawes: #059669;
  --geosphere-combined: #0284c7;
  --geosphere-individual: #64748b;
  --geosphere-selected: #f59e0b;
  --ce-tabs-shell-bg: #ffffff;
  --ce-tabs-shell-border: #dbe4ef;
  --ce-chart-card-padding: 1rem 1.05rem;
}

#geosphere-app .geosphere-lang-group,
#geosphere-app .geosphere-res-group {
  flex-wrap: wrap;
}

#geosphere-app .ce-quick-jump-strip {
  flex: 1 1 580px;
}

#geosphere-app .ce-btn-primary {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

#geosphere-app .ce-btn-secondary {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #cbd5e1;
}

#geosphere-app .ce-btn-neutral {
  background: #ffffff;
  color: #374151;
  border: 1px solid #cbd5e1;
}

#geosphere-app .ce-btn-sm {
  min-height: 32px;
  padding: 0.22rem 0.65rem;
  font-size: 0.79rem;
}

#geosphere-app .ce-btn-link {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  color: #0369a1;
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

@media (hover: hover) {
  #geosphere-app .ce-btn-primary:hover:not(:disabled) {
    background: #1e293b;
    border-color: #1e293b;
  }

  #geosphere-app .ce-btn-secondary:hover:not(:disabled) {
    background: #f1f5f9;
  }

  #geosphere-app .ce-btn-neutral:hover:not(:disabled) {
    background: #f3f4f6;
    color: #111827;
    border-color: #94a3b8;
  }

  #geosphere-app .ce-btn-link:hover {
    text-decoration: underline;
  }
}

#geosphere-app .geosphere-date-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

#geosphere-app .geosphere-date-pair input[type="date"] {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 0.42rem 0.6rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font: inherit;
  font-size: 0.9rem;
  color: #0f172a;
  background: #ffffff;
}

#geosphere-app .geosphere-normals-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid #dbe4ef;
  border-radius: 10px;
  background: #f8fafc;
}

#geosphere-app .geosphere-normals-toolbar[hidden] {
  display: none !important;
}

#geosphere-app .geosphere-normals-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

/* Map stage & explicit canvas height */
#geosphere-app .ce-map-wrap {
  position: relative;
  width: 100%;
  min-height: 460px;
  height: 540px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #dbe4ef;
  background: #e2e8f0;
}

#geosphere-app .ce-map-wrap.is-globe {
  background: radial-gradient(circle at 50% 42%, #0f2942 0%, #071422 72%, #030a12 100%);
}

#geosphere-app .ce-map-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#geosphere-app .ce-map-loading {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 4;
  background: rgba(248, 250, 252, 0.72);
  color: #0f172a;
  font-size: 0.9rem;
  font-weight: 600;
}

#geosphere-app .ce-map-loading.is-visible {
  display: flex;
}

#geosphere-map-panel.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1200;
  margin: 0;
  padding: 0.75rem;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

#geosphere-map-panel.is-fullscreen .ce-map-wrap {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
}

/* Map legend (bottom-left horizontal matching KNMI / MeteoSwiss) */
#geosphere-app .geosphere-map-legend-wrap {
  position: absolute;
  left: 12px;
  bottom: 12px;
  right: auto;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  max-width: calc(100% - 64px);
}

#geosphere-app .geosphere-legend-toggle {
  appearance: none;
  border: 1px solid rgba(15, 23, 42, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #0f172a;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.28rem 0.68rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}

#geosphere-app .geosphere-legend-card {
  width: 100%;
  padding: 0.55rem 0.72rem;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  background: rgba(255, 255, 255, 0.94);
  color: #0f172a;
  font-size: 0.78rem;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.14);
  backdrop-filter: blur(6px);
}

#geosphere-app .geosphere-legend-card[hidden] {
  display: none !important;
}

#geosphere-app .geosphere-legend-title {
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #334155;
  margin-bottom: 0.35rem;
}

#geosphere-app .geosphere-legend-items {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
}

#geosphere-app .geosphere-legend-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  line-height: 1.25;
}

#geosphere-app .geosphere-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex: 0 0 10px;
  border: 1.5px solid #ffffff;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.22);
}

#geosphere-app .geosphere-swatch-tawes {
  background: var(--geosphere-tawes);
}

#geosphere-app .geosphere-swatch-combined {
  background: var(--geosphere-combined);
}

#geosphere-app .geosphere-swatch-individual {
  background: var(--geosphere-individual);
}

#geosphere-app .geosphere-swatch-selected {
  background: var(--geosphere-selected);
  box-shadow: 0 0 0 2px #0f172a;
}

#geosphere-app .geosphere-chip-text {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.4rem;
}

#geosphere-app .geosphere-chip-meta {
  font-size: 0.82rem;
  color: #475569;
}

/* Dashboard header, provenance & toolbars */
#geosphere-app .geosphere-station-header-main {
  flex: 1 1 320px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#geosphere-app .geosphere-station-header-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.45rem 0.75rem;
}

#geosphere-station-heading,
#geosphere-app .geosphere-station-title {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 700;
  color: #0f172a;
  border-bottom: none;
  padding-bottom: 0;
}

#geosphere-app .ce-banner-meta {
  font-size: 0.83rem;
  color: #475569;
  margin: 0.22rem 0 0;
  line-height: 1.4;
}

#geosphere-app .geosphere-station-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

#geosphere-app .geosphere-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #1e293b;
}

#geosphere-app .geosphere-badge--tawes {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}

#geosphere-app .geosphere-badge--combined {
  background: #f0f9ff;
  color: #075985;
  border-color: #7dd3fc;
}

#geosphere-app .geosphere-badge--individual {
  background: #f8fafc;
  color: #334155;
  border-color: #cbd5e1;
}

#geosphere-app .geosphere-badge--active {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}

#geosphere-app .geosphere-badge--hist {
  background: #f1f5f9;
  color: #475569;
  border-color: #cbd5e1;
}

#geosphere-app .geosphere-badge--normals {
  background: #f5f3ff;
  color: #2e1065;
  border-color: #d8b4fe;
}

#geosphere-app .ce-kpi-sub {
  margin-top: 0.22rem;
  font-size: 0.8rem;
  color: #475569;
  line-height: 1.35;
}

#geosphere-app .ce-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 0.25rem;
}

#geosphere-app .geosphere-heading-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

#geosphere-app .badge-purple-soft {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.24rem 0.65rem;
  border-radius: 999px;
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
  color: #2e1065;
  font-size: 0.78rem;
  font-weight: 700;
}

#geosphere-app .realtime-banner-purple {
  margin-bottom: 0.75rem;
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  border: 1px solid #ddd6fe;
  border-left: 4px solid #6d28d9;
  background: #faf5ff;
  color: #1e1b4b;
  font-size: 0.88rem;
  line-height: 1.45;
}

#geosphere-app .realtime-banner-purple[hidden],
#geosphere-app .badge-purple-soft[hidden] {
  display: none !important;
}

#geosphere-app .geosphere-panel-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}

#geosphere-app .geosphere-section-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
}

#geosphere-app .geosphere-section-sub {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
}

/* Staged progress bar */
#geosphere-app .ce-loading-banner.is-progress {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
}

#geosphere-app .ce-loading-banner.is-error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

#geosphere-app .ce-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-weight: 600;
}

#geosphere-app .ce-progress-pct {
  font-variant-numeric: tabular-nums;
  font-size: 0.84rem;
  color: #0369a1;
}

#geosphere-app .ce-progress-track {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

#geosphere-app .ce-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0284c7 0%, #0ea5e9 100%);
  transition: width 180ms ease-out;
}

/* Charts grid — container query strictly on .ce-charts-grid */
#geosphere-app .ce-charts-grid {
  container: ce-charts / inline-size;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

#geosphere-app .ce-chart-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: var(--ce-chart-card-padding);
  border: 1px solid #dbe4ef;
  border-radius: 12px;
  background: #ffffff;
  min-width: 0;
}

#geosphere-app .ce-chart-card.is-wide,
#geosphere-app .ce-chart-card--wide {
  grid-column: 1 / -1;
}

#geosphere-app .ce-chart-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
}

#geosphere-app .ce-chart-card-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  color: #0f172a;
}

#geosphere-app .ce-chart-card-sub {
  margin: 0.18rem 0 0;
  font-size: 0.82rem;
  color: #475569;
  line-height: 1.4;
}

#geosphere-app .geosphere-chart-export-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  appearance: none;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #f8fafc;
  color: #1e293b;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.25rem 0.62rem;
  cursor: pointer;
}

#geosphere-app .geosphere-chart-export-btn.is-saved {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #065f46;
}

#geosphere-app .geosphere-chart-canvas {
  width: 100%;
  height: 360px;
  min-height: 280px;
  position: relative;
}

#geosphere-app .ce-chart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  padding: 1rem;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  color: #475569;
  font-size: 0.88rem;
  text-align: center;
}

#geosphere-app .ce-windrose-host {
  width: 100%;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#geosphere-app .ce-windrose-host svg {
  max-width: 100%;
  height: auto;
}

/* Normals summary table host & homogeneity note */
#geosphere-app .geosphere-normals-tables {
  margin: 0.5rem 0 1rem;
}

#geosphere-app .geosphere-normals-tables[hidden],
#geosphere-app .geosphere-homogeneity-note[hidden] {
  display: none !important;
}

#geosphere-app .geosphere-homogeneity-note {
  margin: 0 0 1rem;
  padding: 0.72rem 0.95rem;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #0284c7;
  background: #f8fafc;
  color: #334155;
  font-size: 0.85rem;
  line-height: 1.5;
}

#geosphere-app .geosphere-homogeneity-note a {
  color: #0369a1;
  font-weight: 600;
}

/* Sortable tables */
#geosphere-app .ce-sort-btn {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  font-weight: 700;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  text-align: left;
}

#geosphere-app .ce-sort-btn[aria-sort="ascending"],
#geosphere-app .ce-sort-btn[aria-sort="descending"] {
  color: #0c4a6e;
}

/* Popup card inside MapLibre */
#geosphere-app .geosphere-popup-card {
  min-width: 215px;
  max-width: 280px;
  color: #0f172a;
}

#geosphere-app .geosphere-popup-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #0369a1;
  margin-bottom: 0.15rem;
}

#geosphere-app .geosphere-popup-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
}

#geosphere-app .geosphere-popup-sub {
  margin: 0.12rem 0 0.45rem;
  font-size: 0.78rem;
  color: #475569;
}

#geosphere-app .geosphere-popup-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.32rem 0.55rem;
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
}

#geosphere-app .geosphere-popup-stats dt {
  color: #64748b;
  font-weight: 600;
}

#geosphere-app .geosphere-popup-stats dd {
  margin: 0;
  color: #0f172a;
  font-weight: 600;
}

#geosphere-app .geosphere-popup-note {
  margin: 0 0 0.48rem;
  font-size: 0.75rem;
  color: #475569;
}

#geosphere-app .geosphere-popup-jump {
  width: 100%;
}

/* Info cards & cross-explorer link */
#geosphere-app .ce-info-card {
  padding: 0.9rem 1rem;
  border: 1px solid #dbe4ef;
  border-radius: 12px;
  background: #ffffff;
}

#geosphere-app .ce-info-card h3 {
  margin: 0 0 0.55rem;
  font-size: 0.96rem;
  font-weight: 700;
  color: #0f172a;
}

#geosphere-app .ce-info-dl {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.36rem 0.8rem;
  margin: 0;
  font-size: 0.85rem;
}

#geosphere-app .ce-info-dl dt {
  color: #475569;
  font-weight: 600;
}

#geosphere-app .ce-info-dl dd {
  margin: 0;
  color: #0f172a;
  word-break: break-word;
}

#geosphere-app .ce-info-links,
#geosphere-app .ce-crosswalk-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.55rem;
  margin-top: 0.15rem;
}

#geosphere-app .ce-crosswalk-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.62rem;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #0369a1;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  line-height: 1.25;
}

@media (hover: hover) {
  #geosphere-app .ce-crosswalk-link:hover {
    background: #eff6ff;
    border-color: #7dd3fc;
    color: #0c4a6e;
  }
}

@media (hover: hover) {
  #geosphere-app .geosphere-chart-export-btn:hover,
  #geosphere-app .geosphere-legend-toggle:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
  }
}

@container ce-charts (max-width: 520px) {
  #geosphere-app .ce-chart-card {
    padding: 0.8rem 0.78rem;
  }

  #geosphere-app .geosphere-chart-canvas {
    height: 300px;
  }
}

@media (max-width: 768px) {
  #geosphere-app .ce-info-grid {
    grid-template-columns: 1fr;
  }

  #geosphere-app .ce-map-wrap {
    min-height: 400px;
    height: 440px;
  }

  #geosphere-app .geosphere-map-legend-wrap {
    left: 8px;
    bottom: 10px;
    right: auto;
    max-width: calc(100% - 56px);
  }

  #geosphere-app .geosphere-date-pair {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  #geosphere-app .ce-progress-fill {
    transition: none;
  }
}

@media (forced-colors: active) {
  #geosphere-app .ce-chart-card,
  #geosphere-app .geosphere-legend-card,
  #geosphere-app .geosphere-legend-toggle,
  #geosphere-app .geosphere-chart-export-btn,
  #geosphere-app .ce-info-card,
  #geosphere-app .geosphere-badge,
  #geosphere-app .ce-crosswalk-link {
    border: 1px solid CanvasText;
    background: Canvas;
    color: CanvasText;
  }

  #geosphere-app .geosphere-legend-swatch {
    forced-color-adjust: none;
  }
}
