/* === 3-Spalten-Layout (Stationen / Forecast / Shelly) === */

/* Spalten gleich breit, nebeneinander */
.equal-column {
  flex: 1 1 0;          /* alle drei Spalten teilen sich die Breite */
  min-width: 0;         /* Inhalte dürfen die Spalte nicht aufdrücken */
  display: flex;
  flex-direction: column;
}

/* Basis für alle drei Haupt-Container */
#station-container,
#forecast-container,
#shelly-container {
  height: 100%;
  padding: 10px;
  box-sizing: border-box;
}

/* Spalten-Container für Forecast & Shelly */
#forecast-container,
#shelly-container {
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
}

/* Drei kompakte Raumreihen, Energieübersicht und HIT/Live in Prognosekarten-Höhe. */
#shelly-container {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 0.76fr)) minmax(0, 0.65fr) minmax(0, 1fr);
  align-items: stretch;
}

#shelly-container .shelly-box {
  min-width: 0;
  min-height: 0;
  max-width: none;
  margin: 0;
  color: inherit;
  text-decoration: none;
}

.shelly-placeholder {
  opacity: 0.72;
}

#shelly-container .hit-combined {
  display: grid;
  grid-column: 1 / 3;
  grid-row: 5;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 0;
  overflow: hidden;
  background: transparent;
}

#shelly-container .shelly-energy-summary {
  min-width: 0;
  min-height: 0;
  grid-column: 1 / 3;
  grid-row: 4;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid rgba(245, 158, 11, .3);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(255,255,255,.98), rgba(255,248,228,.97));
  box-shadow: 0 2px 7px rgba(72, 53, 10, .1);
  color: inherit;
  text-decoration: none;
}

.shelly-energy-summary > span {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 9px;
}

.shelly-energy-summary > span + span {
  border-left: 1px solid rgba(245, 158, 11, .25);
}

.shelly-energy-summary small {
  color: #7c5b13;
  font-size: .72rem;
  font-weight: 750;
}

