/* Evaluation Lernprozess – mobile-first, WCAG 2.1 AA, hoher Kontrast.
   Keine externen Schriften/Assets. Systemschriften. */

:root {
  --bg: #ffffff;
  --fg: #1a1f29;          /* ~14:1 auf Weiss */
  --muted: #44505f;       /* >=7:1 auf Weiss */
  --accent: #0b4a8f;      /* Hanseatisches Blau, >=7:1 auf Weiss */
  --accent-fg: #ffffff;
  --border: #6b7686;
  --error: #b00020;       /* >=4.5:1 auf Weiss */
  --error-bg: #fdecef;
  --surface: #f4f6f9;
  --focus: #c8520a;       /* deutlich sichtbarer Fokus */
  --radius: 8px;
  --touch: 44px;
}

* { box-sizing: border-box; }

html { font-size: 17px; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
  color: var(--fg);
  background: var(--bg);
}

.wrap { width: 100%; max-width: 720px; margin: 0 auto; padding: 0 1rem; }

/* Fokus immer deutlich sichtbar */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Programmatischer Fokus (Wizard-Sprung auf Ueberschrift, Fehlerzusammenfassung):
   :focus-visible greift bei programmatischem Fokus auf nicht-interaktive Elemente in
   einigen Browsern (v. a. WebKit/iOS) nicht -> expliziter sichtbarer Indikator. */
.section-title:focus,
.error-summary:focus {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: var(--accent-fg);
  padding: .6rem 1rem; z-index: 100;
}
.skip-link:focus { left: 0; }

/* Header / Footer */
.site-header { background: var(--accent); color: var(--accent-fg); padding: 1rem 0; }
.site-title { margin: 0; font-size: 1.15rem; font-weight: 700; }
.site-subtitle { margin: .25rem 0 0; font-size: .9rem; opacity: .95; }
.site-footer { margin-top: 3rem; padding: 1.25rem 0; background: var(--surface); font-size: .85rem; color: var(--muted); }
.site-footer a { color: var(--accent); }

main { padding-top: 1.25rem; }

h1 { font-size: 1.5rem; line-height: 1.25; }
h2.section-title { font-size: 1.25rem; margin-top: 0; color: var(--accent); scroll-margin-top: 72px; }
a { color: var(--accent); }

.intro .occasion { font-weight: 600; }
.instruction, .section-intro { color: var(--muted); }

/* Abschnitte */
.survey-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  margin: 1.5rem 0;
}

/* Items */
.item { margin: 1.25rem 0; }
.item legend, .item > label, .slider-group legend {
  font-weight: 600; padding: 0; margin-bottom: .5rem;
}
fieldset { border: 0; margin: 0; padding: 0; }
.optional { font-weight: 400; color: var(--muted); font-size: .85em; }

/* Radio-Optionen: grosse Touch-Ziele, klare Auswahl */
.options { display: grid; gap: .5rem; }
@media (min-width: 560px) {
  .options-5 { grid-template-columns: repeat(5, 1fr); }
}
.opt {
  display: flex; align-items: center; gap: .6rem;
  min-height: var(--touch);
  padding: .5rem .75rem;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
@media (min-width: 560px) {
  .opt { flex-direction: column; text-align: center; gap: .35rem; justify-content: center; }
}
.opt input { width: 22px; height: 22px; accent-color: var(--accent); margin: 0; flex: none; }
.opt:has(input:checked) { border-color: var(--accent); background: #e8f0fb; }
.opt-key { font-weight: 700; }
.opt-label { font-size: .85rem; color: var(--fg); }

/* Slider / Zahleneingabe */
.slider-group { margin: 1rem 0; padding: .75rem; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); }
.slider-row { display: flex; align-items: center; gap: .75rem; }
.slider-number {
  width: 5rem; min-height: var(--touch); font-size: 1.1rem;
  padding: .35rem .5rem; border: 2px solid var(--border); border-radius: var(--radius);
}
.slider-visual { flex: 1; height: var(--touch); accent-color: var(--accent); }
.slider-hint { margin: .35rem 0 0; font-size: .8rem; color: var(--muted); }

/* Textfelder */
textarea, input[type="text"] {
  width: 100%; padding: .6rem; font: inherit;
  border: 2px solid var(--border); border-radius: var(--radius); background: var(--bg);
}
textarea { resize: vertical; }

/* Teil C */
.feedback-rules-h { font-size: 1rem; }
.teilc-block { border: 1px dashed var(--border); border-radius: var(--radius); padding: 1rem; margin: 1rem 0; }
.teilc-block legend { font-weight: 700; color: var(--accent); }

/* Buttons */
button { font: inherit; cursor: pointer; }
.btn-primary, .btn-secondary {
  min-height: var(--touch); padding: .65rem 1.25rem; border-radius: var(--radius);
  border: 2px solid var(--accent); font-weight: 600;
}
.btn-primary { background: var(--accent); color: var(--accent-fg); }
.btn-secondary { background: var(--bg); color: var(--accent); }
.btn-link { background: none; border: 0; color: var(--accent); text-decoration: underline; padding: .25rem; min-height: var(--touch); }
.btn-submit { width: 100%; margin-top: 1rem; font-size: 1.05rem; }

.step-nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.5rem; }
.step-nav button { flex: 1; }

