/* ============================================================
   ABS-Leitfaden — Komponenten
   Klinikum Landau-Südliche Weinstraße

   Diese Datei übernimmt das bestehende Erscheinungsbild eins zu eins aus der
   bisherigen index.html — nur mit Tokens statt fester Farbwerte. Ohne diesen
   Schritt fielen Light und Dark immer wieder auseinander, weil dieselben
   Bausteine an hunderten Stellen inline und leicht abweichend definiert waren.

   Regel: hier und in tokens.css stehen alle Farben. Nirgendwo sonst.
   Geprüft durch tools/check-design-tokens.mjs.
   ============================================================ */

/* ---------------------------------------------------------- Grundgerüst */

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  padding-bottom: 72px;              /* Platz für die Navigationsleiste */
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  background: var(--surface-page);
  color: var(--text-body);
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }

.abs-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 12px 16px 24px;
  max-width: 900px;
  margin: 0 auto;
}

.abs-stack { display: flex; flex-direction: column; gap: 10px; }
.abs-row   { display: flex; align-items: center; gap: 8px; }
.abs-spread{ display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ------------------------------------------------------------- Kopfzeile */

.abs-header {
  position: sticky; top: 0; z-index: 30;
  background: var(--surface-bar);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-default);
  padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.abs-logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--drug-fluoroquinolon));
  display: flex; align-items: center; justify-content: center;
  color: hsl(0, 0%, 100%);
  flex-shrink: 0;
}
.abs-title    { font-size: 15px; font-weight: 700; line-height: 1.2; color: var(--text-heading); margin: 0; }
.abs-subtitle { font-size: 11px; font-weight: 500; color: var(--primary-muted); margin: 0; }

.abs-btn {
  padding: 6px 10px; border-radius: 10px;
  font-size: 11px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid transparent;
  transition: opacity 0.15s, background 0.15s;
}
.abs-btn:hover { opacity: 0.85; }
.abs-btn-ghost   { background: var(--surface-input); color: var(--text-muted); border-color: var(--border-default); }
.abs-btn-pdf     { background: var(--sev-critical); color: hsl(0, 0%, 100%); }
.abs-btn-admin   { background: var(--drug-fluoroquinolon); color: hsl(0, 0%, 100%); }
.abs-btn-icon    { padding: 7px; border-radius: 10px; background: var(--surface-input); color: var(--text-muted); border: 1px solid var(--border-default); }

/* ----------------------------------------------------------------- Suche */

.abs-search { position: relative; }
.abs-search svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--text-disabled); pointer-events: none;
}
.abs-input {
  width: 100%;
  background: var(--surface-card);
  color: var(--text-body);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 10px 14px 10px 38px;
  font-size: var(--font-size-base);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.abs-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus-ring); }
.abs-input::placeholder { color: var(--text-disabled); }

/* ----------------------------------------------------------------- Karten */

.abs-card {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}
.abs-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

/* Listeneintrag — Startseite, Kataloge. Optik wie bisher der Schnellzugriff. */
.quick-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px;
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
  text-align: left; width: 100%;
}
.quick-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-hover);
  background: var(--surface-hover);
}
.quick-card-title { font-size: 14px; font-weight: 600; color: var(--text-heading); }
.quick-card-sub   { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.quick-card-icon {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* Gruppenfläche */
.ind-group {
  background: var(--surface-group);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.ind-group-head {
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border-default);
  padding-bottom: 10px; margin-bottom: 12px;
}

/* Therapiekarte */
.therapie-card {
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.therapie-card-primary { border: 1px solid var(--primary); background: var(--primary-light); }

.therapie-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--primary); margin-bottom: 6px;
}
.therapie-label-alt { color: var(--text-muted); }

/* --------------------------------------------------------- Überschriften */

.abs-h1 { font-size: 17px; font-weight: 700; color: var(--text-heading); margin: 0; }
.abs-h2 { font-size: 15px; font-weight: 700; color: var(--text-heading); margin: 0; }
.abs-h3 { font-size: 13px; font-weight: 600; color: var(--text-heading); margin: 0; }
.abs-eyebrow {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); margin-bottom: 8px;
}
.abs-muted { font-size: 12px; color: var(--text-muted); }
.abs-meta  { font-size: 11px; color: var(--text-muted); }

