/* ============================================================
   Buchbestellung SOPÄDIE – gemeinsames Design für alle Seiten
   (index.html, datenschutz.html, impressum.html)
   Blau-Grau (Slate + Blue), Hell- und Dunkel-Theme.
   Das Theme wird VOR dem Rendering von einem Inline-Skript im
   <head> gesetzt (keine Flash); die Schalter-Logik liegt in
   theme.js.
   ============================================================ */

/* ---------- Farb-Design-System: Blau-Grau (Light + Dark) ---------- */
:root {
  /* Neutraltöne (Graublau / Slate) */
  --bg: #eef2f6;
  --bg-weich: #e2e8f0;
  --oberflaeche: #ffffff;
  --oberflaeche-weich: #f8fafc;
  --text: #0f172a;
  --text-gedaemt: #475569;
  --text-ruhig: #64748b;
  --linie: #cbd5e1;
  --linie-zart: #e2e8f0;
  /* Akzent: Blau */
  --akzent: #1d4ed8;
  --akzent-hover: #1e40af;
  --akzent-hell: #dbeafe;
  --akzent-text: #1e40af;
  --fokus: #2563eb;
  --btn-text: #ffffff;
  /* Status */
  --ok: #1d4ed8;
  --ok-hell: #dbeafe;
  --fehler: #b91c1c;
  --fehler-hell: #fee2e2;
  /* Tiefe */
  --schatten: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 12px rgba(15, 23, 42, .08);
  --schatten-groess: 0 4px 16px rgba(15, 23, 42, .14);
  --radius: 12px;
  --btn-sek-bg: #ffffff;
  --btn-sek-rand: #cbd5e1;
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #0b1220;
  --bg-weich: #111c33;
  --oberflaeche: #152238;
  --oberflaeche-weich: #1b2a44;
  --text: #e2e8f0;
  --text-gedaemt: #b6c2d6;
  --text-ruhig: #8fa0b8;
  --linie: #3b5378;
  --linie-zart: #2a3c5e;
  --akzent: #60a5fa;
  --akzent-hover: #3b82f6;
  --akzent-hell: #1e3a5f;
  --akzent-text: #93c5fd;
  --fokus: #60a5fa;
  --btn-text: #0b1220;
  --ok: #60a5fa;
  --ok-hell: #1e3a5f;
  --fehler: #f87171;
  --fehler-hell: #451a1a;
  --schatten: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .35);
  --schatten-groess: 0 4px 18px rgba(0, 0, 0, .5);
  --btn-sek-bg: #263a5e;
  --btn-sek-rand: #51698f;
  color-scheme: dark;
}

/* ---------- Basis ---------- */
* { box-sizing: border-box; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  margin: 0 auto;
  padding: 1.5rem 1.5rem 2.5rem;
  max-width: 46rem;
  line-height: 1.6;
  transition: background-color .25s ease, color .25s ease;
}
@media (prefers-reduced-motion: reduce) {
  *, body { transition: none !important; }
}

/* ---------- Typografie & Links ---------- */
h1 { font-size: 1.75rem; margin: 0 0 .35rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 2rem 0 .5rem; }
p, label, legend { font-size: 1rem; }
address { font-style: normal; }
a { color: var(--akzent-text); text-decoration: underline; text-underline-offset: 2px; font-weight: 600; }

/* ---------- Kopfzeile (alle Seiten: Titel + Theme-Schalter) ---------- */
.kopf {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.titel-intro { margin: 0; color: var(--text-gedaemt); max-width: 38rem; }
.themeschalter {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  color: var(--akzent-text);
  background: var(--oberflaeche);
  border: 1px solid var(--linie);
  border-radius: 999px;
  padding: .45rem .95rem;
  cursor: pointer;
  box-shadow: var(--schatten);
  transition: border-color .15s ease, background-color .15s ease;
  white-space: nowrap;
}
.themeschalter:hover:not(:disabled) { border-color: var(--akzent); background: var(--oberflaeche-weich); }
.themeschalter svg { width: 1.05em; height: 1.05em; flex: none; }

/* ---------- Sprunglink (Datenschutz / Impressum) ---------- */
.skip-link {
  position: absolute; left: -999px; top: 0; background: #1d4ed8; color: #fff;
  padding: .6rem .9rem; border-radius: 0 0 8px 0; font-weight: 700; z-index: 10;
  text-decoration: none;
}
.skip-link:focus { left: 0; }

/* ---------- Fokus ---------- */
input:focus, select:focus, textarea:focus, button:focus, a:focus,
.themeschalter:focus {
  outline: 3px solid var(--fokus);
  outline-offset: 2px;
  border-color: var(--akzent);
}

/* ---------- Karten (Fieldsets) ---------- */
fieldset {
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 1.1rem 1.35rem 1.35rem;
  margin: 0 0 1.25rem;
  background: var(--oberflaeche);
  box-shadow: var(--schatten);
  transition: background-color .25s ease, border-color .25s ease;
}
legend {
  padding: 0 .5rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--akzent-text);
}
/* Gruppentitel in Fieldsets sind echte h2-Ueberschriften (Screenreader-
   Ueberschriften-Navigation); der h2-Standard-Abstand gilt hier nicht */
