/* ============================================================
   Rasen-Monitor — Projekt-CSS (Bootstrap 5 Overrides + Extras)
   Mobile-First | WCAG 2.1 AA | prefers-reduced-motion
   ============================================================ */

/* ── 1. Basis ─────────────────────────────────────────────────────────── */
:root {
  --bs-font-sans-serif: 'Inter', system-ui, -apple-system, sans-serif;
  --brand-green: #15803d;
  --brand-green-dark: #052e16;
  --brand-green-light: #22c55e;

  --transition-base: 220ms ease;
  --transition-fast: 120ms ease;
}

body {
  font-family: var(--bs-font-sans-serif);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Reduzierte Bewegung */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── 2. Typografie ────────────────────────────────────────────────────── */
.kpi-value {
  font-size: 2.25rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1;
}

@media (min-width: 576px) {
  .kpi-value {
    font-size: 2.75rem;
  }
}

.kpi-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6c757d;
}

.kpi-unit {
  font-size: 1.1rem;
  font-weight: 400;
  color: #6c757d;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* ── 3. KPI-Cards ─────────────────────────────────────────────────────── */
.kpi-card {
  border-left: 4px solid var(--kpi-accent, #198754);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  position: relative;
  overflow: hidden;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1) !important;
}

.hover-shadow {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-shadow:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
}

.kpi-card--moisture {
  --kpi-accent: #0ea5e9;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.14), rgba(59, 130, 246, 0.06));
}

.kpi-card--temp {
  --kpi-accent: #f97316;
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.14), rgba(251, 191, 36, 0.06));
}

.kpi-card--humidity {
  --kpi-accent: #8b5cf6;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.14), rgba(124, 58, 237, 0.07));
}

.kpi-card--device {
  --kpi-accent: #22c55e;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.14), rgba(16, 185, 129, 0.07));
}

.kpi-bg-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 3rem;
  opacity: 0.07;
  line-height: 1;
  pointer-events: none;
}

/* ── 4. Bewässerungs-Ampel ────────────────────────────────────────────── */
.ampel-card {
  border-left: 5px solid var(--ampel-color, #198754);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.ampel-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1) !important;
}

.ampel-card--success {
  --ampel-color: #198754;
}

.ampel-card--warning {
  --ampel-color: #f59e0b;
}

.ampel-card--error {
  --ampel-color: #dc3545;
}

.ampel-card--info {
  --ampel-color: #0dcaf0;
}

.ampel-card--neutral {
  --ampel-color: #6c757d;
}

.ampel-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

/* Pulsieren bei dringendem Status */
.ampel-pulse {
  animation: ampelPulse 1.8s ease-in-out infinite;
}

@keyframes ampelPulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4);
  }

  50% {
    box-shadow: 0 0 0 8px rgba(220, 53, 69, 0);
  }
}

/* ── 5. Forecast-Streifen ─────────────────────────────────────────────── */
.forecast-strip {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.forecast-hour {
  flex: 0 0 calc(100% / 3 - 0.35rem);
  min-width: 80px;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  padding: 0.6rem 0.5rem;
  text-align: center;
  transition: background-color var(--transition-fast);
}

@media (min-width: 576px) {
  .forecast-hour {
    flex: 0 0 calc(100% / 4 - 0.4rem);
  }
}

@media (min-width: 768px) {
  .forecast-hour {
    flex: 1 1 0;
  }
}

.forecast-hour {
  background: linear-gradient(180deg, #f8f9fa 0%, #e9ecef 100%);
  border-color: transparent;
}

.forecast-hour:hover {
  background: linear-gradient(180deg, #eef2ff 0%, #e2e8f0 100%);
}

.weather-stat {
  border: none;
  padding: 0.9rem 0.85rem;
  border-radius: 0.85rem;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.35rem;
  color: #102a43;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
}

.weather-stat:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.08);
}

.weather-stat.active {
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.12);
}

.weather-stat .kpi-label {
  color: #334155;
}

.weather-stat--temp {
  background: linear-gradient(135deg, rgba(254, 226, 226, 0.9), rgba(249, 115, 22, 0.16));
}