/* ---------------------------------------------------------------- Badges */

.badge {
  border-radius: 9999px;
  font-size: var(--font-size-xs);
  font-weight: 600;
  padding: 2px 9px;
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid;
  white-space: nowrap;
}
.badge-safe     { background: var(--sev-safe-bg);     color: var(--sev-safe);     border-color: var(--sev-safe-border); }
.badge-warning  { background: var(--sev-warning-bg);  color: var(--sev-warning);  border-color: var(--sev-warning-border); }
.badge-critical { background: var(--sev-critical-bg); color: var(--sev-critical); border-color: var(--sev-critical-border); font-weight: 700; }
.badge-neutral  { background: var(--surface-input);   color: var(--text-muted);   border-color: var(--border-default); }

.badge-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; background: currentColor; }

.drug-cls-badge {
  font-size: 0.6rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 4px; border: 1px solid;
  background: var(--surface-input); color: var(--text-muted); border-color: var(--border-default);
}

/* Kennzeichnung der Wissensebene — Nachschlagewissen ist keine Hausempfehlung */
.ebene-hinweis {
  font-size: 11px; color: var(--text-muted);
  background: var(--surface-input);
  border: 1px dashed var(--border-default);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
}

/* ----------------------------------------------------------------- Links */

.wirkstoff-btn {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: var(--link-underline);
  text-underline-offset: 3px;
  font-weight: 600;
  transition: color 0.1s;
}
.wirkstoff-btn:hover { color: var(--link-hover); }

.abs-link { color: var(--link); font-weight: 600; }
.abs-link:hover { color: var(--link-hover); text-decoration: underline; text-underline-offset: 3px; }

/* Externer Link, z. B. dosing.de */
.abs-link-extern::after {
  content: " ↗";
  font-size: 0.85em;
  color: var(--text-muted);
}

/* --------------------------------------------------------- Hinweisblöcke */

.notice {
  border-left: 4px solid;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 12px 14px;
  display: flex; gap: 10px; align-items: flex-start;
}
.notice-warning  { background: var(--sev-warning-bg);  border-color: var(--sev-warning); }
.notice-critical { background: var(--sev-critical-bg); border-color: var(--sev-critical); }
.notice-info     { background: var(--primary-light);   border-color: var(--primary); }
.notice-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 2px;
}
.notice-warning  .notice-title { color: var(--sev-warning); }
.notice-critical .notice-title { color: var(--sev-critical); }
.notice-info     .notice-title { color: var(--primary); }
.notice-body { font-size: 12px; color: var(--text-body); }

/* Severity-Leiste links an der Karte */
.sev-bar-safe     { border-left: 3px solid var(--sev-safe); }
.sev-bar-warning  { border-left: 3px solid var(--sev-warning); }
.sev-bar-critical { border-left: 3px solid var(--sev-critical); }

/* ------------------------------------------------------------ Checkliste */

.checkliste { display: flex; flex-direction: column; gap: 8px; }
.check-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 10px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.check-item:hover { border-color: var(--border-hover); background: var(--surface-hover); }
.check-item input[type="checkbox"] {
  width: 17px; height: 17px; margin: 1px 0 0; flex-shrink: 0;
  accent-color: var(--primary); cursor: pointer;
}
.check-label   { font-size: 13px; color: var(--text-body); }
.check-hint    { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.check-gruppe  { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); margin: 10px 0 2px; }

.score-ergebnis {
  display: inline-flex; align-items: baseline; gap: 8px;
  padding: 8px 14px; border-radius: var(--radius-md);
  background: var(--surface-input); border: 1px solid var(--border-default);
  font-size: 14px; font-weight: 700; color: var(--text-heading);
}

/* -------------------------------------------------------- Diagnostikblock
   Bewusst als eigener, gleichrangiger Abschnitt — nicht mehr als kursive
   Kleinschrift unter der Überschrift, wo er übersehen wurde. */