legend h2 { margin: 0; font-size: 1.15rem; }
.zeile { margin: .75rem 0; }
label { display: block; font-weight: 600; margin-bottom: .3rem; }

/* ---------- Eingabefelder ---------- */
input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
  font: inherit;
  padding: .55rem .75rem;
  border: 1px solid var(--linie);
  border-radius: 8px;
  width: 100%;
  max-width: 30rem;
  background: var(--oberflaeche);
  color: var(--text);
  transition: border-color .15s ease, background-color .25s ease;
}
input::placeholder { color: var(--text-ruhig); opacity: 1; }
input:hover:not(:disabled), select:hover:not(:disabled), textarea:hover:not(:disabled) { border-color: var(--akzent); }
input:disabled, select:disabled, textarea:disabled { background: var(--oberflaeche-weich); color: var(--text-ruhig); }
textarea { min-height: 5rem; }

/* ---------- Buttons ---------- */
button, .btn {
  font: inherit;
  font-weight: 600;
  padding: .6rem 1.2rem;
  border: 1px solid var(--akzent);
  border-radius: 8px;
  background: var(--akzent);
  color: var(--btn-text);
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, transform .1s ease;
}
button:hover:not(:disabled), .btn:hover:not(:disabled) { background: var(--akzent-hover); }
button:active:not(:disabled), .btn:active:not(:disabled) { transform: translateY(1px); }
.btn-sekundaer {
  background: var(--btn-sek-bg);
  color: var(--akzent-text);
  border-color: var(--btn-sek-rand);
}
.btn-sekundaer:hover:not(:disabled) { background: var(--oberflaeche-weich); border-color: var(--akzent); }
html[data-theme="dark"] .btn-sekundaer:hover:not(:disabled) { background: #2d4368; }
button:disabled { opacity: .55; cursor: not-allowed; }
/* Textlink-Optik für Aktionen ohne Button-Rahmen (z. B. "Passwort vergessen?") */
.link-btn {
  background: none;
  border: none;
  padding: 0;
  margin-top: .4rem;
  font: inherit;
  font-size: .95rem;
  color: var(--akzent-text);
  text-decoration: underline;
  cursor: pointer;
}
.link-btn:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }
/* Das "hidden"-Attribut darf von display-Regeln nicht ueberschrieben
   werden – sonst waere z. B. die Userbar trotz "hidden"-Attribut auch
   im nicht angemeldeten Zustand sichtbar. */
[hidden] { display: none !important; }

/* ---------- Hinweise & Meldungen ---------- */
.hinweis { font-size: .9rem; color: var(--text-ruhig); margin: .25rem 0; }
.mz-hinweis { font-size: .78rem; color: var(--text-ruhig); margin-top: .2rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.fehlermeldung {
  color: var(--fehler);
  font-weight: 600;
  background: var(--fehler-hell);
  border-left: 4px solid var(--fehler);
  border-radius: 0 8px 8px 0;
  padding: .55rem .8rem;
  margin: .5rem 0;
}
.okmeldung {
  color: var(--ok);
  font-weight: 600;
  background: var(--ok-hell);
  border-left: 4px solid var(--ok);
  border-radius: 0 8px 8px 0;
  padding: .55rem .8rem;
  margin: .5rem 0;
}
/* Honeypot: für Menschen unsichtbar, für Bots vorhanden */
.honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---------- Anmeldung (index.html) ---------- */
.anmeldung {
  max-width: 26rem;
  margin: 2rem auto 2rem;
}
.userbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  border: 1px solid var(--linie);
  border-left: 4px solid var(--akzent);
  background: var(--akzent-hell);
  border-radius: var(--radius);
  padding: .6rem 1rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--schatten);
}
.userbar-knöpfe { display: flex; gap: .6rem; flex-wrap: wrap; }

