/* ═══════════════════════════════════════════════════════════════════
   DUNKELMODUS
   Für die Nutzung bei Lichtempfindlichkeit. Eine weiße Fläche ins Gesicht
   ist genau das, was während einer Attacke nicht geht — und genau dann
   trägt man seinen Tag ein.

   Umgesetzt über die Farbvariablen, die alle Bereiche gemeinsam nutzen.
   Der Attackenplan war schon immer dunkel und bleibt unangetastet.

   Bewusst NICHT umgefärbt: die Schmerzskala im Kalender und die Ampel im
   Medikamenten-Check. Diese Farben tragen Bedeutung, sie sind keine
   Dekoration.
   ═══════════════════════════════════════════════════════════════════ */

:root[data-theme="dark"] {
  --white:         #1e1930;   /* Kartenflächen */
  --lavender:      #241d38;
  --lavender-soft: #221b34;
  --gray-light:    #262038;
  --gray-mid:      #332b4a;
  --gray-text:     #ede8f0;
  --text-muted:    #b0a8c4;
  --purple-dark:   #ede8f0;   /* Überschriften: hell auf dunkel */
  --purple-mid:    #a89ed6;
  --purple-light:  #3a3355;   /* Ränder und Linien */
  --mint:          #2f5a50;
  --teal:          #24443e;
  --teal-mid:      #7fc0b2;
  --shadow:        0 4px 20px rgba(0,0,0,0.45);
}

:root[data-theme="dark"] body { background: #14101f; color: var(--gray-text); }

/* Der Kopfbereich hat im hellen Modus eine Fläche, die ihn vom Inhalt trennt.
   Im Dunkelmodus wirkt dieselbe Fläche als heller Balken quer über den
   Bildschirm. Statt dessen ein sanfter Verlauf, der nach unten ausläuft, plus
   eine feine Kante — die Trennung bleibt, der Balken verschwindet. */
:root[data-theme="dark"] .app-header {
  background: linear-gradient(180deg, #221c34 0%, #191428 70%, rgba(20,16,31,0) 100%);
  border-bottom: 1px solid rgba(168,158,214,0.16);
}

/* Helle Statusflächen abdunkeln, Textfarbe bleibt erkennbar */
:root[data-theme="dark"] [style*="#ffebee"], :root[data-theme="dark"] .backup-hinweis.warn,
:root[data-theme="dark"] .meds-validation { background: #3a1f28 !important; color: #ffb4b4 !important; }
:root[data-theme="dark"] [style*="#e8f5e9"] { background: #1c3a24 !important; color: #a8e0b4 !important; }
:root[data-theme="dark"] [style*="#fff8e1"], :root[data-theme="dark"] [style*="#fff4d6"],
:root[data-theme="dark"] [style*="#fff3dc"] { background: #3a3220 !important; color: #f0d9a0 !important; }
/* Farbige Hinweisboxen, die ihre Bedeutung über die Farbe tragen: dunkler
   Grund derselben Farbfamilie statt der hellen Pastelltöne. */
:root[data-theme="dark"] .insight-box.green { background: #1c3a24; border-left-color: #4f9c63; }
:root[data-theme="dark"] .moh-warning.ok     { background: #1c3a24; color: #a8e0b4; border-left-color: #4f9c63; }
:root[data-theme="dark"] .moh-warning.watch  { background: #3a3220; color: #f0d9a0; border-left-color: #b08a3a; }
:root[data-theme="dark"] .moh-warning.danger { background: #3a1f28; color: #ffb4b4; border-left-color: #a05561; }
:root[data-theme="dark"] .migraine-toggle.active { background: #3a1f28; border-color: #a05561; }
:root[data-theme="dark"] .const-always { background: #3a1f28; color: #ffb4b4; border-color: #a05561; }
:root[data-theme="dark"] .help-note { background: var(--gray-light); color: var(--gray-text); }
:root[data-theme="dark"] .help-note.warn { background: #3a3220; color: #f0d9a0; }
:root[data-theme="dark"] .testmodus-banner { background: #3a3220; border-color: #7a6a3a; }
:root[data-theme="dark"] .testmodus-banner .tm-title,
:root[data-theme="dark"] .testmodus-banner .tm-text,
:root[data-theme="dark"] .testmodus-banner .tm-hint { color: #f0d9a0; }
:root[data-theme="dark"] .testmodus-banner .tm-btn { background: #241d38; color: #f0d9a0; border-color: #7a6a3a; }

/* Eingabefelder und Auswahlflächen */
:root[data-theme="dark"] input[type="text"], :root[data-theme="dark"] input[type="date"],
:root[data-theme="dark"] input[type="number"], :root[data-theme="dark"] textarea,
:root[data-theme="dark"] select {
  background: #1a1528; color: var(--gray-text); border-color: var(--purple-light);
}
:root[data-theme="dark"] input::placeholder, :root[data-theme="dark"] textarea::placeholder { color: #7d7595; }
:root[data-theme="dark"] .check-label, :root[data-theme="dark"] .q-radio, :root[data-theme="dark"] .q-checkbox {
  background: var(--gray-light); color: var(--gray-text);
}
:root[data-theme="dark"] .check-item:checked + .check-label {
  background: #3d3260; border-color: var(--purple-mid); color: #ffffff;
}

/* Der Einstieg zum Attackenplan ist im hellen Modus bewusst ein dunkler Kasten,
   damit er heraussticht. Im Dunkelmodus würde daraus ein weißer Kasten, also
   genau das Gegenteil. Stattdessen ein violetter Akzent, der sich abhebt,
   ohne zu leuchten. */
:root[data-theme="dark"] .attackenplan-entry { background: #332b52; color: var(--gray-text); }
:root[data-theme="dark"] .attackenplan-entry:hover { background: #3d3460; }

/* Die Übungsbilder haben weißen Hintergrund. Ganz abdunkeln geht nicht, man
   muss die Übung ja erkennen, aber leicht gedimmt blenden sie nicht mehr. */
:root[data-theme="dark"] .exercise-img,
:root[data-theme="dark"] .exercise-result-card img { filter: brightness(0.82); }

/* Das Logo ist dunkle Strichzeichnung auf transparentem Grund */
:root[data-theme="dark"] .print-logo, :root[data-theme="dark"] .logo { filter: invert(1) brightness(1.6); }

/* Der Ausdruck bleibt immer hell, Papier ist weiß */
@media print {
  :root[data-theme="dark"] { color-scheme: light; }
  :root[data-theme="dark"] body { background: #fff; color: #333; }
}


/* ═══════════════════════════════════════════════════════════════════
   SCHRIFTGRÖSSE
   Sämtliche Schriftgrößen der App stehen in rem, also reicht es, die
   Grundgröße zu drehen: alles skaliert mit, in jedem Bereich.
   Die Abstände bleiben in Pixeln stehen, dadurch wird es etwas kompakter
   statt einfach nur größer. Deshalb bewusst maßvolle Stufen.
   ═══════════════════════════════════════════════════════════════════ */
:root[data-fontsize="gross"]     { font-size: 112.5%; }
:root[data-fontsize="sehrgross"] { font-size: 125%; }

/* Ausdrucke bleiben in der Grundgröße. Das Blatt für den Arzttermin hat ein
   festes Layout, eine größere Bildschirmschrift würde es auseinanderziehen.
   Steht bewusst am Dateiende, damit es die Stufen oben überschreibt. */
@media print {
  :root[data-fontsize="gross"],
  :root[data-fontsize="sehrgross"] { font-size: 100%; }
}