.diagnostik-block {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}
.diagnostik-liste { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.diagnostik-item {
  font-size: 12px; padding: 4px 10px; border-radius: 9999px;
  background: var(--surface-input); color: var(--text-body);
  border: 1px solid var(--border-default);
}

/* ------------------------------------------------------- Spektrum-Matrix */

.matrix-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.matrix {
  border-collapse: separate; border-spacing: 0;
  width: 100%; font-size: 12px;
}
.matrix th, .matrix td {
  border-bottom: 1px solid var(--border-subtle);
  padding: 7px 9px; text-align: center; white-space: nowrap;
}
.matrix thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-group);
  color: var(--text-muted);
  font-size: 11px; font-weight: 600;
  border-bottom: 1px solid var(--border-default);
}
.matrix tbody th, .matrix thead th:first-child {
  position: sticky; left: 0; z-index: 1;
  background: var(--surface-card);
  text-align: left; font-weight: 600; color: var(--text-heading);
  border-right: 1px solid var(--border-default);
}
.matrix thead th:first-child { z-index: 3; background: var(--surface-group); }
.matrix tbody tr:hover td, .matrix tbody tr:hover th { background: var(--surface-hover); }

/* Köpfe und Zellen sind Schaltflächen — jede öffnet die zugehörige Karte */
.matrix-head-btn { color: var(--link); font-weight: 600; }
.matrix-head-btn:hover { color: var(--link-hover); text-decoration: underline; text-underline-offset: 3px; }
.matrix-zelle { width: 100%; height: 100%; padding: 2px; border-radius: 4px; font-size: 13px; line-height: 1; }
.matrix-zelle:hover { background: var(--surface-input); outline: 1px solid var(--border-hover); }
.zelle-wirksam   { color: var(--spek-wirksam); }
.zelle-luecke    { color: var(--spek-luecke); }
.zelle-variabel  { color: var(--sev-warning); }
.zelle-unbekannt { color: var(--spek-unbekannt); }

.matrix-legende { display: flex; flex-wrap: wrap; gap: 14px; font-size: 11px; color: var(--text-muted); margin-top: 10px; }

/* ---------------------------------------------------------------- Modal */

.modal-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: var(--overlay);
  backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
}
@media (min-width: 640px) {
  .modal-overlay { align-items: center; padding: 24px; }
}
.modal-box {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%; max-width: 560px;
  max-height: 88vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-xl);
}
@media (min-width: 640px) { .modal-box { border-radius: var(--radius-xl); } }
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border-default);
}
.modal-body { padding: 16px 18px 24px; overflow-y: auto; }
.modal-close { padding: 4px 8px; border-radius: 8px; color: var(--text-muted); font-size: 18px; line-height: 1; }
.modal-close:hover { background: var(--surface-hover); color: var(--text-body); }

/* Feldgruppen der Objektkarte */
.feld-gruppe { margin-top: 18px; }
.feld-gruppe:first-child { margin-top: 0; }
.feld-gruppe-titel {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted);
  padding-bottom: 6px; margin-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}
.feld { display: grid; grid-template-columns: 1fr; gap: 2px; margin-bottom: 10px; }
@media (min-width: 480px) { .feld { grid-template-columns: 150px 1fr; gap: 12px; } }
.feld-label { font-size: 11px; font-weight: 600; color: var(--text-muted); }
.feld-wert  { font-size: 13px; color: var(--text-body); }
.feld-wert ul { margin: 0; padding-left: 18px; }
.feld-wert li { margin-bottom: 3px; }

/* Fehlt ein Feld, wird das sichtbar gemacht statt still weggelassen */
.feld-fehlt { font-size: 12px; color: var(--text-disabled); font-style: italic; }

/* Semantische Einfärbung der Objektkarte — dezent, aber eindeutig:
   grün = wirksam, rot = Lücke oder Gegenanzeige, bernstein = Vorsicht.
   Die Farbe sitzt am Rand des Feldes, nicht im Fließtext, damit die Karte
   ruhig bleibt und beim Überfliegen trotzdem sofort lesbar ist. */
.feld-akzent {
  border-left: 3px solid transparent;
  padding-left: 10px;
  margin-left: -13px;
}
.akzent-wirksam  { border-left-color: var(--sev-safe); }
.akzent-luecke   { border-left-color: var(--sev-critical); }
.akzent-vorsicht { border-left-color: var(--sev-warning); }
.akzent-dosis    { border-left-color: var(--primary); }

