/* ─── Villa Kinder · Schulung — Design-Tokens (aus website/src/styles/global.css) ─── */
:root {
  --cream: #FAF6F1;
  --cream-dark: #F0EAE0;
  --sage: #7CAE7A;
  --sage-dark: #5C8E5A;
  --sage-light: #A8D5A2;
  --charcoal: #2D3436;
  --charcoal-light: #636E72;
  --warm-gray: #B2BEC3;
  --coral: #E17055;
  --sunflower: #FDCB6E;
  --sky: #74B9FF;
  --white: #ffffff;

  --green: #5C8E5A;
  --amber: #B8860B;
  --red: #C0392B;

  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 6px 24px rgba(45, 52, 54, 0.08);
  --shadow-lg: 0 12px 40px rgba(45, 52, 54, 0.12);

  --font-body: "Nunito", ui-sans-serif, system-ui, sans-serif;
  --font-display: "Quicksand", ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }

/* Das hidden-Attribut muss display-Regeln (flex/grid) schlagen — sonst bleiben
   Modal/Footer/versteckte Views sichtbar. */
[hidden] { display: none !important; }

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--charcoal);
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(168, 213, 162, 0.18), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(116, 185, 255, 0.12), transparent 55%),
    var(--cream);
  min-height: 100vh;
  line-height: 1.65;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; margin: 0 0 0.4em; }
h1 { font-size: clamp(1.5rem, 4vw, 2rem); }
p { margin: 0 0 1rem; }
strong { font-weight: 700; }
.muted { color: var(--charcoal-light); }
.hint { font-size: 0.85rem; color: var(--charcoal-light); margin: 0.4rem 0 0; }

a { color: var(--sage-dark); }

.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--sage-dark); color: #fff;
  padding: 0.5rem 1rem; border-radius: 0 0 8px 0; z-index: 100;
}
.skip-link:focus { left: 0; }

:focus-visible { outline: 2px solid var(--sage); outline-offset: 2px; border-radius: 4px; }

