/* fsppruefung.de — »Die Akte«: German form and clinic vernacular.
   Red is reserved exclusively for red-flag content.
   Light is paper, dark is night shift: same design language, its own tones. */

/* Tailwind v4 puts utilities in cascade layers. Unlayered CSS beats every
   layer, so this file lives in "components": utility classes on the same
   element (md:hidden, text-xl, px-7 …) win, as the templates intend. The
   order is pinned here too, whichever stylesheet the browser reads first. */
@layer theme, base, components, utilities;

@layer components {
:root {
  --papier: #f5f6f2;
  --feld: #ffffff;
  --feld-leicht: #eef0ea;
  --tinte: #1a2437;
  --tinte-60: #5c6472;
  --stempelblau: #2b55a2;
  --stempelblau-dunkel: #1f3f7a;
  --stempelblau-flaeche: #e9eef8;
  --signalrot: #b3261e;
  --signalrot-flaeche: #faeeed;
  --befundgruen: #1e6f54;
  --befundgruen-flaeche: #e9f2ee;
  --linie: #c7ccbf;
  --linie-stark: #1a2437;
  --gelb-flaeche: #f7f1dd;
  --schleier: rgba(26, 36, 55, 0.72);
  --orb: #2b55a2;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --papier: #10151d;
    --feld: #1a212d;
    --feld-leicht: #141a24;
    --tinte: #e7eaf1;
    --tinte-60: #9aa3b4;
    --stempelblau: #7da2ea;
    --stempelblau-dunkel: #0e2347;
    --stempelblau-flaeche: #1d2a42;
    --signalrot: #e26a60;
    --signalrot-flaeche: #35201f;
    --befundgruen: #57b893;
    --befundgruen-flaeche: #1a2c26;
    --linie: #333d4e;
    --linie-stark: #6b7689;
    --gelb-flaeche: #2d2a1c;
    --schleier: rgba(5, 8, 13, 0.78);
    --orb: #7da2ea;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --papier: #10151d;
  --feld: #1a212d;
  --feld-leicht: #141a24;
  --tinte: #e7eaf1;
  --tinte-60: #9aa3b4;
  --stempelblau: #7da2ea;
  --stempelblau-dunkel: #0e2347;
  --stempelblau-flaeche: #1d2a42;
  --signalrot: #e26a60;
  --signalrot-flaeche: #35201f;
  --befundgruen: #57b893;
  --befundgruen-flaeche: #1a2c26;
  --linie: #333d4e;
  --linie-stark: #6b7689;
  --gelb-flaeche: #2d2a1c;
  --schleier: rgba(5, 8, 13, 0.78);
  --orb: #7da2ea;
  color-scheme: dark;
}

html { background: var(--papier); }

body {
  background: var(--papier);
  color: var(--tinte);
  font-family: "Barlow", system-ui, sans-serif;
  font-size: 16.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .schlagzeile {
  font-family: "Barlow Condensed", "Barlow", sans-serif;
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.005em;
}

.mono { font-family: "IBM Plex Mono", monospace; }

a { text-underline-offset: 3px; }
:focus-visible {
  outline: 2px solid var(--stempelblau);
  outline-offset: 2px;
}

::selection { background: var(--stempelblau-flaeche); }

/* --- Form card ------------------------------------------------------------ */
.akte {
  background: var(--feld);
  border: 1.5px solid var(--linie-stark);
  border-radius: 5px;
}
.akte-kopf {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 1.1rem;
  border-bottom: 1.5px solid var(--linie-stark);
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
}
.akte-nummer {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--tinte-60);
}

/* --- Buttons: stamp logic ------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 600;
  font-size: 1.12rem;
  padding: 0.5rem 1.4rem;
  border: 1.5px solid var(--linie-stark);
  border-radius: 4px;
  background: var(--feld);
  color: var(--tinte);
  cursor: pointer;
  transition: transform 60ms ease, box-shadow 60ms ease;
  box-shadow: 2.5px 2.5px 0 var(--linie-stark);
  text-decoration: none;
}
.btn:hover { transform: translate(1px, 1px); box-shadow: 1.5px 1.5px 0 var(--linie-stark); }
.btn:active { transform: translate(2.5px, 2.5px); box-shadow: none; }
.btn-blau {
  background: var(--stempelblau);
  border-color: var(--stempelblau-dunkel);
  color: #fff;
  box-shadow: 2.5px 2.5px 0 var(--stempelblau-dunkel);
}
:root[data-theme="dark"] .btn-blau, [data-theme] .btn-blau { color: #fff; }
.btn-blau:hover { box-shadow: 1.5px 1.5px 0 var(--stempelblau-dunkel); }
.btn-leise {
  box-shadow: none;
  border-color: var(--linie);
  font-size: 1rem;
}
.btn-leise:hover { transform: none; border-color: var(--linie-stark); }
.btn-rot {
  border-color: var(--signalrot);
  color: var(--signalrot);
  box-shadow: 2.5px 2.5px 0 var(--signalrot);
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* A destructive action written like a link (e.g. "End" next to "View" in tables) */
.link-rot {
  color: var(--signalrot);
  text-decoration: underline;
  text-underline-offset: 2px;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
}
.link-rot:hover { text-decoration-thickness: 2px; }

/* Account menu (header, desktop) */
.kontomenu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 16rem;
  max-width: 20rem;
  background: var(--feld);
  border: 1.5px solid var(--linie-stark);
  border-radius: 4px;
  box-shadow: 3px 3px 0 var(--linie-stark);
  z-index: 50;
  font-size: 0.95rem;
}
.kontomenu-kopf {
  padding: 0.6rem 0.9rem;
  color: var(--tinte-60);
  font-size: 0.85rem;
  border-bottom: 1px solid var(--linie);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kontomenu-link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.9rem;
  color: inherit;
  text-decoration: none;
  background: none;
  border: 0;
  font: inherit;
  cursor: pointer;
}
.kontomenu-link:hover, .kontomenu-link:focus-visible { background: var(--feld-leicht); }
.kontomenu-gruppe {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.9rem;
  border-top: 1px solid var(--linie);
}
.kontomenu-label { color: var(--tinte-60); font-size: 0.85rem; }
.kontomenu-fuss { border-top: 1px solid var(--linie); }