.feld-akzent.akzent-wirksam  .feld-label { color: var(--sev-safe); }
.feld-akzent.akzent-luecke   .feld-label { color: var(--sev-critical); }
.feld-akzent.akzent-vorsicht .feld-label { color: var(--sev-warning); }
.feld-akzent.akzent-dosis    .feld-label { color: var(--primary); }

/* Verlinkte Erreger im Wirkspektrum: Zustand auf einen Blick */
.ref-wirksam { color: var(--sev-safe); text-decoration-color: var(--sev-safe); }
.ref-wirksam:hover { color: var(--sev-safe); }
.ref-variabel { color: var(--sev-warning); text-decoration-color: var(--sev-warning); }
.ref-variabel:hover { color: var(--sev-warning); }
.ref-luecke  { color: var(--sev-critical); text-decoration-color: var(--sev-critical); }
.ref-luecke:hover { color: var(--sev-critical); }

/* dosing.de-Zusammenfassung: GFR-Bereiche kompakt und lesbar */
.gfr-liste { margin: 4px 0 0; padding-left: 0; list-style: none; }
.gfr-liste li {
  position: relative;
  padding: 3px 0 3px 14px;
  font-size: 12.5px;
  line-height: 1.45;
  border-bottom: 1px solid var(--border-subtle);
}
.gfr-liste li:last-child { border-bottom: none; }
.gfr-liste li::before {
  content: "";
  position: absolute; left: 0; top: 11px;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--primary);
}
.gfr-quelle {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}

/* ----------------------------------------------- Navigationsleiste unten */

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  background: var(--surface-bar);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-default);
  display: flex; justify-content: space-around; align-items: center;
  padding: 6px 4px;
  box-shadow: 0 -1px 0 var(--border-subtle);
}
.nav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 4px 12px; border-radius: 10px;
  color: var(--text-muted);
  font-size: 9px; font-weight: 500;
  transition: color 0.15s, background 0.15s;
  min-width: 52px;
}
.nav-btn:hover { background: var(--surface-hover); }
.nav-btn svg { width: 20px; height: 20px; }
.nav-btn-active { color: var(--nav-active); background: var(--primary-light); }

/* -------------------------------------------------------------- Sonstiges */

.scrollbar-none::-webkit-scrollbar { display: none; }
.scrollbar-none { -ms-overflow-style: none; scrollbar-width: none; }

.hidden { display: none !important; }

.abs-trenner { height: 1px; background: var(--border-default); margin: 4px 0; }

/* Quellenzeile — jede Angabe des Leitfadens trägt ihren Beleg */
.quelle-zeile {
  font-size: 11px; color: var(--text-muted);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}

/* ------------------------------------------------------- Erreger-Baum
   Gram → Morphologie → Gattung. Aufklappbar wie ein Bestimmungsschlüssel;
   die oberste Ebene ist offen, tiefere zugeklappt, damit die Seite kurz bleibt. */

.baum-knoten {
  background: var(--surface-group);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  margin-bottom: 10px;
}
.baum-knoten .baum-knoten {
  background: var(--surface-card);
  margin: 8px 0 8px 0;
}
.baum-knoten summary {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; list-style: none;
  padding: 2px 0;
}
.baum-knoten summary::-webkit-details-marker { display: none; }
.baum-knoten summary::before {
  content: "▸";
  color: var(--text-muted);
  font-size: 11px;
  transition: transform 0.12s;
}
.baum-knoten[open] > summary::before { transform: rotate(90deg); }
.baum-titel  { font-size: 13px; font-weight: 600; color: var(--text-heading); }
.baum-anzahl {
  font-size: 10px; font-weight: 700;
  padding: 1px 7px; border-radius: 9999px;
  background: var(--surface-input); color: var(--text-muted);
  border: 1px solid var(--border-default);
}
.baum-info {
  margin-left: auto;
  font-size: 11px; font-weight: 600; color: var(--link);
}
.baum-info:hover { color: var(--link-hover); text-decoration: underline; text-underline-offset: 3px; }
.baum-inhalt { margin-top: 10px; }

/* Auswahlfelder im Adminbereich */
.abs-select {
  background: var(--surface-card);
  color: var(--text-body);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  font-size: var(--font-size-base);
  outline: none;
}
.abs-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus-ring); }
textarea.abs-input { resize: vertical; }