/* ---------- Buchsuche (Autocomplete, index.html) ---------- */
.suche-wrap { position: relative; max-width: 30rem; }
ul.suchliste {
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
  border: 1px solid var(--linie);
  border-radius: 8px;
  max-height: 15rem;
  overflow-y: auto;
  background: var(--oberflaeche);
  position: absolute;
  z-index: 5;
  width: 100%;
  box-shadow: var(--schatten-groess);
  overscroll-behavior: contain;
}
ul.suchliste li {
  padding: .55rem .75rem;
  border-bottom: 1px solid var(--linie-zart);
  cursor: pointer;
  transition: background-color .1s ease;
}
ul.suchliste li:last-child { border-bottom: 0; }
ul.suchliste li:hover { background: var(--oberflaeche-weich); }
ul.suchliste li[aria-selected="true"] {
  background: var(--akzent-hell);
  font-weight: 600;
}
ul.suchliste .isbn { font-weight: 400; font-size: .88rem; color: var(--text-ruhig); }
ul.suchliste .meta { font-weight: 400; font-size: .85rem; color: var(--text-ruhig); }

/* ---------- Warenkorb (index.html) ---------- */
ul.warenkorb { list-style: none; padding: 0; }
ul.warenkorb > li {
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: .9rem 1.1rem;
  margin-bottom: .8rem;
  background: var(--oberflaeche-weich);
  box-shadow: var(--schatten);
}
.wk-titel { font-weight: 700; }
/* Büchertitel im Warenkorb sind h4 (unter h3 "Warenkorb" in der h2-Gruppe
   "2. Buchauswahl") -> per Screenreader-Überschriften-Navigation
   (z. B. NVDA: Taste H) ansteuerbar */
h4.wk-titel { font-size: 1.05rem; margin: 0 0 .4rem; }
.wk-aktionen { margin-top: .6rem; display: flex; gap: .6rem; flex-wrap: wrap; }
.radio-gruppe { display: flex; gap: 1.25rem; margin: .35rem 0; }
.radio-gruppe label { font-weight: 400; display: flex; gap: .4rem; align-items: center; cursor: pointer; }
.radio-gruppe input { width: 1.15rem; height: 1.15rem; margin: 0; accent-color: var(--akzent); }
.wk-mz { margin-top: .5rem; }
.ausblenden { display: none; }

/* ---------- Hauptnavigation (Tab-Leiste auf index.html / bestellungen.html) ---------- */
.hauptnav {
  display: flex;
  gap: .25rem;
  flex-wrap: wrap;
  margin: 0 0 1.5rem;
  border-bottom: 1px solid var(--linie);
}
.hauptnav a {
  padding: .55rem 1rem;
  text-decoration: none;
  font-weight: 600;
  font-size: .95rem;
  color: var(--text-gedaemt);
  border-radius: 8px 8px 0 0;
}
.hauptnav a:hover { color: var(--akzent-text); background: var(--oberflaeche-weich); }
.hauptnav a[aria-current="page"] { color: var(--akzent-text); border-bottom: 3px solid var(--akzent); }

/* ---------- Bestelübersicht (bestellungen.html) ---------- */
body.seite-bestellungen { max-width: 72rem; }

/* ---------- SBBZ-Einstiegsseite (sbbz/index.html) ---------- */
body.seite-sbbz { max-width: 72rem; }
/* ISBN- und ID-Spalten brechen nicht um (SBBZ-Tabellen) */
.id-zelle { white-space: nowrap; font-variant-numeric: tabular-nums; }
.schueler-karte { margin: 1.5rem 0; }
.schueler-karte h2 { margin: 0 0 .5rem; font-size: 1.15rem; }
.tabelle-wrap {
  overflow-x: auto;
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  background: var(--oberflaeche);
  box-shadow: var(--schatten);
}
table.bestelltabelle { width: 100%; border-collapse: collapse; font-size: .92rem; }
.bestelltabelle th {
  text-align: left;
  padding: .55rem .7rem;
  border-bottom: 2px solid var(--linie);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--text-gedaemt);
  white-space: nowrap;
}
.bestelltabelle td {
  padding: .5rem .7rem;
  border-bottom: 1px solid var(--linie-zart);
  vertical-align: top;
}
.bestelltabelle tbody tr:last-child td { border-bottom: none; }
.bestelltabelle tbody tr:hover td { background: var(--oberflaeche-weich); }
.bestelltabelle .isbn { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* SBBZ: Lade-Hinweis „Daten werden geladen“ (Live-Region, textbasiert) */
#daten-laden:empty { display: none; }
#daten-laden:not(:empty) { color: var(--text-gedaemt); min-height: 1.4rem; }
#daten-laden::before {
  content: "";
  display: inline-block;
  width: 0.9rem;
  height: 0.9rem;
  margin-right: 0.5rem;
  border: 2px solid var(--linie);
  border-top-color: var(--akzent);
  border-radius: 50%;
  vertical-align: -0.15rem;
}
@media (prefers-reduced-motion: no-preference) {
  #daten-laden:not(:empty)::before { animation: daten-laden-dreht 1s linear infinite; }
}
@keyframes daten-laden-dreht { to { transform: rotate(360deg); } }