/* Segmented choice (language, theme): the current option is marked */
.segment {
  display: inline-flex;
  border: 1.5px solid var(--linie);
  border-radius: 4px;
  overflow: hidden;
}
.segment > a, .segment > button {
  padding: 0.2rem 0.6rem;
  font: inherit;
  font-size: 0.85rem;
  color: inherit;
  text-decoration: none;
  background: none;
  border: 0;
  cursor: pointer;
}
.segment > * + * { border-left: 1.5px solid var(--linie); }
.segment > [aria-current="true"], .segment > [aria-pressed="true"] {
  background: var(--stempelblau-flaeche);
  color: var(--stempelblau);
  font-weight: 600;
}

/* »oder« divider between form login and Google sign-in */
.oder-trenner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.25rem 0;
  color: var(--tinte-60);
  font-size: 0.85rem;
}
.oder-trenner::before,
.oder-trenner::after {
  content: "";
  flex: 1;
  border-top: 1.5px solid var(--linie);
}

/* --- Form fields ----------------------------------------------------------- */
.feld {
  width: 100%;
  border: 1.5px solid var(--linie);
  border-radius: 4px;
  background: var(--feld);
  padding: 0.55rem 0.8rem;
  font-size: 1rem;
  color: var(--tinte);
}
.feld::placeholder { color: var(--tinte-60); opacity: 0.75; }
.feld:focus { border-color: var(--stempelblau); outline: none; }
.feld-label {
  display: block;
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 600;
  font-size: 1.02rem;
  margin-bottom: 0.25rem;
}

