@import 'df-styles.css';

/* ── Wetter-specific token overrides ── */
:root {
  --radius: 8px;
  /* map wetter-legacy names to shared dark tokens */
  --card: var(--surface);
  --grid: var(--border);
  --accent: var(--cyan);
  /* weather chart colours (brighter for dark backgrounds) */
  --temperature: #f87171;
  --dewpoint: var(--blue);
  --wind: #34d399;
  --gust: #a78bfa;
  --rain: #38bdf8;
  --warn: var(--amber);
  --error: var(--rose);
}

body { font-size: 14px; }

/* ── App container ── */
#app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 12px 32px;
}

/* ── Tabs (now in topbar via wetter.js, but content area stays) ── */
.tab-btn.tab-warn::after { content: ' ⚠'; color: var(--warn); }
.tab-btn.tab-error::after { content: ' ✕'; color: var(--error); }

.tab-content { padding-top: 16px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Historical Weather link bar ── */
.historical-weather-bar { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; margin-bottom: 10px; }
.historical-weather-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.historical-weather-bar a { font-size: 13px; font-weight: 600; color: var(--accent); text-decoration: none; border-bottom: 1px solid currentColor; }
.historical-weather-bar a:hover { opacity: 0.75; }

/* ── MOSMIX next 24 hours ── */
.mosmix-short { margin-bottom: 12px; }
.mosmix-short-title { margin-bottom: 6px; }

.mosmix-short-track {
  display: flex;
  align-items: stretch;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.mosmix-short-now { color: #f97316; pointer-events: none; }

.mosmix-short-now-before {
  position: relative;
  flex: 0 0 24px;
  min-height: 76px;
}
.mosmix-short-now-before::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0; left: 50%;
  border-left: 2px dashed #f97316;
}

.mosmix-short-now > span {
  position: absolute;
  top: 5px; left: 50%;
  z-index: 1;
  padding: 3px 2px;
  background: #f97316;
  border-radius: 3px;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  transform: translateX(-50%);
}

.mosmix-short-now-inside {
  position: absolute;
  z-index: 2;
  top: 0; bottom: 0;
  left: clamp(8px, var(--mosmix-now-position), calc(100% - 8px));
  border-left: 2px dashed #f97316;
}

.mosmix-short-slot {
  position: relative;
  display: grid;
  grid-template-columns: auto auto;
  grid-template-areas: "time icon" "temperature rain";
  align-items: center;
  gap: 7px 12px;
  min-width: 180px;
  padding: 10px 12px;
  background: var(--surface-solid);
  border: 1px solid var(--grid);
  border-radius: var(--radius);
}

.mosmix-short-time { grid-area: time; color: var(--text-soft); font-size: 12px; font-weight: 700; text-transform: capitalize; }
.mosmix-short-icon { grid-area: icon; justify-self: end; font-size: 27px; line-height: 1; }
.mosmix-short-temperature { grid-area: temperature; display: inline-block; justify-self: start; padding: 3px 6px; border-radius: 4px; font-size: 13px; font-weight: 800; line-height: 1.25; }
.mosmix-short-rain { grid-area: rain; justify-self: end; color: var(--rain); font-size: 12px; font-weight: 700; white-space: nowrap; }

/* ── Graphical daily summaries ── */
.daily-overview { margin-bottom: 12px; }
.daily-overview-title { margin-bottom: 6px; }

.daily-overview-track {
  display: grid;
  grid-template-columns: repeat(var(--daily-card-count), minmax(220px, 1fr));
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.daily-overview-card {
  position: relative;
  min-width: 220px;
  background: var(--surface-solid);
  border: 1px solid var(--grid);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  transition: box-shadow .15s, border-color .15s;
}
.daily-overview-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }

.daily-overview-now {
  position: absolute;
  z-index: 2;
  top: 0; bottom: 0;
  left: clamp(8px, var(--day-now-position), calc(100% - 8px));
  border-left: 2px dashed rgba(249, 115, 22, .85);
  pointer-events: none;
}
.daily-overview-now > span {
  position: absolute;
  top: 7px; left: 0;
  padding: 3px 2px;
  background: #f97316;
  border-radius: 3px;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  transform: translateX(-50%);
}

.daily-overview-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.daily-overview-date { min-width: 0; }
.daily-overview-date strong, .daily-overview-date span { display: block; }
.daily-overview-date strong { font-size: 15px; line-height: 1.25; text-transform: capitalize; }
.daily-overview-date span { margin-top: 2px; color: var(--muted); font: 11px/1.35 'Consolas', 'Courier New', monospace; }
.daily-overview-icon { flex: 0 0 auto; font-size: 36px; line-height: 1; }
.daily-overview-condition { margin: 7px 0 10px; font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.daily-overview-facts { display: grid; gap: 6px; }
.daily-overview-fact { display: grid; grid-template-columns: 22px minmax(0, 1fr); align-items: baseline; gap: 7px; color: var(--text-soft); font-size: 12px; font-weight: 500; line-height: 1.4; }
.daily-overview-fact > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.daily-overview-temperature { display: inline-block; padding: 2px 5px; border-radius: 4px; font-size: 13px; font-weight: 800; line-height: 1.25; }
.daily-overview-key { color: var(--temperature); font-size: 12px; font-weight: 800; text-align: center; }
.daily-overview-key-rain { color: var(--rain); }
.daily-overview-key-sun { color: #fbbf24; font-size: 15px; line-height: 1; transform: scale(var(--sun-scale, 1)); transform-origin: center; }
.daily-overview-key-moon { color: #a78bfa; font-size: 15px; }
.daily-overview-key-wind { color: var(--wind); font-size: 14px; }
.daily-overview-rain { display: inline-flex; align-items: center; gap: 7px; }
.rain-umbrellas { color: var(--rain); font-size: calc(12px * var(--rain-symbol-scale, 1)); line-height: 1; letter-spacing: 1px; white-space: nowrap; }
.rain-umbrellas-none { color: var(--muted); letter-spacing: normal; }

@media (max-width: 700px) {
  .daily-overview-track { grid-template-columns: repeat(var(--daily-card-count), minmax(245px, 78vw)); }
}

/* ── Forecast icon strip ── */
.forecast-strip {
  display: flex;
  gap: 0;
  margin-bottom: 12px;
  background: var(--surface-solid);
  border: 1px solid var(--grid);
  border-radius: var(--radius);
  overflow: hidden;
}

.forecast-section + .forecast-section { border-left: 2px solid var(--grid); }
.forecast-section-label { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 7px 12px 4px; }

.forecast-slots { display: flex; flex-wrap: nowrap; overflow-x: auto; padding: 2px 8px 8px; gap: 2px; scrollbar-width: none; }
.forecast-slots::-webkit-scrollbar { display: none; }

.forecast-slot { display: flex; flex-direction: column; align-items: center; padding: 4px 12px 6px; min-width: 52px; border-radius: 6px; cursor: default; }
.forecast-slot:hover { background: rgba(137, 180, 215, .08); }

.fc-emoji { font-size: 22px; line-height: 1.3; }
.fc-hour { font-size: 10px; color: var(--muted); line-height: 1.3; font-family: 'Consolas', 'Courier New', monospace; }
.fc-temp { font-size: 12px; font-weight: 700; line-height: 1.2; }

/* ── Station header ── */
.station-header { margin-bottom: 16px; cursor: pointer; }
.station-heading-row { display: flex; align-items: center; gap: 9px; }
.station-current-icon { flex: 0 0 auto; font-size: 30px; line-height: 1; }
.station-name { font-size: 20px; font-weight: 700; }

@media (max-width: 500px) {
  .station-heading-row { align-items: flex-start; }
  .station-current-icon { font-size: 26px; margin-top: 1px; }
}

.station-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.source-bar { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 5px; }
.source-chip { font-size: 10px; color: var(--muted); font-family: 'Consolas', 'Courier New', monospace; opacity: 0.75; cursor: default; white-space: nowrap; }
.source-chip:hover { opacity: 1; }

/* ── Metric cards ── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

@media (max-width: 900px) { .metrics-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 500px) { .metrics-grid { grid-template-columns: repeat(2, 1fr); } }

.metric-card {
  background: var(--surface-solid);
  border: 1px solid var(--grid);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
  transition: box-shadow .15s;
}
.metric-card:hover { box-shadow: var(--shadow); }
.metric-title { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.metric-value { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric-value:has(.metric-weather-icon) { display: flex; align-items: center; gap: 7px; }
.metric-weather-icon { flex: 0 0 auto; font-size: 22px; line-height: 1; }

/* ── Chart grid ── */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
@media (max-width: 700px) { .charts-grid { grid-template-columns: 1fr; } }

.chart-card {
  background: var(--surface-solid);
  border: 1px solid var(--grid);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.chart-card canvas { display: block; height: 220px !important; width: 100% !important; }

.chart-full { margin-bottom: 12px; }
.chart-full canvas { height: 180px !important; }

.card-title { font-size: 12px; font-weight: 700; margin-bottom: 8px; cursor: pointer; }
.card-title:hover { color: var(--accent); }

/* ── Daily table section ── */
.card-section {
  background: var(--surface-solid);
  border: 1px solid var(--grid);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 12px;
}

.table-scroll { overflow-x: auto; }

.daily-table { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 600px; }
.daily-table th { background: var(--bg-deep); color: var(--muted); text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--grid); font-weight: 600; white-space: nowrap; }
.daily-table td { padding: 6px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; cursor: pointer; }
.daily-table tr:last-child td { border-bottom: none; }
.daily-table tbody tr:hover { background: var(--surface-hover); }

/* ── Station footer ── */
.station-footer { font-size: 11px; color: var(--muted); line-height: 1.6; word-break: break-all; cursor: pointer; padding: 8px 0 0; }
.station-footer:hover { color: var(--text); }

/* ── Info target cursor ── */
.info-target { cursor: pointer; }

/* ── Floating tooltip ── */
.info-tooltip {
  position: absolute;
  z-index: 9000;
  background: var(--surface-solid);
  color: var(--text-soft);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 13px;
  line-height: 1.5;
  max-width: 360px;
  white-space: pre-wrap;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .4);
  pointer-events: none;
}

/* ── Modal ── */
.info-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.info-modal-content {
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 28px 28px 24px;
  max-width: 620px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .5);
}
.info-modal-close { position: absolute; top: 16px; right: 16px; background: none; border: none; font-size: 18px; cursor: pointer; color: var(--muted); line-height: 1; padding: 2px 6px; border-radius: 4px; }
.info-modal-close:hover { background: var(--surface-hover); color: var(--text); }
.info-modal-title { font-size: 18px; font-weight: 700; margin-bottom: 8px; padding-right: 32px; }
.info-modal-short { color: var(--muted); font-size: 13px; margin-bottom: 16px; border-bottom: 1px solid var(--grid); padding-bottom: 12px; }
.info-modal-details { font-family: 'Segoe UI', system-ui, sans-serif; font-size: 13px; color: var(--text-soft); white-space: pre-wrap; line-height: 1.7; background: var(--bg-deep); border-radius: 6px; padding: 14px 16px; border: 1px solid var(--grid); }

/* ── Loading / error states ── */
.loading { padding: 40px; text-align: center; color: var(--muted); font-size: 15px; }

.error-msg {
  padding: 24px;
  background: rgba(251, 113, 133, .08);
  border: 1px solid rgba(251, 113, 133, .25);
  border-radius: var(--radius);
  color: var(--rose);
  font-size: 13px;
  line-height: 1.6;
}

/* ── Help screen (no station_id) ── */
.help-screen {
  max-width: 560px;
  margin: 60px auto;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--grid);
  border-radius: var(--radius);
}
.help-screen h1 { font-size: 22px; margin-bottom: 16px; }
.help-screen p { margin-bottom: 10px; color: var(--muted); }
.help-screen a { color: var(--accent); }
.help-hint { font-size: 12px; }

/* ── Impressum ── */
.impressum-bar { display: flex; justify-content: flex-end; align-items: center; gap: 4px; padding: 6px 14px 12px; }
.impressum-link { font-size: 11px; color: var(--muted); text-decoration: none; opacity: 0.55; padding: 4px 6px; }
.impressum-link + .impressum-link::before { content: '·'; margin-right: 4px; opacity: 0.4; }
.impressum-link:hover { opacity: 1; text-decoration: underline; }