/* ─── Topbar / Footer ─── */
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(250, 246, 241, 0.85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--cream-dark); }
.topbar-inner { max-width: 1080px; margin: 0 auto; padding: 0.7rem 1.1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { font-family: var(--font-display); font-weight: 700; color: var(--sage-dark); }
.topbar-nav { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.footer { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 1rem; max-width: 1080px; width: 100%; margin-left: auto; margin-right: auto; padding: 1.2rem 1.1rem 1.8rem; color: var(--charcoal-light); font-size: 0.85rem; }

/* ─── Main / Views ─── */
.main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 1.6rem 1.1rem; }
.view-wide, .main:has(#view-training:not([hidden])), .main:has(#view-admin:not([hidden])), .main:has(#view-audit:not([hidden])) { }
.main:has(.view-wide:not([hidden])) { max-width: 1000px; }
.view { animation: fade-in 0.4s ease both; }
@keyframes fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.loader { text-align: center; padding: 4rem 0; color: var(--charcoal-light); }

.stack { display: grid; gap: 1.1rem; }

/* ─── Cards ─── */
.card { background: var(--white); border-radius: var(--radius); padding: 1.6rem; box-shadow: var(--shadow); border: 1px solid rgba(45,52,54,0.04); }
.card-narrow { max-width: 420px; margin: 6vh auto 0; text-align: center; }
.card-emoji { font-size: 2.6rem; line-height: 1; margin-bottom: 0.4rem; }

/* ─── Forms ─── */
.field { display: block; text-align: left; margin: 0 0 1rem; }
.field > span { display: block; font-weight: 700; font-size: 0.9rem; margin-bottom: 0.35rem; }
.field input {
  width: 100%; padding: 0.8rem 0.9rem; border: 2px solid var(--cream-dark); border-radius: var(--radius-sm);
  font: inherit; background: var(--cream); color: var(--charcoal); transition: border-color 0.15s;
}
.field input:focus { outline: none; border-color: var(--sage); background: #fff; }

.form-error { color: var(--red); background: rgba(192,57,43,0.08); border-radius: var(--radius-sm); padding: 0.6rem 0.8rem; font-size: 0.9rem; margin: 0 0 1rem; }

.meter { display: block; height: 6px; background: var(--cream-dark); border-radius: 99px; margin-top: 0.5rem; overflow: hidden; }
.meter-bar { display: block; height: 100%; width: 0; border-radius: 99px; transition: width 0.25s, background 0.25s; background: var(--warm-gray); }

/* ─── Buttons ─── */
.btn { font-family: var(--font-display); font-weight: 700; border: none; cursor: pointer; border-radius: 99px; padding: 0.75rem 1.4rem; font-size: 1rem; transition: transform 0.12s, box-shadow 0.15s, background 0.15s; display: inline-flex; align-items: center; gap: 0.4rem; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--sage); color: #173b16; box-shadow: 0 4px 14px rgba(124,174,122,0.4); }
.btn-primary:hover { background: var(--sage-dark); color: #fff; }
.btn-outline { background: transparent; color: var(--sage-dark); border: 2px solid var(--sage); }
.btn-outline:hover { background: var(--sage); color: #173b16; }
.btn-ghost { background: transparent; color: var(--charcoal-light); padding: 0.5rem 0.8rem; }
.btn-ghost:hover { background: var(--cream-dark); color: var(--charcoal); }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.88rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── Status banner / badges ─── */
.status-banner { display: flex; align-items: center; gap: 0.7rem; padding: 0.9rem 1.1rem; border-radius: var(--radius-sm); font-weight: 700; margin-top: 0.6rem; }
.status-banner.green { background: rgba(92,142,90,0.12); color: var(--green); }
.status-banner.amber { background: rgba(184,134,11,0.12); color: var(--amber); }
.status-banner.red { background: rgba(192,57,43,0.10); color: var(--red); }
.status-banner .dot { width: 10px; height: 10px; border-radius: 99px; background: currentColor; flex: none; }

.badge { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.25rem 0.6rem; border-radius: 99px; font-size: 0.8rem; font-weight: 700; white-space: nowrap; }
.badge .dot { width: 8px; height: 8px; border-radius: 99px; background: currentColor; }
.badge.green { background: rgba(92,142,90,0.14); color: var(--green); }
.badge.amber { background: rgba(184,134,11,0.14); color: var(--amber); }
.badge.red { background: rgba(192,57,43,0.12); color: var(--red); }

/* ─── Tiles ─── */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; }
.tile { background: var(--white); border: 1px solid rgba(45,52,54,0.05); border-radius: var(--radius); padding: 1.4rem 1.2rem; box-shadow: var(--shadow); cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 0.25rem; font: inherit; color: inherit; transition: transform 0.15s, box-shadow 0.15s; }
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.tile:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.tile-emoji { font-size: 2rem; }
.tile-title { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; }
.tile-sub { color: var(--charcoal-light); font-size: 0.9rem; }

.card-admin-hint { padding: 1rem 1.4rem; }
.card-admin-hint p { margin: 0; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* ─── Training ─── */
.training-head { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.progress { flex: 1; min-width: 120px; height: 8px; background: var(--cream-dark); border-radius: 99px; overflow: hidden; }
.progress-bar { display: block; height: 100%; width: 0; background: var(--sage); border-radius: 99px; transition: width 0.4s; }
.toggle { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.9rem; font-weight: 700; color: var(--charcoal-light); cursor: pointer; user-select: none; }
.toggle input { width: 1.1rem; height: 1.1rem; accent-color: var(--sage); }

.module { background: var(--white); border-radius: var(--radius); padding: 1.8rem; box-shadow: var(--shadow); }
.module-head { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 0.4rem; }
.module-emoji { font-size: 2.4rem; line-height: 1; }
.module-kicker { color: var(--sage-dark); font-weight: 700; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }
.module-summary { font-size: 1.1rem; color: var(--charcoal); background: var(--cream); border-left: 4px solid var(--sage); padding: 0.8rem 1rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 0.6rem 0 1.4rem; }

.block { margin: 0 0 1.1rem; }
.block ul { margin: 0; padding-left: 1.3rem; }
.block li { margin-bottom: 0.4rem; }
.block-tip, .block-warn { border-radius: var(--radius-sm); padding: 0.9rem 1.1rem; display: flex; gap: 0.6rem; }
.block-tip { background: rgba(92,142,90,0.10); }
.block-warn { background: rgba(225,112,85,0.12); }
.block-tip::before { content: "💡"; } .block-warn::before { content: "⚠️"; }
.block-advanced { border: 1px dashed var(--sage-light); border-radius: var(--radius-sm); padding: 0.9rem 1.1rem; background: rgba(116,185,255,0.06); }
.block-advanced .adv-tag { display: inline-block; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--sky); margin-bottom: 0.3rem; }

/* Reveal cards */
.reveal { display: grid; gap: 0.7rem; }
.reveal-card { border: 2px solid var(--cream-dark); border-radius: var(--radius-sm); overflow: hidden; }
.reveal-q { width: 100%; text-align: left; background: var(--cream); border: none; font: inherit; font-weight: 700; padding: 0.85rem 1rem; cursor: pointer; display: flex; justify-content: space-between; gap: 0.6rem; color: var(--charcoal); }
.reveal-q::after { content: "+"; color: var(--sage-dark); font-size: 1.3rem; line-height: 1; }
.reveal-card.open .reveal-q::after { content: "−"; }
.reveal-a { padding: 0 1rem; max-height: 0; overflow: hidden; transition: max-height 0.3s, padding 0.3s; color: var(--charcoal-light); }
.reveal-card.open .reveal-a { padding: 0.2rem 1rem 0.9rem; max-height: 400px; }

/* Phishing / choice interactive */
.quiz { display: grid; gap: 0.8rem; }
.quiz-item { border: 2px solid var(--cream-dark); border-radius: var(--radius-sm); padding: 1rem; }
.quiz-text { margin: 0 0 0.7rem; }
.quiz-btns { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.quiz-feedback { margin: 0.7rem 0 0; padding: 0.7rem 0.9rem; border-radius: var(--radius-sm); font-size: 0.92rem; }
.quiz-feedback.ok { background: rgba(92,142,90,0.12); color: var(--green); }
.quiz-feedback.no { background: rgba(192,57,43,0.10); color: var(--red); }
.chip { border: 2px solid var(--cream-dark); background: #fff; border-radius: 99px; padding: 0.45rem 1rem; font: inherit; font-weight: 700; cursor: pointer; color: var(--charcoal); }
.chip:hover { border-color: var(--sage); }
.chip.sel-ok { background: var(--sage); color: #173b16; border-color: var(--sage); }
.chip.sel-no { background: var(--coral); color: #fff; border-color: var(--coral); }
.chip:disabled { cursor: default; }

/* Password demo */
.pwdemo { border: 2px solid var(--cream-dark); border-radius: var(--radius-sm); padding: 1rem; }
.pwdemo input { width: 100%; padding: 0.7rem 0.9rem; border: 2px solid var(--cream-dark); border-radius: var(--radius-sm); font: inherit; }
.pwdemo .meter { margin-top: 0.7rem; height: 8px; }
.pwdemo-label { font-weight: 700; margin-top: 0.5rem; font-size: 0.9rem; }

.training-nav { display: flex; justify-content: space-between; gap: 0.8rem; margin-top: 1.3rem; }

/* ─── Presentation mode ─── */
body.present { background: #14211a; }
body.present .topbar, body.present .footer { display: none; }
body.present .main { max-width: 1100px; }
body.present .training-head .toggle, body.present #training-back { opacity: 0.5; }
body.present .module { min-height: 70vh; font-size: 1.25rem; padding: 2.6rem; }
body.present .module h2 { font-size: 2.2rem; }
body.present .module-summary { font-size: 1.4rem; }

/* ─── Audit ─── */
.audit-title { margin: 0; }
.audit-lead { max-width: 60ch; }
.audit-list { display: grid; gap: 0.8rem; margin-bottom: 1.2rem; }
.audit-item { background: var(--white); border-radius: var(--radius-sm); padding: 1rem 1.2rem; box-shadow: var(--shadow); }
.audit-q { font-weight: 600; margin: 0 0 0.7rem; }
.audit-opts { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.audit-opts label { flex: 1; min-width: 90px; }
.audit-opts input { position: absolute; opacity: 0; pointer-events: none; }
.audit-opts span { display: block; text-align: center; padding: 0.5rem; border: 2px solid var(--cream-dark); border-radius: 99px; font-weight: 700; cursor: pointer; transition: all 0.12s; }
.audit-opts input:checked + span { border-color: var(--sage); background: var(--sage); color: #173b16; }
.audit-opts input:focus-visible + span { outline: 2px solid var(--sage); outline-offset: 2px; }
.audit-item.unanswered { box-shadow: 0 0 0 2px var(--coral); }
.audit-foot { display: flex; flex-direction: column; align-items: flex-start; gap: 0.6rem; }
.audit-result { margin-top: 1.4rem; }
.audit-result .card { margin-bottom: 1rem; }
.score-ring { font-size: 2.4rem; font-weight: 800; font-family: var(--font-display); color: var(--sage-dark); }
.tip-list { display: grid; gap: 0.6rem; }
.tip-row { background: var(--cream); border-left: 4px solid var(--sunflower); padding: 0.7rem 1rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.tip-row .tip-q { font-weight: 700; }

/* ─── Admin ─── */
.admin-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 0.9rem; margin-bottom: 1.2rem; }
.stat { background: var(--white); border-radius: var(--radius-sm); padding: 1rem 1.2rem; box-shadow: var(--shadow); }
.stat-num { font-size: 2rem; font-weight: 800; font-family: var(--font-display); line-height: 1; }
.stat-label { color: var(--charcoal-light); font-size: 0.9rem; }
.admin-actions { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1rem; flex-wrap: wrap; }
.admin-actions .spacer { flex: 1; }
.table-wrap { overflow-x: auto; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); }
.admin-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.admin-table th, .admin-table td { text-align: left; padding: 0.8rem 1rem; border-bottom: 1px solid var(--cream-dark); }
.admin-table th { font-family: var(--font-display); font-size: 0.85rem; color: var(--charcoal-light); position: sticky; top: 0; background: var(--white); }
.admin-table tr.is-function { opacity: 0.7; }
.admin-table tr.is-function .name-main::after { content: " · Funktion"; color: var(--warm-gray); font-weight: 400; font-size: 0.8rem; }
.admin-table tr.inactive .name-main { text-decoration: line-through; color: var(--warm-gray); }
.name-main { font-weight: 700; }
.name-sub { color: var(--charcoal-light); font-size: 0.82rem; }
.row-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

/* ─── Toast ─── */
.toast { position: fixed; left: 50%; bottom: 1.4rem; transform: translateX(-50%) translateY(20px); background: var(--charcoal); color: #fff; padding: 0.8rem 1.3rem; border-radius: 99px; box-shadow: var(--shadow-lg); opacity: 0; transition: opacity 0.25s, transform 0.25s; z-index: 60; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--red); }

/* ─── Modal ─── */
.modal { position: fixed; inset: 0; background: rgba(45,52,54,0.5); display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 70; }
.modal-card { background: #fff; border-radius: var(--radius); padding: 1.6rem; max-width: 440px; width: 100%; box-shadow: var(--shadow-lg); }
.reset-pw { font-family: ui-monospace, monospace; font-size: 1.3rem; font-weight: 700; background: var(--cream); border: 2px dashed var(--sage); border-radius: var(--radius-sm); padding: 0.9rem; text-align: center; word-break: break-all; user-select: all; margin: 0.6rem 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1rem; }

@media (max-width: 560px) {
  .training-nav { flex-direction: column-reverse; }
  .training-nav .btn { width: 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