/* --- Boxes ----------------------------------------------------------------- */
.redflag {
  background: var(--signalrot-flaeche);
  border: 1.5px solid var(--signalrot);
  border-left-width: 6px;
  border-radius: 4px;
  padding: 0.9rem 1.1rem;
}
.redflag h3, .redflag strong { color: var(--signalrot); }

.befund {
  background: var(--befundgruen-flaeche);
  border: 1.5px solid var(--befundgruen);
  border-left-width: 6px;
  border-radius: 4px;
  padding: 0.9rem 1.1rem;
}

.hinweis {
  background: var(--gelb-flaeche);
  border: 1.5px solid var(--linie);
  border-radius: 4px;
  padding: 0.7rem 1rem;
  font-size: 0.95rem;
}

/* --- Protocol bar ----------------------------------------------------------- */
.protokoll {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--feld);
  overflow: hidden;
}
.protokoll > div { padding: 1rem 1.2rem; }
.protokoll > div + div { border-left: 1.5px solid var(--linie-stark); }
.protokoll .teil-nr { font-family: "IBM Plex Mono", monospace; font-size: 0.78rem; color: var(--tinte-60); }
.protokoll .teil-zeit { font-family: "IBM Plex Mono", monospace; font-weight: 500; font-size: 1.5rem; }
.protokoll .teil-name { font-family: "Barlow Condensed", sans-serif; font-weight: 600; font-size: 1.25rem; }
@media (max-width: 720px) {
  .protokoll { grid-template-columns: 1fr; }
  .protokoll > div + div { border-left: 0; border-top: 1.5px solid var(--linie-stark); }
}

/* --- Mastery bars ----------------------------------------------------------- */
.balken {
  height: 10px;
  background: var(--feld-leicht);
  border: 1px solid var(--linie);
  border-radius: 3px;
  overflow: hidden;
}
.balken > span { display: block; height: 100%; background: var(--stempelblau); }
.balken > span.gut { background: var(--befundgruen); }
.balken > span.schwach { background: var(--tinte-60); }

.score-gross {
  font-family: "IBM Plex Mono", monospace;
  font-size: 3.4rem;
  font-weight: 500;
  line-height: 1;
}

/* --- Voice session ---------------------------------------------------------- */
.orb-reihe { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.orb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem 1rem;
}
.orb-kreis {
  --level: 0;
  width: 108px;
  height: 108px;
  border-radius: 50%;
  border: 2px solid var(--linie-stark);
  background:
    radial-gradient(circle at 50% 45%, var(--stempelblau-flaeche), var(--feld) 70%);
  position: relative;
  transition: box-shadow 120ms linear;
  box-shadow: 0 0 0 calc(var(--level) * 26px) color-mix(in srgb, var(--orb) 28%, transparent);
}
.orb-kreis::after {
  content: "";
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  background: var(--orb);
  opacity: calc(0.25 + var(--level) * 0.75);
  transform: scale(calc(0.72 + var(--level) * 0.4));
  transition: transform 120ms linear, opacity 120ms linear;
}
.orb-name { font-family: "Barlow Condensed", sans-serif; font-weight: 600; font-size: 1.15rem; }

.pegel {
  height: 10px;
  border: 1px solid var(--linie);
  border-radius: 3px;
  background: var(--feld-leicht);
  overflow: hidden;
}
.pegel > span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--befundgruen);
  transition: width 90ms linear;
}

.zeitbalken {
  height: 6px;
  background: var(--feld-leicht);
  border-radius: 3px;
  overflow: hidden;
}
.zeitbalken > span { display: block; height: 100%; background: var(--stempelblau); transition: width 1s linear; }
.zeitbalken > span.knapp { background: var(--signalrot); }

/* Alpine removes x-cloak once a component is ready; until then the element stays hidden. */
[x-cloak] { display: none !important; }

