/* =========================================================
   Dashboard Grid
   ========================================================= */

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 5px;
  align-items: stretch;
}

.dashboard-grid > * {
  min-width: 0;
}


.dashboard-grid-wide {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
  margin: 0px;
}

/* =========================================================
   Grundlayout Kachel (identisch zu Kachel 1)
   ========================================================= */

.wetterkachel {
  background: var(--sppb-wetterkachel);
  color: #ffffff;
  padding: 12px;
  border-radius: 0px;
  display: flex;
  flex-direction: column;
  height: 100%;
  font-family: system-ui, sans-serif;
}

/* =========================================================
   Header
   ========================================================= */

.kachel-header {
  font-size: 28px;
  font-weight: 400;
  text-align: center;
  margin-bottom: 18px;
  margin-top: 6px;
}

/* =========================================================
   Mittelbereich (generisch)
   ========================================================= */

.kachel-mitte {
  display: flex;
  gap: 12px;
  margin-bottom: 30px;
}

.wetterdaten {
  flex: 1;
  text-align: center;
}

/* =========================================================
   Label
   ========================================================= */

.wetterlabel {
  font-size: 13px;
  opacity: 0.8;
  margin-bottom: 6px;
}

/* =========================================================
   Wert + Einheit (Standard: nebeneinander)
   ========================================================= */

.wert-zeile {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
}

.wert-gross {
  font-size: 34px;
  font-weight: 600;
  line-height: 1;
}

.wert-einheit {
  font-size: 14px;
  opacity: 0.85;
}

/* =========================================================
   Modifier: Einheit unter dem Wert (m/s)
   ========================================================= */

.wert-zeile.wert-untereinheit {
  flex-direction: column;
  gap: 2px;
}

.wert-zeile.wert-untereinheit .wert-einheit {
  font-size: 12px;
}

/* =========================================================
   Zusatzwert km/h
   ========================================================= */

.wind-value {
  margin-top: 4px;
  font-size: 13px;
  opacity: 0.85;
}

/* =========================================================
   Wind-spezifisch: Kompass
   ========================================================= */

.wind-mitte {
  align-items: center;
}

.wind-compass {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 90px;
}

.compass-ticks {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  /* Platzhalter – wird meist per JS/SVG gefüllt */
}

.compass-center {
  text-align: center;
}

.wind-deg {
  font-size: 20px;
  font-weight: 600;
}

.wind-text {
  font-size: 13px;
  opacity: 0.85;
}

/* =========================================================
   Footer
   ========================================================= */

.kachel-footer {
  margin-top: auto;
  font-size: 12px;
  text-align: center;
}


/* =========================================================
   Sunrise / Sunset (Teil C aus Kachel 1)
   ========================================================= */

