/* ═══════════════════════════════════════════════════════════════
   Life & Finance OS — AuDHD Design System
   Philosophie:
     • Kein visueller Lärm — monochrom + Pastell
     • Keine roten Warnungen — Amber/Korall statt Rot
     • Große Tap-Targets (min. 48px) — einfache Motorik
     • Weiche Übergänge — keine abrupten Wechsel
     • Dark Mode als Standard — reduziert Lichtempfindlichkeit
   ═══════════════════════════════════════════════════════════════ */

/* ─── Design Tokens ───────────────────────────────────────────── */
:root {
  /* Basis-Farben (Dark Mode Standard) */
  --bg:          #0a0a12;
  --bg-2:        #141420;
  --bg-3:        #1c1c2e;
  --bg-card:     #161622;
  --border:      #252538;
  --border-soft: #1e1e30;

  /* Text */
  --text-1:      #e8eaf6;
  --text-2:      #9fa8bc;
  --text-3:      #5c6370;

  /* Akzentfarbe — ruhiges Violett */
  --accent:      #8B5CF6;
  --accent-h:    #7C3AED;
  --accent-soft: rgba(139, 92, 246, 0.12);

  /* Energie-Level (AuDHD: Spoon Theory) */
  --energy-high:   #52C41A;  /* Salbeigrün  */
  --energy-medium: #FAAD14;  /* Warmes Gelb */
  --energy-low:    #FF8C69;  /* Weiches Korall — KEIN Rot! */

  /* Visuelle Rollen-Tags (Pastell) */
  --tag-vater:      #B8D4FF;
  --tag-mutter:     #FFB8D4;
  --tag-kind:       #B8FFD4;
  --tag-mitbewohner:#FFD4B8;
  --tag-hund:       #D4B8FF;
  --tag-default:    #C8D0E0;

  /* Status-Farben (kein Knallrot!) */
  --success:  #52C41A;
  --warning:  #FAAD14;
  --caution:  #FF8C69;   /* Sanftes Korall statt Rot */
  --info:     #40A9FF;
  --reset:    #8B5CF6;   /* "Reset" = Chance, keine Strafe */

  /* Geometrie */
  --radius:     12px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --radius-full: 9999px;

  /* Abstände */
  --gap:    1rem;
  --gap-sm: 0.5rem;
  --gap-lg: 1.5rem;

  /* Timing */
  --transition: 220ms ease;
  --transition-slow: 400ms ease;

  /* Bottom-Navigation Höhe (für safe-area) */
  --nav-h: 68px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ─── Basis-Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-tap-highlight-color: transparent; }

body {
  background: var(--bg);
  color: var(--text-1);
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  overscroll-behavior: none;
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom));
}

/* Scrollbar (Webkit) */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ─── Fokus-Ring (Accessibility) ──────────────────────────────── */
:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 1px var(--accent);
  border-radius: var(--radius);
}

/* ─── Typografie ──────────────────────────────────────────────── */
h1, h2, h3 { color: var(--text-1); font-weight: 600; line-height: 1.3; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }

.text-muted  { color: var(--text-2); }
.text-subtle { color: var(--text-3); }

/* ─── Karten ──────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.125rem;
  transition: border-color var(--transition);
}
.card:hover { border-color: var(--border-soft); }
.card-interactive {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.card-interactive:active { transform: scale(0.98); }

/* ─── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;        /* Großes Tap-Target */
  min-width: 48px;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9375rem;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.96); }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-h); }

.btn-ghost {
  background: var(--accent-soft);
  color: var(--accent);
}
.btn-ghost:hover { background: rgba(139,92,246,0.2); }

.btn-surface {
  background: var(--bg-3);
  color: var(--text-1);
  border: 1px solid var(--border);
}
.btn-surface:hover { border-color: var(--accent); }

.btn-danger {
  /* Kein Knallrot! Sanftes Korall */
  background: rgba(255, 140, 105, 0.15);
  color: var(--caution);
  border: 1px solid rgba(255, 140, 105, 0.25);
}

.btn-sm {
  min-height: 36px;
  padding: 0.4rem 0.875rem;
  font-size: 0.875rem;
}

.btn-icon {
  padding: 0.75rem;
  border-radius: var(--radius-full);
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-2);
}
.btn-icon:hover { color: var(--accent); border-color: var(--accent); }

/* ─── FAB (Floating Action Button) ───────────────────────────── */
.fab {
  position: fixed;
  bottom: calc(var(--nav-h) + 1rem + var(--safe-bottom));
  right: 1rem;
  width: 60px;
  height: 60px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
  transition: all var(--transition);
  z-index: 30;
}
.fab:active { transform: scale(0.9); }
.fab:hover  { box-shadow: 0 4px 28px rgba(139, 92, 246, 0.6); }

/* ─── Energie-Level-Badges ────────────────────────────────────── */
.energy-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.625rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}
.energy-badge.high   { background: rgba(82,196,26,0.15);  color: var(--energy-high); }
.energy-badge.medium { background: rgba(250,173,20,0.15); color: var(--energy-medium); }
.energy-badge.low    { background: rgba(255,140,105,0.15);color: var(--energy-low); }