.shelly-energy-summary strong {
  color: #9a5b00;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

html.dark .shelly-energy-summary,
body.darkmode .shelly-energy-summary {
  border-color: rgba(251, 191, 36, .22);
  background: linear-gradient(145deg, rgba(38,42,48,.98), rgba(54,45,27,.96));
}

html.dark .shelly-energy-summary small,
body.darkmode .shelly-energy-summary small { color: #fde68a; }
html.dark .shelly-energy-summary strong,
body.darkmode .shelly-energy-summary strong { color: #fbbf24; }


#shelly-container .hit-combined-link {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  text-decoration: none;
  font-size: clamp(2.25rem, 3.8vw, 3.25rem);
  font-weight: 850;
  letter-spacing: 0.04em;
  background: linear-gradient(145deg, #075985, #0e7490);
  border-color: rgba(255, 255, 255, 0.2);
  opacity: 1;
}

#shelly-container .hit-archive-link:hover {
  background: linear-gradient(145deg, #0369a1, #0891b2);
}

#shelly-container .live-hit-link {
  background: linear-gradient(145deg, #166534, #15803d);
}

#shelly-container .live-hit-link:hover {
  background: linear-gradient(145deg, #15803d, #16a34a);
}

#shelly-container .capital-weather-link {
  background: linear-gradient(145deg, #9f1239, #e11d48);
  font-size: clamp(1.35rem, 2.4vw, 2.2rem);
  letter-spacing: 0;
}
#shelly-container .capital-weather-link:hover { background: linear-gradient(145deg, #be123c, #f43f5e); }

#shelly-container .shelly-box {
  position: relative;
  transition: background-color 0.35s ease, border-color 0.35s ease, transform 0.15s ease;
}

#shelly-container .room-very-cold { border-left: 4px solid #2563eb; }
#shelly-container .room-cold { border-left: 4px solid #38bdf8; }
#shelly-container .room-comfort { border-left: 4px solid #22c55e; }
#shelly-container .room-warm { border-left: 4px solid #eab308; }
#shelly-container .room-hot { border-left: 4px solid #f97316; }
#shelly-container .room-very-hot { border-left: 4px solid #dc2626; }
#shelly-container .battery-good { border-top: 3px solid #22c55e; border-bottom: 3px solid #22c55e; }
#shelly-container .battery-low { border-top: 3px solid #eab308; border-bottom: 3px solid #eab308; }
#shelly-container .battery-critical { border-top: 3px solid #ef4444; border-bottom: 3px solid #ef4444; }

#shelly-container .room-stale::after {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 0;
  border-radius: inherit;
  background: rgba(100, 110, 120, 0.32);
  pointer-events: none;
}

.shelly-trend { font-size: 0.85em; margin-left: 2px; }
.trend-up { color: #d35f12; }
.trend-down { color: #1677b8; }
.trend-steady { color: #64748b; }
.shelly-range { font-size: 0.68rem; color: #607080; margin-bottom: 2px; }
.shelly-battery-warning,
.shelly-stale-warning { font-size: 0.68rem; font-weight: 700; margin-top: 3px; }
.shelly-battery-warning { color: #15803d; }
.battery-low .shelly-battery-warning { color: #9a6700; }
.battery-critical .shelly-battery-warning { color: #c62828; }
.shelly-stale-warning { position: absolute; z-index: 3; right: 7px; bottom: 6px; max-width: calc(100% - 14px); padding: 2px 6px; border-radius: 999px; background: rgba(55, 65, 81, .9); color: #fff; font-size: .6rem; line-height: 1.2; white-space: nowrap; }

html.dark #shelly-container .room-stale {
  background: inherit;
}

html.dark #shelly-container .room-stale::after {
  background: rgba(15, 18, 22, 0.48);
}

/* Forecast-Spalte */
#forecast-content {
  flex: 1;
  display: flex;
}

.forecast-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rain-alert {
  flex: 0 0 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 4px 10px;
  border: 1px solid rgba(2, 132, 199, 0.18);
  border-radius: 12px;
  background: rgba(224, 242, 254, 0.94);
  color: #075985;
  font-size: 0.72rem;
  box-shadow: 0 2px 7px rgba(2, 132, 199, 0.09);
}

.rain-alert strong { font-size: 0.74rem; }
html.dark .rain-alert {
  background: rgba(7, 89, 133, 0.28);
  border-color: rgba(125, 211, 252, 0.18);
  color: #bae6fd;
}

/* Gemeinsame Kachelbasis */
.forecast-entry, .shelly-box {
  flex: 1;
  width: 100%;
  max-width: 33em;
  margin: 0 auto;
  box-sizing: border-box;

  display: flex;
  flex-direction: column;

  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  border: 1px solid rgba(255,255,255,0.7);
  padding: 8px 16px;
}

/* Zeile 1: Überschrift */
.fe-label,
.shelly-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 2px;
}

/* Zeile 2: Hauptwerte */
.fe-temp,
.fe-rightval,
.shelly-temp {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 2px;
}

/* Zeile 3: Zusatzinfos */
.fe-wind,
.shelly-info {
  font-size: 0.8rem;
  opacity: 0.8;
}

/* Forecast-spezifische Struktur */
.fe-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.fe-left {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.fe-titleline {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
}

.fe-source {
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
  opacity: 0.55;
  letter-spacing: 0.04em;
}

.fe-time {
  font-size: 0.7rem;
  opacity: 0.7;
}

.fe-icon svg {
  width: 32px;
  height: 32px;
  display: block;
}

.fe-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.fe-mainline .fe-temp {
  font-weight: 600;
}

/* Regen- & Sonnenschein-Balken */
.fe-bars {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.bar {
  height: 6px;
  border-radius: 999px;
  background: #e6eef7;
  border: 1px solid #c9d9ee;
  overflow: hidden;
}

.bar .fill {
  height: 100%;
}

.bar.rain .fill {
  background: linear-gradient(90deg, #9dd5ff, #4aa3ff);
}

.bar.sun .fill {
  background: linear-gradient(90deg, #ffe08a, #ffc857);
}

/* Neuer Aufbau: oben eine große Karte, darunter 2-Spalten-Grid */
.forecast-current-row {
  margin-bottom: 10px;
}

.forecast-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  /* NEU: Grid füllt den restlichen Platz der Spalte */
  flex: 1;
  /* 4 Zeilen sollen sich die Höhe teilen */
  grid-template-rows: repeat(4, 1fr);
  gap: 10px;
}

/* Aktuelle Kachel über volle Breite */
.forecast-current-row .forecast-entry {
  width: 100%;
}

/* Kompaktmodus für Pi-Display */
@media (max-height: 820px) {
  #forecast-container,
  #shelly-container {
    padding: 10px 4px 0 4px;
    gap: 6px;
  }

  .forecast-entry,
  .shelly-box {
    padding: 6px 10px;
    border-radius: 14px;
  }

  .fe-icon svg {
    width: 26px;
    height: 26px;
  }

  .fe-label,
  .shelly-title {
    font-size: 0.85rem;
  }

  .fe-temp,
  .fe-rightval,
  .shelly-temp {
    font-size: 1.0rem;
  }

  .fe-wind,
  .shelly-info {
    font-size: 0.75rem;
  }
	
	.fe-wind {
		font-size: 0.65rem;
	}

  .bar {
    height: 4px;
  }
}

@media (max-width: 720px) {
  #station-container,
  #forecast-container,
  #shelly-container {
    height: auto;
    min-height: 0;
    margin-left: 0;
    padding: 10px;
  }

  #station-container {
    min-height: calc(100dvh - 50px);
  }

  #forecast-container {
    min-height: 720px;
  }

  .forecast-grid {
    grid-template-rows: repeat(4, minmax(105px, auto));
  }

  #shelly-container {
    grid-template-rows: repeat(4, minmax(105px, auto));
  }
}

/* Systemzustand unter /health/view */
.health-page {
  display: block;
  min-height: calc(100vh - 50px);
  padding: 24px;
  box-sizing: border-box;
}

.health-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1050px;
  margin: 0 auto 18px;
}

.health-heading h1,
.health-heading p { margin: 0; }
.health-heading p { opacity: 0.65; margin-top: 4px; }

.health-overall {
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
  text-transform: uppercase;
}

.health-grid {
  max-width: 1050px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.health-card {
  padding: 16px;
  border-radius: 14px;
  background: rgba(255,255,255,0.82);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  border-left: 5px solid #22c55e;
}

.health-card p { margin: 10px 0; }
.health-card small { display: block; opacity: 0.7; margin-top: 3px; }
.health-card-title { display: flex; align-items: center; gap: 8px; }
.health-card-title span:last-child { margin-left: auto; font-size: 0.75rem; text-transform: uppercase; opacity: 0.65; }
.health-dot { width: 10px; height: 10px; border-radius: 50%; background: #22c55e; }
.health-warning { border-color: #f59e0b; }
.health-card.health-warning { border-left-color: #f59e0b; }
.health-warning .health-dot { background: #f59e0b; }
.health-critical, .health-unhealthy { border-color: #ef4444; }
.health-card.health-critical { border-left-color: #ef4444; }
.health-critical .health-dot { background: #ef4444; }
.health-healthy { background: rgba(34,197,94,0.14); color: #15803d; }
.health-degraded { background: rgba(245,158,11,0.16); color: #b45309; }
.health-unhealthy { background: rgba(239,68,68,0.14); color: #b91c1c; }
.health-json-link { max-width: 1050px; margin: 16px auto 0; }


/* === Neues Kachel-Design: Frosted-Glass Look === */
/* Sanfte Transparenz, moderne Kanten, dezenter Rahmen */
/* Gemeinsame Kachelbasis – NEUE VERSION */
.forecast-entry,
.shelly-box {
  flex: 1;
  width: 100%;
  max-width: 33em;
  margin: 0 auto;
  box-sizing: border-box;

  display: flex;
  flex-direction: column;

  /* Neuer Hintergrund */
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);

  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.20);

  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.15),
    inset 0 0 12px rgba(255, 255, 255, 0.05);

  padding: 10px 16px;
  transition: background 0.2s ease, transform 0.15s ease;
}


/* Hover (nur Desktop, wirkt hochwertig – Pi ist unkritisch) */
@media (pointer: fine) {
  .forecast-entry:hover,
  .shelly-box:hover {
    background: rgba(255, 255, 255, 0.16);
    transform: translateY(-2px);
  }
}

/* Optional: Darkmode-Unterstützung */
body.darkmode .forecast-entry,
body.darkmode .shelly-box {
  background: rgba(20, 20, 20, 0.35);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 4px 16px rgba(0,0,0,0.5),
    inset 0 0 14px rgba(255, 255, 255, 0.03);
}


/* === Tages-Prognose: Heute + 3 Folgetage === */
.forecast-daily-column {
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.forecast-day-card {
  justify-content: center;
  gap: 6px;
}

.forecast-day-card .fe-label {
  font-size: 1.15rem;
  font-weight: 700;
}

.forecast-day-card .fe-time {
  font-size: 0.8rem;
}

.forecast-day-card .fe-temp {
  font-size: 1.45rem;
  font-weight: 800;
}

.fe-rain {
  font-size: 0.85rem;
  opacity: 0.85;
}

@media (max-height: 820px) {
  .forecast-daily-column {
    gap: 8px;
  }

  .forecast-day-card {
    gap: 4px;
    padding: 6px 12px;
  }

  .forecast-day-card .fe-label {
    font-size: 1rem;
  }

  .forecast-day-card .fe-temp {
    font-size: 1.2rem;
  }

  .forecast-day-card .fe-wind,
  .forecast-day-card .fe-rain {
    font-size: 0.72rem;
  }
}
