:root {
  color-scheme: dark;
  --bg: linear-gradient(160deg, rgba(19, 26, 44, 0.95), rgba(9, 13, 24, 0.92));
  --panel: rgba(28, 38, 62, 0.88);
  --glass-border: rgba(78, 115, 190, 0.32);
  --text: #e8f1ff;
  --muted: #8da2c9;
  --accent: #33ffe0;
  --accent-strong: #4a7cff;
  --shadow: 0 24px 55px rgba(4, 8, 18, 0.65);
  --glow: radial-gradient(circle at 85% 15%, rgba(74, 124, 255, 0.45), transparent 65%);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: #0a0e1a;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.5rem, 3vw, 3rem);
}

.page {
  width: min(1120px, 100%);
  display: grid;
  gap: clamp(2rem, 4vw, 3rem);
}

.hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: clamp(1.75rem, 4vw, 3rem);
  align-items: center;
  background: var(--bg);
  border-radius: 22px;
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
  padding: clamp(1.75rem, 4vw, 3rem);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: -40% -40% auto auto;
  width: 160px;
  height: 160px;
  background: var(--glow);
  pointer-events: none;
  filter: blur(2px);
  z-index: 0;
}

.hero__content,
.hero__visual {
  position: relative;
  z-index: 1;
}

.hero__content h1 {
  font-size: clamp(2rem, 4vw, 2.85rem);
  line-height: 1.1;
  margin-bottom: 0.8rem;
  color: var(--text);
}

.hero__content p {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
  max-width: 36ch;
}

.hero__visual {
  display: flex;
  align-items: center;
  justify-content: center;
}

.sun-orbit {
  position: relative;
  width: clamp(220px, 34vw, 280px);
  aspect-ratio: 1;
  border-radius: 32px;
  background: linear-gradient(145deg, rgba(26, 36, 58, 0.85), rgba(12, 18, 30, 0.65));
  border: 1px solid rgba(82, 109, 182, 0.3);
  box-shadow: inset 0 0 0 1px rgba(118, 163, 255, 0.18), 0 35px 70px rgba(4, 9, 18, 0.65);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.sun-orbit::after {
  content: "";
  position: absolute;
  inset: 12%;
  border-radius: 32px;
  background: radial-gradient(circle at 65% 25%, rgba(51, 255, 224, 0.35), transparent 70%);
  filter: blur(1px);
}

.sun {
  width: 62%;
  aspect-ratio: 1;
  border-radius: 24px;
  background: radial-gradient(circle at 35% 35%, rgba(255, 240, 163, 0.95), #ffc444 48%, #f08c00 100%);
  box-shadow: 0 0 45px rgba(255, 198, 71, 0.7), 0 0 120px rgba(255, 198, 71, 0.4);
  filter: saturate(1.1);
  animation: pulse 5s ease-in-out infinite;
}

.planet {
  position: absolute;
  bottom: 18%;
  right: 12%;
  width: 24%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(74, 124, 255, 0.85), rgba(35, 58, 118, 0.65));
  box-shadow: 0 15px 22px rgba(52, 93, 195, 0.45);
  animation: float 6s ease-in-out infinite;
}

.widget {
  background: var(--bg);
  border-radius: 22px;
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
  padding: clamp(2rem, 5vw, 3rem);
  display: grid;
  gap: clamp(1.75rem, 4vw, 2.5rem);
  position: relative;
  overflow: hidden;
}

.widget::before {
  content: "";
  position: absolute;
  inset: -40% -40% auto auto;
  width: 160px;
  height: 160px;
  background: var(--glow);
  pointer-events: none;
  filter: blur(2px);
  z-index: 0;
}

.widget__header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  position: relative;
  z-index: 1;
}

.widget__header h2 {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  letter-spacing: 0.02em;
}