/* Confirmation dialogs: shown at once by x-show; the fade is CSS-only, so the
   dialog never depends on a JS transition finishing. */
.dialog-schleier { background: var(--schleier); }
.dialog-schleier > [role="dialog"] { animation: dialog-ein-box 160ms ease-out; }
@keyframes dialog-ein-box { from { opacity: 0; transform: translateY(6px); } }

/* Indeterminate progress while a grading job runs (no real percentage exists) */
.lade-balken {
  position: relative;
  height: 6px;
  background: var(--stempelblau-flaeche);
  border-radius: 3px;
  overflow: hidden;
}
.lade-balken::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 38%;
  border-radius: 3px;
  background: var(--stempelblau);
  animation: lade-lauf 1.5s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}
@keyframes lade-lauf {
  from { transform: translateX(-105%); }
  to { transform: translateX(270%); }
}
@keyframes lade-puls {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.85; }
}

.caption-liste { max-height: 16rem; overflow-y: auto; }
.chat-blase { max-width: 85%; padding: 0.6rem 0.9rem; border-radius: 5px; }
.chat-arzt { background: var(--stempelblau); color: #fff; margin-left: auto; }
.chat-gegenueber { background: var(--feld); border: 1.5px solid var(--linie); }
.chat-rolle {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  color: var(--tinte-60);
  margin-bottom: 0.15rem;
}

/* --- Timer ----------------------------------------------------------------- */
.timer {
  font-family: "IBM Plex Mono", monospace;
  font-size: 2rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.timer.knapp { color: var(--signalrot); }

/* --- Tables ------------------------------------------------------------------ */
.verlauf-tabelle { width: 100%; border-collapse: collapse; font-size: 0.97rem; }
.verlauf-tabelle th {
  text-align: left;
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 600;
  font-size: 1.02rem;
  border-bottom: 1.5px solid var(--linie-stark);
  padding: 0.5rem 0.75rem;
}
.verlauf-tabelle td { border-bottom: 1px solid var(--linie); padding: 0.55rem 0.75rem; }

/* --- Flash / Toast ----------------------------------------------------------- */
.flash { border: 1.5px solid var(--linie-stark); border-radius: 4px; padding: 0.7rem 1rem; background: var(--feld); }
.flash-error { border-color: var(--signalrot); background: var(--signalrot-flaeche); }
.flash-info { border-color: var(--befundgruen); background: var(--befundgruen-flaeche); }

/* --- Correction diff ------------------------------------------------------------ */
.korrektur-fehler { background: var(--signalrot-flaeche); text-decoration: line-through; text-decoration-color: var(--signalrot); padding: 0 0.2em; }
.korrektur-richtig { background: var(--befundgruen-flaeche); padding: 0 0.2em; }

/* --- Navigation ---------------------------------------------------------------- */
.nav-link { text-decoration: none; padding: 0.25rem 0.1rem; border-bottom: 2px solid transparent; }
.nav-link:hover { border-bottom-color: var(--linie); }
.nav-link.aktiv { border-bottom-color: var(--stempelblau); }

.schalter {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1.5px solid var(--linie);
  border-radius: 4px;
  background: var(--feld);
  color: var(--tinte);
  font-size: 0.9rem;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
}
.schalter:hover { border-color: var(--linie-stark); }

/* Heading anchors on Wissen (knowledge) pages */
.prosa h2 { font-size: 1.75rem; margin-top: 2.2rem; margin-bottom: 0.6rem; }
.prosa p { max-width: 72ch; margin-bottom: 0.9rem; }
.prosa ul { max-width: 72ch; list-style: disc; padding-left: 1.4rem; margin-bottom: 0.9rem; }
.prosa li { margin-bottom: 0.35rem; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  /* "*" doesn't match pseudo-elements: replace the sliding bar with a slow fade. */
  .lade-balken::before { width: 100%; transform: none; animation: lade-puls 2.4s ease-in-out infinite !important; }
}
}