/* ---------- SBBZ-Bestellliste (sbbz/index.html) ---------- */
.anzahl-input { width: 5.5rem; max-width: 5.5rem; }
.zell-button { padding: .35rem .7rem; font-size: .85rem; }

/* ---------- Seitennavigation (Datenschutz / Impressum) ---------- */
.zurueck { display: inline-block; margin-bottom: 1rem; }

/* ---------- Footer (alle Seiten) ---------- */
footer { margin-top: 2.5rem; font-size: .85rem; color: var(--text-gedaemt); border-top: 1px solid var(--linie-zart); padding-top: .75rem; }
footer a { color: var(--akzent-text); }

/* ---------- BLUBS-Verwaltung: Kurskarten + Anmeldetabelle ---------- */
.kurskarte {
  border: 1px solid var(--linie);
  border-radius: .6rem;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  background: var(--oberflaeche);
}
.kurskarte h2 { margin: 0 0 .25rem; font-size: 1.15rem; }
.kurskarte .hinweis { margin: 0 0 .75rem; }
.tabelle-wrap { overflow-x: auto; }
table.anmeldetabelle { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 60rem; }
table.anmeldetabelle caption {
  text-align: left;
  font-weight: 600;
  padding-bottom: .4rem;
  color: var(--text-gedaemt);
}
table.anmeldetabelle th {
  text-align: left;
  padding: .5rem .7rem;
  border-bottom: 2px solid var(--linie);
  background: var(--oberflaeche-weich);
  white-space: nowrap;
  font-size: .85rem;
}
table.anmeldetabelle td {
  padding: .5rem .7rem;
  border-bottom: 1px solid var(--linie-zart);
  vertical-align: top;
}
table.anmeldetabelle tbody tr:last-child td { border-bottom: none; }
table.anmeldetabelle tbody tr:hover td { background: var(--oberflaeche-weich); }

/* ===== Lehrkräfte-Portal: Modul-Tabs und Modul-Kopf ===== */
.modulnav {
  display: flex;
  gap: .4rem;
  margin: .25rem 0 .5rem;
  border-bottom: 2px solid var(--linie);
}
.modul-tab {
  padding: .55rem 1.1rem;
  font-size: 1rem;
  border: 1px solid var(--linie);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--oberflaeche-weich);
  color: var(--text);
  cursor: pointer;
}
.modul-tab:hover { background: var(--akzent-hell); }
.modul-tab[aria-pressed="true"] {
  background: var(--akzent);
  border-color: var(--akzent);
  color: var(--btn-text);
  font-weight: 600;
}
.modul-titel { margin: .25rem 0 .5rem; font-size: 1.3rem; }

/* ===== Lehrkräfte-Portal: Modul-Karten (große Buttons) ===== */
.modul-karten {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}
.modul-karte {
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: 1.2rem 1.4rem;
  min-height: 110px;
  background: var(--oberflaeche);
  border: 2px solid var(--linie);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  transition: border-color .15s ease, background .15s ease;
}
.modul-karte:hover,
.modul-karte:focus-visible {
  border-color: var(--akzent);
  background: var(--oberflaeche-weich);
  outline: 3px solid var(--akzent-hell);
  outline-offset: 2px;
}
.modul-karte-inhalt { display: block; flex: 1; }
.modul-karte-titel {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: .25rem;
}
.modul-karte-desc { display: block; color: var(--text); font-size: .95rem; }
