/* =========================================================
   DESIGN SYSTEM (Farben, Typo, Spacing)
========================================================= */
:root{
  /* Typo */
  --fs-base: clamp(16px, 0.9vw + 12px, 20px);
  --fs-hint: clamp(12px, 0.5vw + 10px, 14px);
  --lh: 1.45;

  /* Layout */
  --app-max: 1040px;
  --pad-page: 1rem;
  --pad-card: clamp(12px, 1.2vw, 18px);
  --gap: clamp(10px, 1vw, 16px);

  /* Radii */
  --r-card: 16px;
  --r-inner: 12px;
  --r-pill: 999px;

  /* Colors */
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef2f8;
  --border: #d7dde7;

  --text: #0f172a;
  --muted: #475569;

  --primary: #1f6feb;
  --primary-2: #2c7dff;
  --primary-tint: #e8f0ff;

  --success: #16a34a;
  --danger:  #dc2626;
  --warn:    #f59e0b;

  /* Shadow */
  --shadow-1: 0 2px 10px rgba(15, 23, 42, 0.08);
  --shadow-2: 0 10px 30px rgba(15, 23, 42, 0.14);

  /* Focus */
  --focus: 0 0 0 3px rgba(31,111,235,0.25);
}

/* =========================================================
   BASE
========================================================= */
html{ font-size: var(--fs-base); }
*{ box-sizing: border-box; }
body{
  margin: 0;
  padding: var(--pad-page);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: var(--lh);
  color: var(--text);
  background: var(--bg);
}

/* Max-Width / Zentrierung */
#app{
  max-width: var(--app-max);
  margin: 0 auto;
  padding: 0 16px;
}

/* Hidden muss immer gewinnen */
.hidden{ display:none !important; }

/* =========================================================
   TOPBAR / TITEL
========================================================= */
.topbar{
  display: block;
  margin-bottom: 0.25rem;
}
.appTitle{
  text-align: center;
  width: 100%;
  margin: 0.75rem 0 0.65rem 0;
  letter-spacing: 0.2px;
}

/* Headings (einheitlich) */
h2, h3{
  color: var(--text);
}
hr{ margin: 1rem 0; border: 0; border-top: 1px solid var(--border); }

/* =========================================================
   UTILS / FORM
========================================================= */
.row{
  display: flex;
  gap: 0.6rem;
  align-items: center;
}
.spacer{ flex: 1 1 auto; }

.field{
  display: block;
  margin: 0.75rem 0;
}

input, select, textarea{
  width: 100%;
  padding: 0.65rem 0.75rem;
  margin-top: 0.35rem;
  border-radius: var(--r-inner);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  outline: none;
}

input:focus, select:focus, textarea:focus{
  box-shadow: var(--focus);
  border-color: rgba(31,111,235,0.55);
}

.hint{
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: var(--fs-hint);
}

/* =========================================================
   CARDS (Innen) + SHELL (Außen)
========================================================= */
.card{
  border: 1px solid var(--border);
  background: var(--surface);
  padding: var(--pad-card);
  border-radius: var(--r-inner);
  box-shadow: var(--shadow-1);
  min-width: 0;
}
.cardCompact{ padding: 0.85rem; }
.cardTitle{
  margin: 0 0 0.6rem 0;
  letter-spacing: 0.15px;
}

.questionCard{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 16px;
  margin: 12px auto;
  box-shadow: var(--shadow-2);
}

/* =========================================================
   META + FRAGEBOX
========================================================= */
.metaLine{
  text-align: center;
  font-weight: 800;
  margin-top: 0.25rem;
  margin-bottom: 0.65rem;
}
.metaLineSub{
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.85rem;
}

.questionTextBox{
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-inner);
  padding: 12px 14px;
  margin: 10px 0 10px 0;
  text-align: center;
  font-weight: 700;
}

