/* KIMed Interview-Erfassung – Gestaltung nach Spez. 6.3:
   neutral, Systemschriften, ein Akzentton (Petrol), Kontrast >= 4.5:1 */

:root {
  --accent: #0f6674;          /* Petrol */
  --accent-bg: rgba(15, 102, 116, 0.10);
  --text: #1c2528;
  --muted: #5a6a70;
  --border: #d4dcdf;
  --warn-bg: #fdf3e4;
  --warn-border: #d9a441;
  --ok: #2e7d32;
  --max-width: 46rem;         /* ~75 Zeichen */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  line-height: 1.55;
  background: #fafbfb;
}

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 1rem; }
.container.wide { max-width: 72rem; }
.container.narrow { padding-top: 2rem; padding-bottom: 2rem; }

/* Kopf- und Fortschrittsbereich (sticky, F2.5) */
.sticky-top {
  position: sticky; top: 0; z-index: 10;
  background: #fff; border-bottom: 1px solid var(--border);
}
.site-header { background: var(--accent); color: #fff; }
.header-row {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 1rem; padding: 0.5rem 1rem; flex-wrap: wrap;
}
.brand { font-weight: 600; }
.header-logo {
  display: inline-flex; align-items: center; vertical-align: middle;
  background: #fff; border-radius: 4px; padding: 0.15rem 0.4rem;
  margin-right: 0.6rem;
}
.header-logo img { height: 1.1rem; width: auto; display: block; }
.participant-label { margin-left: 0.75rem; font-size: 0.9rem; opacity: 0.9; }
.header-actions { display: flex; gap: 1rem; align-items: baseline; }
.header-actions a { color: #fff; }
.lang-flag {
  /* Feste, identische Box für beide Flaggen (5:3); der Union Jack füllt sie
     per preserveAspectRatio="slice" randlos aus. */
  width: 1.25em; height: 0.75em; margin-right: 0.35em;
  vertical-align: -0.05em; border-radius: 0.1rem;
  outline: 1px solid rgba(255, 255, 255, 0.4); /* hebt die Flagge vom dunklen Header ab */
}
.save-status { font-size: 0.85rem; min-width: 8rem; text-align: right; }
.save-status.offline { color: #ffd9a0; }
.header-save-btn {
  font: inherit; font-size: 0.8rem; padding: 0.1rem 0.6rem;
  background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 0.3rem; cursor: pointer;
}
.header-save-btn:hover { background: rgba(255, 255, 255, 0.15); }
.completed-banner { margin-top: 1rem; }
.submit-error { color: #a33; }
textarea.answer[readonly] { background: #f1f4f5; color: var(--muted); }

.progress-area { padding: 0.5rem 1rem 0.6rem; }
.progress-track {
  height: 0.55rem; border-radius: 0.3rem;
  background: var(--accent-bg); overflow: hidden;
}
.progress-fill {
  height: 100%; background: var(--accent);
  transition: width 0.4s ease;
}
.progress-text { margin: 0.3rem 0 0.4rem; font-size: 0.85rem; color: var(--muted); }

/* Block-Stepper (F2.6) */
.stepper { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.step {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.15rem 0.55rem; border: 1px solid var(--border); border-radius: 1rem;
  font-size: 0.82rem; text-decoration: none; color: var(--text); background: #fff;
}
.step:hover { border-color: var(--accent); }
.step.current { background: var(--accent); color: #fff; border-color: var(--accent); }
.step-state { font-size: 0.9em; }
.step.complete .step-state { color: var(--ok); }
.step.current .step-state { color: inherit; }

/* Seiten: ohne JS alle sichtbar (Fallback), mit JS genau eine */
html.js .page { display: none; }
html.js .page.active { display: block; }
.page { padding: 1.25rem 0 0.5rem; }
.page h2 { font-size: 1.25rem; }
.time-hint { font-weight: normal; color: var(--muted); font-size: 0.85em; }

.project-intro { margin: 0.75rem 0; }
.project-intro p { margin: 0 0 0.75rem; }

.infobox {
  background: var(--accent-bg); border-left: 4px solid var(--accent);
  padding: 0.6rem 0.9rem; border-radius: 0 0.3rem 0.3rem 0; margin: 0.75rem 0;
  font-size: 0.95rem;
}
.infobox.warn { background: var(--warn-bg); border-left-color: var(--warn-border); }

/* Fragen */
.question { margin: 1.5rem 0; }
.qid-badge {
  display: inline-block; background: var(--accent); color: #fff;
  font-size: 0.78rem; font-weight: 600; border-radius: 0.25rem;
  padding: 0.05rem 0.45rem; margin-right: 0.4rem; vertical-align: 0.1em;
}
.optional-tag {
  margin-left: 0.4rem; font-size: 0.78rem; color: var(--muted);
  border: 1px solid var(--border); border-radius: 0.25rem; padding: 0 0.3rem;
}
textarea.answer {
  width: 100%; min-height: 6.5rem; resize: vertical;
  font: inherit; padding: 0.55rem 0.7rem;
  border: 1px solid var(--border); border-radius: 0.3rem;
  overflow: hidden;
}
textarea.answer:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

details.probes { margin: 0.15rem 0 0.5rem; font-size: 0.92rem; }
details.probes summary { cursor: pointer; color: var(--accent); }
details.probes ul { margin: 0.4rem 0 0; color: var(--muted); }

/* Glossarbegriffe (F3.1, N4: nicht nur Farbe → gepunktete Unterstreichung) */
.term, .term-demo {
  background: var(--accent-bg);
  border-bottom: 2px dotted var(--accent);
  border-radius: 0.15rem; padding: 0 0.1rem;
  cursor: help;
}
.term:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Tooltip (6.2) */
.tooltip {
  position: absolute; z-index: 50; max-width: 360px;
  background: #fff; border: 1px solid var(--border); border-radius: 0.35rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  padding: 0.6rem 0.8rem; font-size: 0.9rem;
}
.tooltip .tt-term { font-weight: 600; margin: 0 0 0.25rem; }
.tooltip p { margin: 0; }
.tooltip a { display: inline-block; margin-top: 0.35rem; }

/* Seitennavigation */
.page-nav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 0 2rem; gap: 1rem;
}
html:not(.js) .page-nav { display: none; }
.page-nav button, button.primary {
  font: inherit; padding: 0.45rem 1rem; border-radius: 0.3rem;
  border: 1px solid var(--accent); background: #fff; color: var(--accent);
  cursor: pointer;
}
.page-nav button:hover, button.primary:hover:not(:disabled) { background: var(--accent-bg); }
.page-nav button:disabled { opacity: 0.4; cursor: default; }
button.primary { background: var(--accent); color: #fff; }
button.primary:disabled { opacity: 0.5; cursor: not-allowed; }
.page-counter { color: var(--muted); font-size: 0.9rem; }

/* Review-Seite */
.review-blocks { padding-left: 1.2rem; }
#open-questions a { color: var(--accent); }

/* Glossar-Seite */
.glossary-list dt { font-weight: 600; margin-top: 1rem; }
.glossary-list dd { margin: 0.2rem 0 0 0; }

/* Admin-Bereich */
.header-link { color: #fff; text-decoration: none; }
.header-link:hover { text-decoration: underline; }
.login-form, .create-form { display: flex; flex-direction: column; gap: 0.4rem; max-width: 24rem; }
.login-form label, .create-form label { font-size: 0.9rem; color: var(--muted); margin-top: 0.5rem; }
.login-form input, .create-form input {
  font: inherit; padding: 0.45rem 0.6rem;
  border: 1px solid var(--border); border-radius: 0.3rem;
}
.login-form button, .create-form button { margin-top: 0.8rem; align-self: flex-start; }
.table-wrap { overflow-x: auto; }
.admin-table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
.admin-table th, .admin-table td {
  text-align: left; padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.admin-table .actions { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.admin-table .actions button, .copy-btn {
  font: inherit; font-size: 0.8rem; padding: 0.15rem 0.5rem;
  border: 1px solid var(--border); border-radius: 0.3rem; background: #fff; cursor: pointer;
}
.admin-table .actions button:hover, .copy-btn:hover { border-color: var(--accent); }
.admin-table .actions button.danger { color: #a33; border-color: #d9b0b0; }
.admin-table .actions button.danger:hover { border-color: #a33; }
.status { padding: 0.1rem 0.5rem; border-radius: 1rem; font-size: 0.8rem; white-space: nowrap; }
.status-active { background: var(--accent-bg); color: var(--accent); }
.status-completed { background: #e4f2e5; color: var(--ok); }
.status-disabled { background: #eee; color: var(--muted); }
.invite-link { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.invite-link code { word-break: break-all; }
.created-box { margin-top: 1rem; }
.admin-block { margin-bottom: 1.5rem; }
.answer-view {
  white-space: pre-wrap; background: #fff; border: 1px solid var(--border);
  border-radius: 0.3rem; padding: 0.55rem 0.7rem;
}
.answer-view.empty { color: var(--muted); border-style: dashed; }
.answer-meta { font-size: 0.78rem; color: var(--muted); margin: 0.2rem 0 0; }

/* Startseite */
.start-page { text-align: center; }
.start-logo {
  display: block; width: 70%; max-width: 20rem; height: auto;
  margin: 1rem auto 1.5rem;
}

/* Fußbereich */
.site-footer {
  border-top: 1px solid var(--border); margin-top: 2rem;
  padding: 1rem; font-size: 0.82rem; color: var(--muted);
  max-width: var(--max-width); margin-left: auto; margin-right: auto;
}

@media (max-width: 480px) {
  .header-row { flex-direction: column; gap: 0.2rem; }
  .save-status { text-align: left; }
}