/* ─── Visuelle Rollen-Tags ────────────────────────────────────── */
.role-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
[data-tag="Vater"]       { background: rgba(184,212,255,0.15); color: var(--tag-vater); }
[data-tag="Mutter"]      { background: rgba(255,184,212,0.15); color: var(--tag-mutter); }
[data-tag="Kind"]        { background: rgba(184,255,212,0.15); color: var(--tag-kind); }
[data-tag="Mitbewohner"] { background: rgba(255,212,184,0.15); color: var(--tag-mitbewohner); }
[data-tag="Hund"]        { background: rgba(212,184,255,0.15); color: var(--tag-hund); }

/* ─── Aufgaben-Karten ─────────────────────────────────────────── */
.task-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all var(--transition);
  cursor: pointer;
}
.task-card:hover { border-color: var(--accent); background: var(--bg-3); }
.task-card.done  { opacity: 0.4; }
.task-card.done .task-title { text-decoration: line-through; color: var(--text-3); }

.task-check {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border);
  flex-shrink: 0;
  margin-top: 0.125rem;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.task-card:hover .task-check { border-color: var(--accent); }
.task-check.checked { background: var(--accent); border-color: var(--accent); }
.task-check.checked::after { content: '✓'; color: #fff; font-size: 0.75rem; font-weight: 700; }

.task-title { font-size: 0.9375rem; color: var(--text-1); line-height: 1.4; }
.task-meta  { font-size: 0.75rem;   color: var(--text-3); margin-top: 0.2rem; }

/* ─── Bottom Navigation ───────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  inset-x: 0;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  z-index: 40;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  padding: 0.75rem 0.5rem;
  color: var(--text-3);
  cursor: pointer;
  transition: color var(--transition);
  text-decoration: none;
  min-height: 48px;
  border: none;
  background: none;
  -webkit-tap-highlight-color: transparent;
}
.nav-item.active   { color: var(--accent); }
.nav-item:hover    { color: var(--text-2); }
.nav-item .nav-icon { font-size: 1.375rem; }
.nav-item .nav-label{ font-size: 0.65rem; font-weight: 500; letter-spacing: 0.02em; }

/* ─── Überschrift-Bereich ─────────────────────────────────────── */
.page-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg)/80;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ─── Toasts (vorwurfsfrei) ───────────────────────────────────── */
.toast {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  color: var(--text-1);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  gap: 0.625rem;
  pointer-events: auto;
  animation: toast-in 0.3s ease forwards;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.reset   { border-left: 3px solid var(--reset); }  /* Kein "error"! */

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Animationen ─────────────────────────────────────────────── */
.fade-in  { animation: fade-in  var(--transition) ease forwards; }
.slide-up { animation: slide-up var(--transition) ease forwards; }

@keyframes fade-in  {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slide-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Hyperfocus-Overlay ──────────────────────────────────────── */
.hyperfocus-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  animation: fade-in 0.4s ease;
}

/* ─── Fortschritts-Ring (visueller Timer) ─────────────────────── */
.timer-ring { transform: rotate(-90deg); }
.timer-ring-track { fill: none; stroke: var(--bg-3); stroke-width: 8; }
.timer-ring-progress {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear, stroke 0.5s ease;
}

/* ─── Dopamin-Menü ────────────────────────────────────────────── */
.dopamine-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition);
}
.dopamine-item:hover { border-color: var(--accent); background: var(--accent-soft); }
.dopamine-item:active { transform: scale(0.97); }

/* ─── Streak-Anzeige (nicht bestrafend) ───────────────────────── */
.streak-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}
.streak-dot.done   { background: var(--success); }
.streak-dot.skip   { background: var(--warning); }    /* Pause, kein Versagen */
.streak-dot.missed { background: var(--bg-3); border: 1px solid var(--border); }
/* KEIN Rot für verpasste Tage */

/* ─── Input-Felder ────────────────────────────────────────────── */
input, textarea, select {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-1);
  padding: 0.75rem 1rem;
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  transition: border-color var(--transition);
  min-height: 48px;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input::placeholder { color: var(--text-3); }

label {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-2);
  font-weight: 500;
  margin-bottom: 0.375rem;
}

/* ─── Seiten-Layout ───────────────────────────────────────────── */
.page { padding: 0 1rem 1rem; animation: fade-in 0.25s ease; }
.section { margin-bottom: 1.5rem; }
.section-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}

/* ─── Kein-Inhalt-Platzhalter ─────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
  gap: 0.75rem;
}
.empty-state .icon { font-size: 2.5rem; }
.empty-state p { color: var(--text-3); font-size: 0.875rem; line-height: 1.6; }

/* ─── Skeleton Loader ─────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-3) 25%,
    var(--bg-2) 50%,
    var(--bg-3) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ─── Safe Area Fixes (iPhone Notch) ─────────────────────────── */
@supports (padding-top: env(safe-area-inset-top)) {
  .page-header { padding-top: calc(0.875rem + env(safe-area-inset-top)); }
}