/* =========================================================
   BUTTONS (Pill)
========================================================= */
.btnPill{
  border-radius: var(--r-pill);
  padding: 0.8rem 1.1rem;
  border: 1px solid rgba(15,23,42,0.14);
  background: linear-gradient(#ffffff, #f1f4f9);
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease, filter 120ms ease;
  box-shadow: var(--shadow-1);
  color: var(--text);
}
.btnPill:hover{
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
  border-color: rgba(15,23,42,0.22);
}
.btnPill:active{
  transform: translateY(0px);
  box-shadow: var(--shadow-1);
}
.btnPill:focus{
  outline: none;
  box-shadow: var(--shadow-1), var(--focus);
}
.btnPill:disabled{
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: var(--shadow-1);
  filter: grayscale(0.1);
}

.btnPrimary{
  color: #fff;
  border: 1px solid rgba(31,111,235,0.85);
  background: linear-gradient(var(--primary-2), var(--primary));
}
.btnPrimary:hover{
  box-shadow: 0 10px 25px rgba(31,111,235,0.28), var(--shadow-2);
}
.btnSmall{
  padding: 0.55rem 0.9rem;
  font-size: 0.95rem;
}

/* =========================================================
   TOGGLE (iOS-like)
========================================================= */
.switch{ position: relative; display: inline-block; width: 56px; height: 28px; }
.switch input{ opacity: 0; width: 0; height: 0; }
.slider{
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #cbd5e1;
  transition: .2s;
  border-radius: 999px;
}
.slider:before{
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  top: 3px;
  background-color: #fff;
  transition: .2s;
  border-radius: 50%;
}
.switch input:checked + .slider{ background-color: var(--primary); }
.switch input:checked + .slider:before{ transform: translateX(28px); }

/* =========================================================
   BANNER / FEEDBACK
========================================================= */
.banner{
  padding: 0.8rem;
  border-radius: var(--r-inner);
  margin: 0.75rem 0;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.banner.info{ border-color: rgba(31,111,235,0.35); background: #eef4ff; }
.banner.warn{ border-color: rgba(245,158,11,0.45); background: #fff7df; }
.banner.error{ border-color: rgba(220,38,38,0.35); background: #ffecec; }

.feedback{
  padding: 0.85rem;
  border-radius: var(--r-inner);
  margin: 10px 0 10px 0;
  border: 1px solid var(--border);
  background: var(--surface-2);
  text-align: center;
}
.feedback.correct{
  border-color: rgba(22,163,74,0.45);
  background: #eaf7ef;
}
.feedback.wrong{
  border-color: rgba(220,38,38,0.40);
  background: #fdecec;
}

/* =========================================================
   ANSWERS / PRIMARY ACTION BAR
========================================================= */
#answers{
  margin-top: 10px;
  margin-bottom: 0.75rem;
}

/* Ein Button-Platz (Antwort prüfen / Weiter) */
.primaryActionBar{
  margin-top: 14px;
  position: relative;
  height: 56px;
}
.primaryActionBar button{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 56px;
  margin: 0;
}

/* =========================================================
   MC GRID (Tiles)
========================================================= */
.mcGrid{
  display: grid;
  gap: 10px;
}

.mcOption{
  border: 1px solid var(--border);
  border-radius: var(--r-inner);
  padding: 0.85rem 0.95rem;
  background: var(--surface);
  cursor: pointer;
  user-select: none;
  min-height: 56px;

  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  text-align: center;

  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}
.mcOption:hover{
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
  border-color: rgba(15,23,42,0.22);
}

.mcOption.locked{
  cursor: default;
  transform: none !important;
  box-shadow: none;
  opacity: 0.99;
}

/* Auswahl bleibt klar sichtbar (blau) */
.mcOption.selected{
  background: var(--primary-tint);
  border-color: rgba(31,111,235,0.65);
}

/* Auswertung: keine Layout-Sprünge (Inset-Outline statt Border) */
.mcOption.eval-true{ box-shadow: 0 0 0 4px rgba(22,163,74,0.85) inset; }
.mcOption.eval-false{ box-shadow: 0 0 0 4px rgba(220,38,38,0.85) inset; }

/* =========================================================
   SYMBOLS
========================================================= */
.symbolBar{
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin: 0.5rem 0 0.75rem 0;
}

/* Inline in Text */
.symbolInline{
  width: clamp(46px, 2.2vw, 68px);
  height: auto;
  vertical-align: middle;
  margin: 0 0.35rem;
}

/* Falls noch separate Symbole genutzt */
.symbol{
  width: clamp(28px, 6vw, 64px);
  height: auto;
  display: inline-block;
  margin: 0;
}

/* =========================================================
   MUSTERLÖSUNG BOX (FREE)
========================================================= */
.musterBox{
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-inner);
  background: var(--surface-2);
  text-align: center;
}
.musterTitle{
  font-weight: 800;
  margin: 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.musterText{
  max-height: 220px; /* 160/220/300 testen */
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 8px;
  line-height: 1.45;
  white-space: pre-wrap;
  text-align: center;
}

/* =========================================================
   TIMER / DEVTOOLS
========================================================= */
#examTimer{
  font-weight: 800;
  margin-bottom: 0.75rem;
  text-align: right;
  color: var(--muted);
}
#examTimer.warning{ color: #7f1d1d; }
#devTools{ display:none; }
body.dev #devTools{ display:block; }

/* =========================================================
   MODAL
========================================================= */
.modal{
  position: fixed;
  inset: 0;
  background: rgba(2,6,23,0.50);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 999;
}
.modalContent{
  background: var(--surface);
  width: min(1100px, 100%);
  max-height: 90vh;
  overflow: auto;
  border-radius: var(--r-card);
  padding: 1rem;
  box-shadow: var(--shadow-2);
}

/* Badges */
.badge{
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: var(--r-pill);
  font-size: 0.85rem;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.badge.pass{ border-color: rgba(22,163,74,0.5); background: #eaf7ef; }
.badge.fail{ border-color: rgba(220,38,38,0.45); background: #fdecec; }
.badge.retake{ border-color: rgba(245,158,11,0.45); background: #fff7df; }
.badge.ko{ border-color: rgba(2,6,23,0.85); background: #fff7df; font-weight: 800; }

/* =========================================================
   INFO DOT + POPOVER
========================================================= */
.infoDot{
  width: 30px;
  height: 30px;
  border-radius: var(--r-pill);
  border: 1px solid rgba(15,23,42,0.14);
  background: linear-gradient(#ffffff, #f1f4f9);
  cursor: pointer;
  font-weight: 900;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-1);
}

.infoPopover{
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: 999;
  width: min(360px, calc(100vw - 48px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-2);
  padding: 0.85rem;
}
.popTitle{ font-weight: 900; margin-bottom: 0.35rem; }
.popText{
  color: var(--muted);
  font-size: var(--fs-hint);
  line-height: 1.35;
}

/* Anker für Popover */
.startRow,
.quickAutoActionRow,
.seenotHeaderRow{
  position: relative;
}

/* In Vorgaben/Springer ist es über infoWrap gekapselt */
.infoWrap{
  position: relative;
  display: inline-flex;
  align-items: center;
}

/* =========================================================
   STARTSEITE: GRID LAYOUT
========================================================= */
.menuLayout{ display: grid; gap: var(--gap); }
.menuRow{ display: grid; gap: var(--gap); align-items: start; }

.menuRow1{ grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
.menuRow2{ grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
.menuRow3{ grid-template-columns: 1fr; }

.menuColRightStack{ display: grid; gap: var(--gap); min-width: 0; }
.menuColLeft, .menuColRight{ display: grid; gap: var(--gap); min-width: 0; }

.menuSplit{
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  gap: var(--gap);
}

/* Startbuttons: Button 75% + Info rechts (Desktop) */
.startButtons{ display: grid; gap: 0.75rem; margin-top: 0.75rem; }
.startRow{ display: flex; align-items: center; gap: 0.75rem; }
.startRow .btnPill{ width: 75%; margin: 0; }
.startRow .infoDot{ margin-left: auto; flex: 0 0 auto; }

.quickAutoActionRow{ display: flex; align-items: center; gap: 0.75rem; margin-top: 0.5rem; }
.quickAutoActionRow #btnQuickContinue{ width: 75%; margin: 0; }
.quickAutoActionRow .infoDot{ margin-left: auto; }

.quickAutoCountRow .field{
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 75%;
  margin: 0;
  white-space: nowrap;
}
.quickAutoCountRow select{
  width: clamp(120px, 35vw, 160px);
  max-width: 100%;
}

/* Prüfungsverlauf Controls */
.historyHeaderRow{
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.historyControlsRow{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.historyControlsRow select{ width: 160px; }
.historyControlsRow button{ margin-left: auto; }

/* Seenot Toggle mittig */
.seenotToggleWrap{ display: flex; justify-content: center; margin-top: 0.75rem; }

/* =========================================================
   EXAM LIST + DETAIL LIST (CSS Klassen statt Inline)
========================================================= */
.examRow{
  border-top: 1px solid rgba(15,23,42,0.08);
  padding: 0.75rem 0;
}
.examRow:first-child{ border-top: none; padding-top: 0; }

.examRow .row{ display: grid; grid-template-columns: 1fr auto; gap: 0.75rem; align-items: start; }
.examRow button{ height: fit-content; }

.sectionTitle{
  margin: 0 0 0.75rem 0;
}

.examAnswerItem{
  border-top: 1px solid rgba(15,23,42,0.08);
  padding-top: 0.75rem;
  margin-top: 0.75rem;
}
.examAnswerItem:first-child{
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

/* Details / Summary harmonisiert */
details{
  border: 1px solid rgba(15,23,42,0.10);
  border-radius: var(--r-inner);
  padding: 0.55rem 0.7rem;
  background: #f8fafc;
}
summary{
  cursor: pointer;
  font-weight: 700;
}
details > div{
  margin-top: 0.5rem;
  color: var(--text);
}

/* Fehlerübersicht Items */
.errorItem{
  border: 1px solid rgba(15,23,42,0.12);
  border-radius: var(--r-inner);
  padding: 0.85rem;
  margin-bottom: 0.75rem;
  background: #fbfdff;
}

/* RESULT VIEW */
.resultTitle{
  text-align: center;
  margin: 0.35rem 0 0.9rem 0;
}

/* =========================================================
   RESPONSIVE
========================================================= */
@media (max-width: 900px){
  .menuRow1, .menuRow2{ grid-template-columns: 1fr; }
  .menuSplit{ grid-template-columns: 1fr; }

  .startRow .btnPill,
  .quickAutoActionRow #btnQuickContinue,
  .quickAutoCountRow .field{
    width: 100%;
  }

  .quickAutoCountRow{
    display: flex;
    align-items: center;
    gap: 0.75rem;
  }

  /* Prüfungsverlauf Button/Select mobile gut klickbar */
  .historyControlsRow{
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

/* Abschluss-/Fehlerübersicht: moderne Report-Optik */
.errorQuestionText{
  margin-top: 0.35rem;
}

.answerGrid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.answerLabel{
  font-weight: 800;
  margin-bottom: 0.35rem;
}

.answerBox{
  border: 1px solid rgba(15,23,42,0.12);
  border-radius: var(--r-inner);
  padding: 0.75rem;
  background: #fbfdff;
  line-height: 1.45;
  white-space: pre-wrap; /* wichtig für FREE Antworten */
}

.answerBoxUser{
  background: #f8fafc;
}

.answerBoxCorrect{
  background: #eef4ff; /* leichter Primary-Tint */
  border-color: rgba(31,111,235,0.25);
}

@media (max-width: 900px){
  .answerGrid{
    grid-template-columns: 1fr;
  }
}

/* Aufzählung in Antwortboxen (MC Mehrfachantworten) */
.answerList{
  margin: 0;
  padding-left: 1.1rem; /* Einrückung für Bullet */
}

.answerList li{
  margin: 0.25rem 0; /* Abstand zwischen Antworten */
  line-height: 1.45;
}

/* Optional: modernere Bullets */
.answerList li::marker{
  color: rgba(15,23,42,0.55);
}

/* FREE-Text bleibt schön mehrzeilig */
.freeText{
  white-space: pre-wrap;
}


/* Report: Symbole kompakt in Tabellen */
.reportTable img.symbolInline{ width: 42px; height: auto; vertical-align: middle; }


.errorMeta{
  font-weight: 800;
  color: var(--text);
  margin-bottom: 0.15rem;
}

.errorMetaSub{
  color: var(--muted);
  font-size: var(--fs-hint);
  margin-bottom: 0.35rem;
}
