:root {
  --bg-gradient: linear-gradient(180deg, #1e3a8a 0%, #000 100%);
  --card-bg: rgba(30, 41, 59, 0.4);
  --card-border: rgba(255, 255, 255, 0.15);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.6);
  --text-muted-opacity: 0.6;
  --accent: #facc15;
}

/* === THEME VARIANTS === */
body.theme-night {
  --bg-gradient: linear-gradient(to bottom, #0f172a 0%, #020617 100%);
  --card-bg: rgba(15, 23, 42, 0.5);
}

body.theme-day-clear {
  --bg-gradient: linear-gradient(to bottom, #3b82f6 0%, #60a5fa 100%);
  --card-bg: rgba(255, 255, 255, 0.15);
  --text-secondary: rgba(255, 255, 255, 0.95);
  --text-muted-opacity: 0.95;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

body.theme-day-cloudy {
  --bg-gradient: linear-gradient(to bottom, #64748b 0%, #94a3b8 100%);
  --card-bg: rgba(51, 65, 85, 0.4);
  --text-secondary: rgba(255, 255, 255, 0.9);
  --text-muted-opacity: 0.9;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

body.theme-hot {
  --bg-gradient: linear-gradient(to bottom, #f97316 0%, #ea580c 100%);
  --text-secondary: rgba(255, 255, 255, 0.95);
  --text-muted-opacity: 0.95;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

body.theme-cold {
  --bg-gradient: linear-gradient(to bottom, #0ea5e9 0%, #3b82f6 100%);
  --text-secondary: rgba(255, 255, 255, 0.95);
  --text-muted-opacity: 0.95;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-primary);
  height: 100%;
  transition: background 1s ease;
}

/* === LAYOUT === */
#app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  padding-top: 40px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

/* HERO SECTION (Apple Style) */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px 0 40px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.hero-city {
  font-size: 32px;
  font-weight: 500;
  letter-spacing: 0.5px;
  margin-bottom: 5px;
}

.hero-temp {
  font-size: 96px;
  font-weight: 200;
  line-height: 1;
  margin-left: 15px;
  /* Optisch ausgleichen wegen ° */
}

/* Override JS coloring */
#temp_out {
  color: inherit !important;
}

.hero-condition {
  font-size: 20px;
  font-weight: 500;
  opacity: 0.9;
  margin-top: 5px;
  text-transform: capitalize;
}

.hero-hl {
  font-size: 18px;
  font-weight: 500;
  margin-top: 6px;
  opacity: 1;
}

/* GRID LAYOUT */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  /* 4 Columns on Desktop */
  gap: 15px;
  grid-auto-rows: min-content;
}

/* CARDS */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(25px) saturate(150%);
  -webkit-backdrop-filter: blur(25px) saturate(150%);
  border-radius: 22px;
  border: 1px solid var(--card-border);
  padding: 15px;
  display: flex;
  flex-direction: column;
  color: white;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  transition: transform 0.2s ease;
  overflow: hidden;
  /* Commented out to allow tooltips */
  overflow: visible;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.3);
}

/* ... existing code ... */

/* TOOLTIPS */
[data-tooltip] {
  position: relative;
  cursor: help;
  text-decoration-line: underline;
  text-decoration-style: dotted;
  text-decoration-color: rgba(255, 255, 255, 0.3);
  text-underline-offset: 3px;
}

[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(0px) scale(0.95);
  background: rgba(15, 15, 20, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 8px 12px;
  font-size: 11px;
  border-radius: 8px;
  width: max-content;
  max-width: 200px;
  white-space: normal;
  text-align: center;
  font-weight: 400;
  line-height: 1.4;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

[data-tooltip]:hover::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-8px) scale(1);
}

[data-tooltip]::after {
  /* Arrow */
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(0px);
  border: 6px solid transparent;
  border-top-color: rgba(15, 15, 20, 0.95);
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  pointer-events: none;
}

[data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-2px);
  /* Connects to tooltip */
}

.card-title {
  font-size: 13px;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-title svg {
  width: 14px;
  height: 14px;
  opacity: var(--text-muted-opacity);
}

.card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}

/* Sizes */
.col-span-1 {
  grid-column: span 1;
}

.col-span-2 {
  grid-column: span 2;
}

.col-span-4 {
  grid-column: span 4;
}

.row-span-2 {
  grid-row: span 2;
}

/* REPLACEMENTS FOR OLD CLASSES (Data Binding Compatibility) */
.val-big {
  font-size: 32px;
  font-weight: 500;
}

.val-unit {
  font-size: 18px;
  color: var(--text-secondary);
  margin-left: 2px;
}

.val-sub {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Colors for specific values */
.val-big#pv_pv_w {
  color: #facc15 !important;
}

.text-yellow {
  color: #facc15 !important;
}

.text-green {
  color: #4ade80 !important;
}

.text-red {
  color: #ef4444 !important;
}

.text-blue {
  color: #60a5fa !important;
}


/* SPECIFIC WIDGETS */

/* Hourly Forecast List (Classes used by weather_v2.js) */
.forecastList {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.fcRow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 15px;
}

.fcRow:last-child {
  border-bottom: none;
}

.fcDay {
  width: 50px;
  font-weight: 600;
}

.fcDate {
  display: none;
  /* Hide date for cleaner look */
}

.fcInfo {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.fcIcon svg {
  width: 24px;
  height: 24px;
  filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.3));
}

.fcCondition {
  opacity: 0.8;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
}

.fcTempWrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 140px;
}

.fcTempNum {
  width: 30px;
  font-weight: 600;
  text-align: right;
}

.fcTempNum.min {
  opacity: var(--text-muted-opacity);
}

.tempTrack {
  flex: 1;
  height: 4px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}