.kachel-footer {
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.sun-time {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
}

.sun-arrow {
  font-size: 12px;
}

.sun-icon {
  font-size: 14px;
  color: #f6c343; /* gelbe Sonne */
}

.sun-value {
  font-variant-numeric: tabular-nums;
}




/* =====================================================
   Kompass
   ===================================================== */


.wind-compass {
  position: relative;
  width: 110px;
  height: 110px;
}

.compass-ticks {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.compass-tick {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1px;
  height: 6px;
  background: #cbd5e1;
  transform: translate(-50%, -52px) rotate(var(--deg));
  transform-origin: center 52px;
  transition: background-color 0.3s ease, height 0.3s ease, width 0.3s ease;
}

.compass-tick.major {
  width: 2px;
  height: 9px;
  background: #94a3b8;
}

.compass-tick.active {
  width: 3px;
  height: 14px;
  background: #dc2626;
  z-index: 2;
}

.compass-center {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.wind-deg {
  font-size: 1.4rem;
  font-weight: 700;
}

.wind-text {
  font-size: 0.8rem;
  color: #ffffff;
}

/* ==========================================
   Wind-Pfeil von außen nach innen (sauber)
   ========================================== */

.wind-compass {
  overflow: visible;
}

/* Container rotiert */
.compass-arrow {
  /* deine Länge passt gut */
  --arrow-len: 52px;

  /* ab wieviel px vom Zentrum aus der Schaft sichtbar sein soll */
  --show-from: 52px;

  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;

  transform: rotate(var(--rotation));
  transform-origin: center center;
  z-index: 4;
}

/* Schaft: liegt auf der "Nord"-Achse und wird dann per Container gedreht */
.compass-arrow-shaft {
  position: absolute;

  /* Start im Zentrum */
  left: -1px;              /* zentriert bei 2px Breite */
  bottom: 0;

  width: 2px;
  height: var(--arrow-len);
  background: #dc2626;
  border-radius: 2px;

  /* nur der obere Teil bleibt sichtbar:
     unten (nahe Zentrum) wird TRANSPARENT maskiert */
  -webkit-mask-image: linear-gradient(
    to top,
    transparent 0,
    transparent var(--show-from),
    #000 var(--show-from),
    #000 100%
  );
  mask-image: linear-gradient(
    to top,
    transparent 0,
    transparent var(--show-from),
    #000 var(--show-from),
    #000 100%
  );
}

/* Spitze: außerhalb, zeigt nach innen (zum Zentrum) */
.compass-arrow-head {
  position: absolute;

  /* Spitze sitzt am äußeren Ende des Schafts */
  left: 0;
  bottom: var(--arrow-len);

  transform: translateX(-50%);

  width: 0;
  height: 0;

  /* Dreieck zeigt nach unten (nach innen) */
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 10px solid #d64545;
}

/* =========================================================
   Luft-Kachel: Mittelteil mit 3 gleichwertigen Blöcken
   ========================================================= */

.luft-mitte {
  display: flex;
  gap: 12px;
}

.luft-box {
  flex: 1;
  text-align: center;
}

/* =========================================================
   Niederschlag-Kachel
   ========================================================= */

.niederschlag-mitte {
  display: flex;
  gap: 16px;
  align-items: center;
}

/* Teil A: großer Wert */
.niederschlag-aktuell {
  flex: 1;
  text-align: center;
}

/* Teil B: Detailwerte */
.niederschlag-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

/* einzelne Zeile */
.niederschlag-zeile {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.niederschlag-zeile .label {
  opacity: 0.8;
}

.niederschlag-zeile .wert {
  font-variant-numeric: tabular-nums;
}

/* Footer Layout */
.kachel-footer {
  display: flex;
  justify-content: space-evenly;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
}

/* Einheit: Label + Wert */
.kachel-footer .footer-item {
  display: inline-flex;
  gap: 0.25rem;
  white-space: nowrap;
}

/* Label etwas ruhiger */
.kachel-footer .label {
  
}

/* ===== Farb-Logik ===== */
.kachel-footer .min {
  color: #2a6edb; /* Blau */
}

.kachel-footer .max {
  color: #d64545; /* Rot */
}

/* Temperatur-Farblogik */
.temp {
  transition: color 0.3s ease;
}

.temp.minus {
  color: #2a6edb; /* Blau */
}

.temp.plus {
  color: #d64545; /* Rot */
}

.temp-plus  { color: var(--sppb-temp-plus); } /* rot */
.temp-minus { color: var(--sppb-temp-minus); } /* blau */

.korrektur {
  padding: 20px;
}

/* =========================================================
   Diagramm
   ========================================================= */

.diagramm-kachel .kachel-mitte {
  height: 220px;
}

.diagramm-kachel canvas {
  width: 100% !important;
  height: 100% !important;
}

.chart-tabs {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.chart-tab {
  background: transparent;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 0.3rem 0.8rem;
  cursor: pointer;
  font-size: 0.9rem;
  opacity: 0.7;
}

.chart-tab.active {
  opacity: 1;
  font-weight: 600;
  border-color: #666;
}

.chart-container {
  position: relative;
  height: 100%;
}

.chart-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  opacity: 0.6;
}

.hidden {
  display: none;
}

/* Trendfarben */
.trend-arrow-up {
  color: #c0392b; /* rot */
  font-weight: 600;
}

.trend-arrow-down {
  color: #2980b9; /* blau */
  font-weight: 600;
}

.trend-line {
  line-height: 1.4;
}

/* ==========================================
   Custom Tooltip (Chart.js Style) – Overlay
   ========================================== */

/* Ziel-Element: bleibt „anklickbar“/verständlich */
[data-tooltip] {
  cursor: help;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Die alten Pseudo-Tooltips deaktivieren,
   damit sie keinen Overflow/Scrollbalken erzeugen */
[data-tooltip]::before,
[data-tooltip]::after {
  display: none !important;
}

/* Overlay Tooltip (Chart.js-ish) */
.tooltip-overlay {
  position: fixed;
  z-index: 99999;

  /* Max Breite: nicht über den Viewport hinaus */
  max-width: min(340px, calc(100vw - 24px));

  background: rgba(30, 30, 30, 0.95);
  color: #fff;
  font-size: 0.75rem;
  line-height: 1.25;
  padding: 6px 10px;
  border-radius: 6px;

  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);

  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.14s ease, transform 0.14s ease;

  /* Tooltip darf umbrechen (sonst wird er zu lang) */
  white-space: normal;
}

/* Sichtbar */
.tooltip-overlay.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* kleiner Pfeil */
.tooltip-overlay::after {
  content: "";
  position: absolute;
  left: var(--arrow-x, 50%);
  bottom: -6px;
  transform: translateX(-50%);

  border-width: 6px;
  border-style: solid;
  border-color: rgba(30, 30, 30, 0.95) transparent transparent transparent;
}

/* Wenn Tooltip unter dem Element sitzt, Pfeil nach oben */
.tooltip-overlay.is-below::after {
  top: -6px;
  bottom: auto;
  border-color: transparent transparent rgba(30, 30, 30, 0.95) transparent;
}