.form-footer { margin: 2rem 0; }
.save-hint { font-size: .85rem; color: var(--muted); }

/* Fortschritt (sticky) */
.progress { position: sticky; top: 0; background: var(--bg); padding: .75rem 0; z-index: 10; border-bottom: 1px solid var(--border); }
.progress-bar { height: 8px; background: var(--surface); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.progress-fill { display: block; width: 0; height: 100%; background: var(--accent); transition: width .25s ease; }
.progress-text { margin: .35rem 0 0; font-size: .85rem; font-weight: 600; }

/* Fehler */
.field-error { color: var(--error); font-weight: 600; margin: .4rem 0 0; }
.has-error { outline: 2px solid var(--error); outline-offset: 4px; border-radius: var(--radius); }
.error-summary { background: var(--error-bg); border: 2px solid var(--error); border-radius: var(--radius); padding: .75rem 1rem; margin: 1rem 0; color: var(--error); font-weight: 600; }

/* Progressive Enhancement:
   Ohne JS sind alle Abschnitte und alle Teil-C-Bloecke sichtbar (langes Formular).
   Mit JS: Assistentenmodus (ein Abschnitt sichtbar) und Teil-C-Zusatzbloecke ausgeblendet. */
.js .survey-section[data-section]:not(.active) { display: none; }
.js .teilc-block[data-extra] { display: none; }

/* Auswertungsbereich (/admin) */
.admin-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; margin: 1.5rem 0; }
.admin-danger { border-color: var(--error); }
.admin-total { font-size: 1.1rem; }
.admin-links { margin: 0; padding-left: 1.25rem; }
.admin-links li { margin: .35rem 0; }
.admin-flash { padding: .6rem 1rem; border-radius: var(--radius); font-weight: 600; }
.admin-flash-ok { background: #e6f4ea; border: 2px solid #1b7a3b; color: #1b5e2a; }
.admin-flash-warn { background: var(--error-bg); border: 2px solid var(--error); color: var(--error); }
.admin-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.admin-table th, .admin-table td { border: 1px solid var(--border); padding: .4rem .5rem; text-align: left; }
.admin-table thead th { background: var(--bg); }
.admin-table-wrap { overflow-x: auto; }
.admin-danger input[type="text"] { max-width: 14rem; margin: .5rem 0; }

/* Häufigkeiten & Freitexte pro Frage */
.freq-block, .text-block { margin: 1.25rem 0; padding-top: 1rem; border-top: 1px solid var(--border); }
.freq-block:first-of-type, .text-block:first-of-type { border-top: 0; padding-top: 0; }
.freq-title { font-size: 1rem; margin: 0 0 .25rem; }
.freq-var { display: inline-block; font-family: monospace; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 0 .35rem; margin-right: .4rem; }
.freq-n { margin: 0 0 .5rem; color: var(--muted, #555); font-size: .85rem; }
.freq-table td:nth-child(2), .freq-table td:nth-child(3) { text-align: right; width: 6rem; }
.freq-kb th, .freq-kb td { background: var(--bg); font-style: italic; }
.open-text-list { margin: .25rem 0 0; padding-left: 0; list-style: none; }
.open-text-list li { padding: .4rem .5rem; border: 1px solid var(--border); border-radius: var(--radius); margin: .35rem 0; }
.open-text-id { display: inline-block; font-family: monospace; color: var(--muted, #555); margin-right: .5rem; }

/* Bewegung reduzieren */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
