/* ============================================================================
   PeerWeather – Komponenten: Wettericons, Karteninhalte, Radar, Fahrrad, Karten
   ============================================================================ */

/* ------------------------- Wettericons + Animation ----------------------- */

.wx-icon { width: 84px; height: 84px; display: block; flex: none; }
.wx-icon svg { width: 100%; height: 100%; overflow: visible; }
.wx-icon--sm { width: 28px; height: 28px; }
.wx-icon--lg { width: 104px; height: 104px; }

.ic-cloud { fill: #7f9ec4; }
.ic-cloud-back { fill: #456187; }
.ic-sun { fill: #ffd07a; }
.ic-sun-rays { stroke: #ffce73; stroke-width: 2.4; stroke-linecap: round; transform-origin: 32px 32px; animation: icon-spin 22s linear infinite; }
.ic-drop { fill: #64b6ff; animation: icon-drop 1.8s var(--ease) infinite; }
.ic-drop:nth-child(2) { animation-delay: 0.35s; }
.ic-drop:nth-child(3) { animation-delay: 0.7s; }
.ic-flake { fill: #cfe6ff; animation: icon-flake 3.4s linear infinite; }
.ic-flake:nth-child(2) { animation-delay: 1.1s; }
.ic-flake:nth-child(3) { animation-delay: 2.2s; }
.ic-bolt { fill: #ffcf5c; animation: icon-flash 2.6s steps(1, end) infinite; }
.ic-fog-line { stroke: #9db4d0; stroke-width: 2.6; stroke-linecap: round; animation: icon-drift 5s var(--ease) infinite alternate; }
.ic-fog-line:nth-child(2) { animation-delay: 0.9s; }
.ic-fog-line:nth-child(3) { animation-delay: 1.8s; }
.ic-hail { fill: #e7f2ff; animation: icon-drop 1.5s var(--ease) infinite; }

@keyframes icon-spin { to { transform: rotate(360deg); } }
@keyframes icon-drop {
  0% { transform: translateY(-4px); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: translateY(14px); opacity: 0; }
}
@keyframes icon-flake {
  0% { transform: translate(0, -4px) rotate(0deg); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: translate(4px, 16px) rotate(120deg); opacity: 0; }
}
@keyframes icon-flash {
  0%, 55% { opacity: 0.25; }
  60%, 72% { opacity: 1; }
  76%, 100% { opacity: 0.3; }
}
@keyframes icon-drift {
  from { transform: translateX(-3px); }
  to { transform: translateX(4px); }
}

/* ------------------------------ Hero-Karte ------------------------------- */

.card-hero { background: linear-gradient(150deg, #14243c 0%, #101a2c 55%, #0d1524 100%); }
.hero-main { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.hero-temp { display: flex; flex-direction: column; }
.temp-value { font-size: clamp(2.6rem, 5vw, 3.4rem); font-weight: 650; letter-spacing: -0.03em; line-height: 1; }
.temp-unit { font-size: 1.4rem; color: var(--text-muted); margin-left: 4px; }
.hero-feels { margin: 8px 0 0; color: var(--text-soft); font-size: 0.9rem; }
.hero-condition { margin: 2px 0 0; font-size: 1.05rem; font-weight: 600; color: #d8e8ff; }
.hero-range { display: flex; gap: var(--space-3); flex-wrap: wrap; margin-top: var(--space-3); font-size: 0.85rem; }
.range-item { color: var(--text-soft); }
.range-item b { color: var(--text); font-weight: 600; }
.range-item--max b { color: #ffd6a3; }
.range-item--min b { color: #9ec9ff; }
.hero-gauge { margin-top: var(--space-3); }

.sparkline { width: 100%; height: 74px; display: block; }
.spark-area { fill: url(#sparkGradient); }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.spark-dot { fill: #fff; }
.spark-axis { fill: var(--text-muted); font-size: 10px; font-family: var(--font); }
.spark-label { fill: #cfe1ff; font-size: 11px; }

/* --------------------------- Kennzahlen (Metriken) ----------------------- */

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(172px, 1fr)); gap: var(--space-2); }
.metric {
  padding: 12px 13px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--line-soft);
  transition: background var(--dur) var(--ease);
}
.metric:hover { background: rgba(78, 161, 255, 0.07); }
.metric-label { display: block; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.metric-value { display: block; margin-top: 5px; font-size: 1.22rem; font-weight: 620; font-variant-numeric: tabular-nums; }
.metric-value em { font-style: normal; font-size: 0.78rem; color: var(--text-muted); font-weight: 500; margin-left: 3px; }
.metric-sub { display: block; margin-top: 4px; font-size: 0.78rem; color: var(--text-muted); }

.compass { display: flex; align-items: center; gap: 10px; }
.compass-dial { width: 46px; height: 46px; flex: none; }
.compass-ring { fill: rgba(255, 255, 255, 0.03); stroke: #2b405f; stroke-width: 1.5; }
.compass-tick { stroke: #38506f; stroke-width: 1.4; }
.compass-arrow { fill: var(--accent); }
.compass-n { fill: var(--text-muted); font-size: 9px; }

/* --------------------------- Vorhersage-Elemente ------------------------- */

.hourly-scroll {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.hour-col {
  flex: none;
  min-width: 82px;
  padding: 10px 8px;
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  scroll-snap-align: start;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.hour-col:hover { border-color: #2b4568; background: rgba(78, 161, 255, 0.06); }
.hour-col.is-now { border-color: rgba(78, 161, 255, 0.5); background: rgba(78, 161, 255, 0.1); }
.hour-col.is-night { background: rgba(255, 255, 255, 0.012); }
.hour-time { font-size: 0.78rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.hour-temp { font-size: 0.98rem; font-weight: 620; }
.hour-wind { font-size: 0.74rem; color: #9fc0e4; }
.hour-pop { font-size: 0.72rem; color: #7fb4f0; }

.daily-list { display: flex; flex-direction: column; gap: 2px; }
.day-row {
  display: grid;
  grid-template-columns: 112px 34px 1fr 96px minmax(150px, 1.15fr);
  align-items: center;
  gap: var(--space-3);
  padding: 9px 8px;
  border-radius: var(--radius-sm);
  border-bottom: 1px solid var(--line-soft);
  transition: background var(--dur) var(--ease);
}
.day-row:last-child { border-bottom: 0; }
.day-row:hover { background: rgba(78, 161, 255, 0.05); }
.day-name { font-size: 0.88rem; font-weight: 600; color: var(--text); }
.day-condition { font-size: 0.8rem; color: var(--text-soft); }
.day-bar { position: relative; height: 6px; border-radius: var(--radius-pill); background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.day-bar-fill { position: absolute; top: 0; bottom: 0; border-radius: var(--radius-pill); background: linear-gradient(90deg, #6db8ff, #ffcf8a); }
.day-temp { font-size: 0.88rem; text-align: right; font-variant-numeric: tabular-nums; }
.day-temp b { color: #ffe0b8; }
.day-meta { font-size: 0.78rem; color: var(--text-muted); text-align: right; }

/* ------------------------------ Sonnenstand ------------------------------ */

.sun-dial { margin: 0 0 var(--space-3); }
.sun-dial-figure {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background:
    radial-gradient(88% 130% at 50% 106%, rgba(78, 161, 255, 0.14), transparent 70%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012));
  padding: var(--space-2) var(--space-3);
}
.sun-arc {
  width: 100%;
  height: auto;
  aspect-ratio: 300 / 132;
  max-height: 200px;
  display: block;
}
.sun-sky { fill: url(#sunSkyFill); }
.sun-arc.is-night .sun-sky { fill: url(#sunSkyNight); }
.sun-horizon { stroke: #2a3d5c; stroke-width: 1.2; }
.sun-track { fill: none; stroke: #22344f; stroke-width: 2; stroke-dasharray: 3 6; stroke-linecap: round; }
.sun-travelled { fill: none; stroke: url(#sunPathFill); stroke-width: 2.8; stroke-linecap: round; }
.sun-glow { fill: url(#sunGlowFill); }
.sun-rays line { stroke: #ffd98a; stroke-width: 1.5; stroke-linecap: round; opacity: 0.82; }
.sun-marker { fill: #fff2d2; stroke: #ffcf7a; stroke-width: 1.4; }
.sun-next { fill: rgba(123, 183, 245, 0.2); stroke: #7bb7f5; stroke-width: 1.4; stroke-dasharray: 3 3; }
.sun-night-track { fill: none; stroke: rgba(132, 176, 232, 0.26); stroke-width: 1.6; stroke-dasharray: 3 6; stroke-linecap: round; }
.sun-night-done { fill: none; stroke: #7bb7f5; stroke-width: 2.4; stroke-linecap: round; opacity: 0.85; }
.sun-moon { fill: #e8f1fc; stroke: #9fc0e8; stroke-width: 1; }
.sun-moon-glow { fill: rgba(150, 195, 245, 0.16); }
.sun-drop { stroke: rgba(255, 217, 138, 0.3); stroke-width: 1; stroke-dasharray: 2 4; }
.sun-when { font-size: 11px; font-weight: 650; fill: var(--text); font-variant-numeric: tabular-nums; }
.sun-what { font-size: 9px; fill: var(--text-muted); letter-spacing: 0.05em; }
.sun-arc.is-night .sun-when { fill: var(--text-soft); }

.sun-progress {
  display: block;
  height: 6px;
  margin: var(--space-2) 0 7px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}
.sun-progress i {
  display: block;
  height: 100%;
  min-width: 3px;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff9b5c, #ffd98a 55%, #8ec5ff);
}
.sun-progress.is-night { background: rgba(123, 183, 245, 0.1); }
.sun-progress.is-night i { background: linear-gradient(90deg, #24405f, #7bb7f5); }
.sun-caption {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: 0.84rem;
  color: var(--text-soft);
}
.sun-caption .hint { color: var(--text-muted); white-space: nowrap; }

.sun-rows {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 var(--space-4);
}
.sun-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-2);
  padding: 6px 0;
  font-size: 0.88rem;
  color: var(--text-soft);
  border-bottom: 1px solid var(--line-soft);
}
.sun-row:nth-last-child(-n+2) { border-bottom: 0; }
.sun-row b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

@media (max-width: 460px) {
  .sun-arc { height: 128px; }
  .sun-when { font-size: 12px; }
  .sun-what { font-size: 10px; }
  .sun-caption { flex-direction: column; gap: 2px; }
  .sun-caption .hint { white-space: normal; }
}

.warning-list { display: flex; flex-direction: column; gap: 8px; }
.warning-item {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.02);
}
.warning-level {
  align-self: start;
  text-align: center;
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.warning-level--1 { background: rgba(123, 183, 245, 0.18); color: #a9d1ff; }
.warning-level--2 { background: rgba(240, 180, 41, 0.18); color: #ffd79a; }
.warning-level--3 { background: rgba(255, 111, 111, 0.2); color: #ffb4b4; }
.warning-level--4 { background: rgba(255, 70, 70, 0.26); color: #ffa8a8; }
.warning-title { font-size: 0.88rem; font-weight: 600; }
.warning-meta { font-size: 0.76rem; color: var(--text-muted); margin-top: 3px; }
.warning-text { font-size: 0.8rem; color: var(--text-soft); margin-top: 5px; }

/* ------------------------- Radar- / Karten-Layout ------------------------ */

.radar-layout, .maps-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: var(--space-3);
  align-items: start;
}
.map-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: linear-gradient(180deg, var(--surface-raised), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 12px;
  box-shadow: var(--shadow);
}
.map {
  position: relative;
  height: clamp(360px, 58vh, 620px);
  border-radius: var(--radius);
  overflow: hidden;
  background: #060b14;
}
.map--bike { height: clamp(320px, 46vh, 480px); }
.map-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.86rem;
  background: rgba(6, 11, 20, 0.75);
  z-index: 500;
}
.map-loading[hidden] { display: none; }
.map-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.map-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: var(--text-muted);
  min-height: 26px;
}
.legend-bar {
  height: 12px;
  min-width: 180px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
}
.legend-scale { display: flex; gap: 10px; flex-wrap: wrap; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.legend-swatch { width: 12px; height: 12px; border-radius: 3px; border: 1px solid rgba(255, 255, 255, 0.15); }

.overlay-canvas { position: absolute; inset: 0; pointer-events: none; z-index: 400; }

/* Dunkle Kartengrundlage: OpenStreetMap-Kacheln werden per Filter abgedunkelt,
   damit die Oberfläche ohne Karten-API-Schlüssel durchgängig dunkel bleibt. */
.tile-layer--dark {
  filter: invert(1) hue-rotate(220deg) saturate(0.38) brightness(0.78) contrast(0.98);
}

/* --------------------------- Radar-Zeitleiste ---------------------------- */

.side-panel { display: flex; flex-direction: column; gap: var(--space-3); }
.timeline {
  background: linear-gradient(180deg, var(--surface-raised), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  box-shadow: var(--shadow);
}
.timeline-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: var(--space-3); }
.timeline-slider {
  width: 100%;
  accent-color: var(--accent);
  height: 22px;
}
.timeline-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.timeline-scale .is-now { color: var(--accent); font-weight: 700; }
.timeline-note { margin-top: var(--space-2); font-size: 0.78rem; color: var(--text-muted); }

.info-list { display: flex; flex-direction: column; gap: 9px; }
.info-row { display: flex; justify-content: space-between; gap: 12px; font-size: 0.86rem; color: var(--text-soft); }
.info-row b { color: var(--text); font-variant-numeric: tabular-nums; }
.info-row--head { color: var(--text-muted); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.07em; }

/* ----------------------------- Fahrradmodus ------------------------------ */

.bike-layout { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: var(--space-3); align-items: start; }
.bike-form-card { position: sticky; top: 120px; }
.bike-map-card { padding: 12px; }

.card--rating { display: flex; flex-direction: column; gap: var(--space-3); }
.rating-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rating-badge {
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
}
.rating-badge.is-ideal { background: rgba(62, 207, 142, 0.16); color: #92f0c4; border-color: rgba(62, 207, 142, 0.45); }
.rating-badge.is-good { background: rgba(123, 183, 245, 0.16); color: #b4d7ff; border-color: rgba(123, 183, 245, 0.45); }
.rating-badge.is-limited { background: rgba(240, 180, 41, 0.16); color: #ffd9a0; border-color: rgba(240, 180, 41, 0.45); }
.rating-badge.is-poor { background: rgba(255, 111, 111, 0.16); color: #ffbcbc; border-color: rgba(255, 111, 111, 0.45); }
.rating-summary { font-size: 0.9rem; color: var(--text-soft); line-height: 1.5; }
.score-track { position: relative; height: 8px; border-radius: var(--radius-pill); background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.score-fill { position: absolute; inset: 0 auto 0 0; border-radius: var(--radius-pill); background: linear-gradient(90deg, #ff8080, #f0b429 45%, #7bb7f5 70%, #3ecf8e); transition: width 500ms var(--ease); }
.rating-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.rating-metric { padding: 10px; border-radius: var(--radius); border: 1px solid var(--line-soft); background: rgba(255, 255, 255, 0.02); }
.rating-metric span { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); }
.rating-metric b { display: block; margin-top: 4px; font-size: 1.05rem; font-variant-numeric: tabular-nums; }

.wind-dial-wrap { display: flex; gap: var(--space-4); align-items: center; flex-wrap: wrap; }
.wind-dial { width: 168px; height: 168px; flex: none; }
.dial-ring { fill: rgba(255, 255, 255, 0.02); stroke: #26395a; stroke-width: 1.5; }
.dial-ring--outer { stroke: #1d2c45; }
.dial-cross { stroke: #223351; stroke-width: 1; stroke-dasharray: 3 4; }
.dial-tick { stroke: #31486a; stroke-width: 1.4; }
.dial-label { fill: var(--text-muted); font-size: 10px; font-family: var(--font); }
.dial-wind { stroke: var(--accent); stroke-width: 2.6; stroke-linecap: round; }
.dial-head { stroke: #ff9b6b; stroke-width: 2.6; stroke-linecap: round; }
.dial-tail { stroke: #63e0a8; stroke-width: 2.6; stroke-linecap: round; }
.dial-side-r { stroke: #ffcf7a; stroke-width: 2.4; stroke-linecap: round; }
.dial-side-l { stroke: #ffcf7a; stroke-width: 2.4; stroke-linecap: round; opacity: 0.5; }
.dial-course { stroke: #d6e6ff; stroke-width: 2.2; stroke-linecap: round; }
.dial-hub { fill: #e9eff9; }
.wind-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 8px; flex: 1; }

.legs-strip { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; }
.leg-col {
  flex: none;
  min-width: 150px;
  padding: 11px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.8rem;
}
.leg-col .leg-title { font-size: 0.76rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.leg-col .leg-main { margin-top: 6px; font-size: 0.92rem; font-weight: 640; }
.leg-col .leg-main.is-head { color: #ffb08f; }
.leg-col .leg-main.is-tail { color: #86e7b6; }
.leg-col .leg-main.is-calm { color: var(--text-soft); }
.leg-col dl { display: grid; grid-template-columns: auto auto; gap: 2px 10px; margin: 8px 0 0; font-size: 0.76rem; }
.leg-col dt { color: var(--text-muted); }
.leg-col dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.leg-col.is-alert { border-color: rgba(240, 180, 41, 0.45); background: rgba(240, 180, 41, 0.07); }
.leg-col.is-storm { border-color: rgba(255, 111, 111, 0.5); background: rgba(255, 111, 111, 0.08); }

.advice-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 9px; }
.advice-list li {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--text-soft);
  line-height: 1.45;
}
.advice-mark {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(123, 183, 245, 0.16);
  color: #b4d7ff;
}
.advice-mark.is-warn { background: rgba(240, 180, 41, 0.18); color: #ffd9a0; }
.advice-mark.is-bad { background: rgba(255, 111, 111, 0.18); color: #ffbcbc; }
.advice-mark.is-good { background: rgba(62, 207, 142, 0.18); color: #92f0c4; }

.route-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-bottom: var(--space-3); }

/* ------------------------------ Responsive ------------------------------- */

@media (max-width: 1100px) {
  .radar-layout, .maps-layout, .bike-layout { grid-template-columns: minmax(0, 1fr); }
  .bike-form-card { position: static; }
  .day-row { grid-template-columns: 96px 30px 1fr 82px; }
  .day-row .day-meta { display: none; }
}

@media (max-width: 640px) {
  .wx-icon { width: 66px; height: 66px; }
  .wx-icon--lg { width: 82px; height: 82px; }
  .metrics { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .day-row { grid-template-columns: 84px 28px 1fr 72px; gap: 8px; }
  .day-name { font-size: 0.8rem; }
  .map { height: 62vh; }
  .leg-col { min-width: 132px; }
  .wind-dial { width: 140px; height: 140px; }
}