.tempBar {
  position: absolute;
  height: 100%;
  background: linear-gradient(90deg, #60a5fa, #facc15);
  border-radius: 2px;
}

.fcMeta {
  display: none;
  /* Hide rain prob/wind in list for cleaner look, like Apple */
}

/* Compass */
.compass-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 5px;
}

.compassSvg {
  width: 100%;
  max-width: 120px;
  /* Restored size */
  height: auto;
  margin-bottom: 2px;
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.1));
}

.wind-value {
  text-align: center;
  margin-top: 0px;
}

.wind-dir-text {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.1;
}

.wind-deg {
  font-size: 13px;
  opacity: var(--text-muted-opacity);
}

/* Charts */
.chartWrap {
  height: 160px;
  width: 100%;
  position: relative;
}

.full .chartWrap {
  height: 250px;
}

/* Astro */
.astroWrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 10px;
}

.astroSvg {
  width: 100%;
  max-width: 80%;
}

.astroTimes {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 0 10px;
  margin-top: -15px;
  font-weight: 600;
  font-size: 13px;
}

.atLabel {
  display: none;
}

/* PV / Energy */
.pv-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.pv-item {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.pvLbl {
  font-size: 11px;
  opacity: var(--text-muted-opacity);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

/* ALERTS */
.alert-container {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Base Alert Box (Details element) */
.alert-box {
  background: rgba(40, 40, 45, 0.6);
  /* Dark Glass Base */
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 4px solid #fff;
  /* Severity Color gets applied here via specific class */
  border-radius: 12px;
  color: white;
  margin-bottom: 0;
  padding: 0;
  /* Reset */
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(15px) saturate(160%);
  -webkit-backdrop-filter: blur(15px) saturate(160%);
  overflow: hidden;
  transition: all 0.3s ease;
}

.alert-box[open] {
  background: rgba(30, 30, 35, 0.85);
  /* Slightly darker when open */
}

/* Summary Row styling (Clickable Header) */
.alert-summ {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
  /* Hide default triangle */
  position: relative;
}

.alert-summ::-webkit-details-marker {
  display: none;
}

.alert-icon {
  font-size: 18px;
  margin-right: 12px;
  filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.3));
}

.alert-head {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  /* Allow flex child to shrink below content size */
}

.alert-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: none;
  white-space: normal;
  /* Wrapper text */
  word-break: break-word;
}

.alert-time {
  font-size: 11px;
  font-weight: 400;
  opacity: 0.8;
  margin-top: 2px;
}

.alert-arr {
  font-size: 12px;
  /* Slightly larger for touch */
  opacity: 0.7;
  transition: transform 0.3s ease;
  margin-left: 10px;
  flex-shrink: 0;
  /* Prevent arrow from vanishing */
  width: 20px;
  text-align: center;
}

.alert-box[open] .alert-arr {
  transform: rotate(180deg);
}

/* Content Body */
.alert-body {
  padding: 0 16px 16px 46px;
  /* Indent below icon */
  font-size: 13px;
  line-height: 1.5;
  opacity: 0.85;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  margin-top: 5px;
  padding-top: 10px;
}

/* Variants - Using Border Colors & Subtle Background Tints */
.alert-yellow {
  border-left-color: #facc15;
  background: linear-gradient(90deg, rgba(250, 204, 21, 0.1) 0%, rgba(40, 40, 45, 0.6) 100%);
}

.alert-orange {
  border-left-color: #fb923c;
  background: linear-gradient(90deg, rgba(251, 146, 60, 0.1) 0%, rgba(40, 40, 45, 0.6) 100%);
}

.alert-red {
  border-left-color: #ef4444;
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.15) 0%, rgba(40, 40, 45, 0.6) 100%);
}

.alert-purple {
  border-left-color: #a855f7;
  background: linear-gradient(90deg, rgba(168, 85, 247, 0.15) 0%, rgba(40, 40, 45, 0.6) 100%);
}

/* RESPONSIVE */
.mobile-only {
  display: none;
}

.stats-grid {
  display: flex;
  flex-direction: row;
  justify-content: space-around;
  align-items: center;
  text-align: center;
  padding: 10px 0;
}

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

  .col-span-1,
  .col-span-2 {
    grid-column: span 1;
  }

  .col-span-4 {
    grid-column: span 2;
  }

  .card.chart-card {
    grid-column: span 2;
  }
}

@media (max-width: 500px) {
  .stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    padding: 5px;
  }
  .stat-div {
    display: none !important;
  }
  .hero-temp {
    font-size: 72px;
  }

  .bento-grid {
    display: flex;
    flex-direction: column;
  }

  .card {
    min-height: auto;
  }

  .chartWrap {
    height: 180px;
  }

  .mobile-only {
    display: block;
  }

  .desktop-only {
    display: none;
  }
}

/* Footer */
.foot {
  text-align: center;
  font-size: 11px;
  opacity: var(--text-muted-opacity);
  padding: 20px;
}

/* Fix for Mobile Forecast Truncation */
@media (max-width: 480px) {
  .fcRow {
    display: grid !important;
    grid-template-columns: 35px 1fr 45px 100px !important;
    gap: 5px !important;
  }

  .fcDay {
    width: auto !important;
    min-width: auto !important;
    font-size: 13px !important;
  }

  .fcInfo {
    min-width: 0;
  }
  
  .fcCondition {
    font-size: 12px;
  }

  .fcTempWrapper {
    width: 100px !important;
    min-width: 100px !important;
  }
  
  .fcTempNum {
    width: 25px;
    font-size: 12px;
  }
  
  .fcRow>div:nth-child(3) {
    display: flex !important;
    font-size: 10px !important;
    transform: scale(0.9);
  }
  
  .radar-card {
    height: 350px !important;
  }
}