.widget__timestamp {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.refresh {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: none;
  border-radius: 999px;
  padding: 0.65rem 1.5rem;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #051625;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 15px 35px rgba(62, 114, 255, 0.35);
}

.refresh:hover {
  transform: translateY(-2px) scale(1.02);
}

.refresh:focus-visible {
  outline: 3px solid rgba(74, 124, 255, 0.6);
  outline-offset: 2px;
}

.refresh__icon {
  font-size: 1.1rem;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: clamp(1.4rem, 4vw, 2rem);
  position: relative;
  z-index: 1;
}

.metric {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  padding: 1.6rem;
  background: var(--panel);
  border-radius: 18px;
  border: 1px solid var(--glass-border);
  position: relative;
  overflow: hidden;
  min-height: 170px;
}


.metric__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.85rem;
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(74, 124, 255, 0.45), rgba(34, 56, 104, 0.55));
  color: #e9f0ff;
  box-shadow: 0 14px 25px rgba(34, 56, 104, 0.35);
  z-index: 1;
}

.metric__icon--solar {
  background: linear-gradient(135deg, rgba(255, 208, 87, 0.75), rgba(240, 139, 0, 0.7));
  box-shadow: 0 14px 25px rgba(240, 139, 0, 0.32);
}

.metric__icon--battery {
  background: linear-gradient(135deg, rgba(95, 242, 135, 0.8), rgba(24, 110, 66, 0.6));
  box-shadow: 0 14px 25px rgba(38, 148, 86, 0.28);
}

.metric__icon--hotel {
  background: linear-gradient(145deg, rgba(102, 153, 255, 0.7), rgba(49, 78, 143, 0.65));
}

.metric__icon--grid {
  background: linear-gradient(145deg, rgba(51, 255, 224, 0.75), rgba(24, 120, 111, 0.55));
}

.metric__content {
  position: relative;
  z-index: 1;
}

.metric__content h3 {
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: rgba(217, 228, 255, 0.65);
}

.metric__value {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: 700;
  margin-top: 0.5rem;
  color: var(--text);
  text-shadow: 0 8px 18px rgba(10, 18, 32, 0.45);
}

.metric__trend {
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.progress {
  margin-top: 0.9rem;
  background: rgba(19, 28, 48, 0.8);
  border-radius: 999px;
  height: 12px;
  overflow: hidden;
  border: 1px solid rgba(86, 105, 175, 0.3);
  box-shadow: inset 0 0 0 1px rgba(20, 30, 52, 0.65);
}

.progress__bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #54ffd6 0%, #4a7cff 100%);
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 4px 16px rgba(74, 124, 255, 0.45);
}

.totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: clamp(1rem, 3vw, 1.5rem);
  position: relative;
  z-index: 1;
}

.total-card {
  padding: clamp(1.2rem, 3vw, 1.6rem);
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--glass-border);
  display: grid;
  gap: 0.4rem;
  position: relative;
  overflow: hidden;
}


.total-card h3 {
  font-size: 0.75rem;
  color: rgba(217, 228, 255, 0.65);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  z-index: 1;
}

.total-card__value {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  color: var(--text);
  text-shadow: 0 8px 18px rgba(10, 18, 32, 0.45);
  z-index: 1;
}

.total-card__label {
  color: var(--muted);
  font-size: 0.7rem;
  z-index: 1;
}

.widget__footer {
  padding-top: 1.2rem;
  border-top: 1px dashed rgba(92, 128, 196, 0.32);
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.7;
  position: relative;
  z-index: 1;
  text-align: center;
}

.widget[data-loading="true"]::after {
  content: "Wird aktualisiert …";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(12, 18, 30, 0.76);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.04em;
  z-index: 5;
}

.is-loading {
  pointer-events: none;
  opacity: 0.65;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.92;
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@media (max-width: 720px) {
  body {
    padding: clamp(1.5rem, 6vw, 2.5rem);
  }

  .hero,
  .widget {
    border-radius: 28px;
  }

  .metric {
    min-height: 160px;
  }

  .refresh {
    width: 100%;
    justify-content: center;
  }
}