.weather-stat--rain {
  background: linear-gradient(135deg, rgba(219, 234, 254, 0.9), rgba(14, 165, 233, 0.16));
}

.weather-stat--wind {
  background: linear-gradient(135deg, rgba(224, 242, 254, 0.9), rgba(6, 182, 212, 0.16));
}

.weather-stat--et0 {
  background: linear-gradient(135deg, rgba(254, 240, 219, 0.9), rgba(245, 158, 11, 0.16));
}

.weather-stat--prob {
  background: linear-gradient(135deg, rgba(237, 246, 255, 0.9), rgba(59, 130, 246, 0.16));
}

.weather-stat--vpd {
  background: linear-gradient(135deg, rgba(237, 242, 247, 0.9), rgba(129, 140, 248, 0.16));
}

.weather-stat--soil {
  background: linear-gradient(135deg, rgba(237, 247, 237, 0.9), rgba(34, 197, 94, 0.16));
}

.weather-stat--humidity {
  background: linear-gradient(135deg, rgba(240, 249, 255, 0.9), rgba(56, 189, 248, 0.16));
}

.forecast-time {
  font-size: 0.7rem;
  font-weight: 700;
  color: #495057;
  margin-bottom: 0.35rem;
}

.forecast-temp {
  font-size: 1rem;
  font-weight: 700;
  color: #212529;
}

.forecast-rain {
  font-size: 0.7rem;
  color: #0284c7;
  margin-top: 0.2rem;
}

.forecast-prob {
  font-size: 0.65rem;
  color: #6c757d;
}

/* ── 6. Geräte-Cards ──────────────────────────────────────────────────── */
.geraet-card {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  border-top: 3px solid transparent;
}

.geraet-card--aktiv {
  border-top-color: #22c55e;
}

.geraet-card--offline {
  border-top-color: #6c757d;
}

.geraet-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1) !important;
}

/* Online-Puls-Indikator */
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot--online {
  background: #22c55e;
  animation: dotPulse 2s ease-in-out infinite;
}

.status-dot--offline {
  background: #adb5bd;
}

@keyframes dotPulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
  }

  50% {
    box-shadow: 0 0 0 5px rgba(34, 197, 94, 0);
  }
}

/* ── 7. Tabelle ───────────────────────────────────────────────────────── */
.table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6c757d;
  font-weight: 600;
  white-space: nowrap;
  border-bottom-width: 2px;
}

.table td {
  vertical-align: middle;
}

/* Check-Icon */
.check-yes {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #d1fae5;
  color: #15803d;
  font-size: 0.7rem;
}

.check-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f1f5f9;
  color: #94a3b8;
  font-size: 0.7rem;
}

/* ── 8. Auto-Refresh Indicator ────────────────────────────────────────── */
.refresh-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: #6c757d;
}

.refresh-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
}

.refresh-dot.refreshing {
  animation: refreshPulse 0.8s ease-in-out infinite;
}

@keyframes refreshPulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.4;
    transform: scale(0.6);
  }
}

/* ── 9. Fade-In ───────────────────────────────────────────────────────── */
.fade-in {
  animation: fadeInUp 0.35s ease both;
}

.fade-in-1 {
  animation-delay: 50ms;
}

.fade-in-2 {
  animation-delay: 100ms;
}

.fade-in-3 {
  animation-delay: 150ms;
}

.fade-in-4 {
  animation-delay: 200ms;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── 10. Utility ──────────────────────────────────────────────────────── */
.card {
  transition: box-shadow var(--transition-base);
}

.fallback-hint {
  font-size: 0.68rem;
  color: #f59e0b;
  font-weight: 500;
}

/* Notification ungelesen */
.notif-unread {
  background-color: #eff6ff !important;
  border-left: 3px solid #3b82f6;
}

/* Print */
@media print {

  .navbar,
  footer,
  .filter-bar,
  nav[aria-label*="Seiten"] {
    display: none !important;
  }

  body {
    background: white;
  }
}