/* Anmeldetool 5. Klassen – gemeinsames Stylesheet (Basis: Anmeldetool Tag der offenen Tür) */
:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --ink: #1d2733;
  --muted: #5d6b7a;
  --line: #dde3ea;
  --primary: #1f5c99;
  --primary-ink: #ffffff;
  --primary-soft: #e6f0fa;
  --accent: #e8913a;
  --ok: #2e7d4f;
  --ok-soft: #e5f4ea;
  --warn: #9a6200;
  --warn-soft: #fff4dc;
  --error: #b3261e;
  --error-soft: #fde8e6;
  --full: #eceff2;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 30, 45, .06), 0 2px 8px rgba(20, 30, 45, .05);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
code, .code { font-family: ui-monospace, Consolas, monospace; font-size: .9em; }
.code { background: #1d2733; color: #e8eef5; padding: 1rem; border-radius: 8px; overflow: auto; }
.muted, small { color: var(--muted); }
small { display: block; font-size: .85rem; margin-top: .2rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 640px; margin: 2rem auto; padding: 0 16px; }

/* ---------- Kopfbereich ---------- */
.hero {
  background: linear-gradient(135deg, var(--primary), #163f6b);
  color: #fff;
  padding: 2.2rem 0 2.6rem;
  margin-bottom: 1.5rem;
}
.hero h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); }
.kicker { text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; opacity: .85; margin: 0 0 .3rem; }
.date { font-size: 1.1rem; margin: 0; opacity: .95; }
.date::before { content: "📅 "; }

/* ---------- Karten & Layout ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.2rem;
}
.intro { margin-bottom: 1.5rem; font-size: 1.05rem; }
.intro p:last-child { margin: 0; }
.block { margin: 2rem 0; }
.hint { color: var(--muted); }
.step {
  display: inline-grid; place-items: center;
  width: 1.8rem; height: 1.8rem; margin-right: .4rem;
  border-radius: 50%; background: var(--primary); color: #fff; font-size: .95rem;
}
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1rem; }
.stack > * + * { margin-top: .9rem; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
.row2 > * { margin-top: 0 !important; }
@media (max-width: 560px) { .row2 { grid-template-columns: 1fr; } }

/* ---------- Zeitfenster ---------- */
.slots { display: flex; flex-direction: column; gap: .45rem; margin-top: .6rem; }
.slot {
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem .75rem;
  border: 1.5px solid var(--line); border-radius: 10px;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.slot:hover { border-color: var(--primary); }
.slot input { width: 1.15rem; height: 1.15rem; accent-color: var(--primary); margin: 0; }
.slot-time { font-weight: 600; flex: 1; }
.slot-free { font-size: .85rem; color: var(--ok); margin: 0; }
.slot:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.slot.is-full { background: var(--full); color: #8a96a3; cursor: not-allowed; border-color: var(--full); }
.slot.is-full .slot-free { color: #8a96a3; }
.slot.is-clash { opacity: .55; }
.slot.is-clash .slot-free::after { content: " · überschneidet sich"; color: var(--warn); }

/* ---------- Spenden ---------- */
.donations { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1rem; }
.donation { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.donation h3 { margin-bottom: .2rem; }
.donation p { margin: 0; }
.donation.is-full { background: var(--full); color: #8a96a3; box-shadow: none; }
.donation.is-full .slot-free { color: #8a96a3; }
.qty { display: flex; align-items: center; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; flex-shrink: 0; }
.qty.has-value { border-color: var(--accent); }
.qty input { width: 3rem; text-align: center; border: 0; padding: .45rem 0; font: inherit; font-weight: 600; -moz-appearance: textfield; }
.qty input::-webkit-inner-spin-button { -webkit-appearance: none; }
.qty-btn { border: 0; background: var(--bg); width: 2.3rem; height: 2.3rem; font-size: 1.2rem; cursor: pointer; color: var(--ink); }
.qty-btn:hover { background: var(--primary-soft); }

/* ---------- Formulare ---------- */
label { display: block; font-weight: 600; font-size: .95rem; }
input, select, textarea {
  display: block; width: 100%; margin-top: .3rem;
  padding: .6rem .7rem;
  border: 1.5px solid var(--line); border-radius: 8px;
  font: inherit; font-weight: 400; color: var(--ink); background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea { resize: vertical; }
input[type=checkbox], input[type=radio] { width: auto; display: inline-block; margin: 0; }
.check { display: flex; gap: .7rem; align-items: flex-start; font-weight: 400; }
.check input { margin-top: .25rem; width: 1.15rem; height: 1.15rem; flex-shrink: 0; accent-color: var(--primary); }
.req { color: var(--error); }

/* ---------- WYSIWYG-Editor (assets/editor.js) ---------- */
.field-label { display: block; font-weight: 600; font-size: .95rem; }
.rte { margin-top: .3rem; border: 1.5px solid var(--line); border-radius: 8px; background: #fff; overflow: hidden; }
.rte.focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.rte-bar { display: flex; flex-wrap: wrap; gap: .25rem; padding: .3rem; background: var(--bg); border-bottom: 1px solid var(--line); }
.rte-btn { border: 1px solid transparent; background: none; border-radius: 6px; padding: .25rem .5rem; font: inherit; font-size: .85rem; font-weight: 400; color: var(--ink); cursor: pointer; line-height: 1.3; }
.rte-btn:hover { background: #fff; border-color: var(--line); }
.rte-btn.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.rte-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.rte-select { width: auto; display: inline-block; margin: 0 0 0 auto; padding: .2rem .4rem; font-size: .85rem; }
.rte-area { padding: .6rem .7rem; font-weight: 400; color: var(--ink); outline: none; overflow-y: auto; max-height: 30rem; resize: vertical; }
.rte-area p { margin: 0 0 .6rem; }
.rte-area p:last-child { margin-bottom: 0; }
.rte-area ul, .rte-area ol { margin: 0 0 .6rem; padding-left: 1.5rem; }
.rte-area:empty::before { content: attr(data-placeholder); color: var(--muted); }
.intro ul, .intro ol, .notes ul, .notes ol { margin: 0 0 .6rem; padding-left: 1.5rem; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.btn {
  display: inline-flex; align-items: center; gap: .4rem; justify-content: center;
  padding: .6rem 1.1rem; border-radius: 8px;
  border: 1.5px solid var(--line); background: #fff; color: var(--ink);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: #174a7d; }
.btn-danger { color: var(--error); }
.btn-danger:hover { border-color: var(--error); background: var(--error-soft); }
.btn-sm { padding: .3rem .6rem; font-size: .85rem; }

.submitbar {
  position: sticky; bottom: 0;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(6px);
  border: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0;
  padding: .8rem 1.2rem; margin-top: 1rem; box-shadow: 0 -2px 10px rgba(20, 30, 45, .06);
}
#summary { color: var(--muted); }
@media (max-width: 560px) {
  .submitbar { flex-wrap: nowrap; padding: .6rem .8rem; gap: .6rem; }
  #summary { font-size: .82rem; line-height: 1.3; }
  .submitbar .btn { padding: .55rem .8rem; white-space: nowrap; }
}

/* ---------- Meldungen ---------- */
.alert { padding: .8rem 1rem; border-radius: 10px; margin: 1rem 0; border: 1px solid transparent; }
.alert ul { margin: .4rem 0 0; padding-left: 1.2rem; }
.alert-ok { background: var(--ok-soft); color: var(--ok); border-color: #bfe3cb; }
.alert-info { background: var(--primary-soft); color: #174a7d; border-color: #c7dcf1; }
.alert-warn { background: var(--warn-soft); color: var(--warn); border-color: #f1dca8; }
.alert-error { background: var(--error-soft); color: var(--error); border-color: #f4c3be; }
.alert-error:focus { outline: 2px solid var(--error); }

.thanks { margin: 1rem 0 2rem; }
.thanks h2 { color: var(--ok); }
.footer { color: var(--muted); font-size: .9rem; padding: 2rem 16px 3rem; text-align: center; }

/* ====================================================================
 * Admin-Bereich
 * ==================================================================== */
.admin-top { background: #163f6b; color: #fff; }
.admin-top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-top: .7rem; padding-bottom: .7rem; }
.admin-top strong { font-size: 1.05rem; }
.admin-top a { color: #cfe2f6; }
.admin-nav { background: #fff; border-bottom: 1px solid var(--line); margin-bottom: 1.5rem; }
.admin-nav .wrap { display: flex; gap: .2rem; overflow-x: auto; }
.admin-nav a { padding: .8rem .9rem; text-decoration: none; color: var(--muted); font-weight: 600; white-space: nowrap; border-bottom: 3px solid transparent; }
.admin-nav a.active { color: var(--primary); border-bottom-color: var(--primary); }
.admin main.wrap { padding-bottom: 3rem; }

.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.toolbar .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat .num { font-size: 1.8rem; font-weight: 700; color: var(--primary); }
.stat .lbl { color: var(--muted); font-size: .9rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; font-size: .93rem; }
th { background: var(--bg); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
td ul { margin: 0; padding-left: 1rem; }
td .btn { margin: 0 .2rem .2rem 0; }

.bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; min-width: 80px; margin-top: .3rem; }
.bar span { display: block; height: 100%; background: var(--ok); }
.bar.over span { background: var(--error); }
.bar.part span { background: var(--accent); }
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 99px; font-size: .78rem; font-weight: 600; background: var(--bg); color: var(--muted); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.err { background: var(--error-soft); color: var(--error); }
.people { list-style: none; padding: 0 !important; margin: 0; }
.people li { padding: .15rem 0; }
.section-title { margin: 2rem 0 .8rem; }

.station-admin { margin-bottom: 1.2rem; }
.form-row { display: grid; gap: .6rem; align-items: end; padding: .6rem 0; border-bottom: 1px dashed var(--line); }
.form-row:last-child { border-bottom: 0; }
.form-row label { font-size: .8rem; color: var(--muted); }
.form-row input { margin-top: .15rem; padding: .45rem .55rem; }
.slot-row { grid-template-columns: 110px 110px 110px 1fr auto; }
.item-row { grid-template-columns: 1.2fr 2fr 110px 90px auto; }
.station-row { grid-template-columns: 1fr 2fr 90px auto; }
.row-actions { display: flex; gap: .4rem; }
@media (max-width: 760px) {
  .slot-row, .item-row, .station-row { grid-template-columns: 1fr 1fr; }
  .row-actions, .form-row .info { grid-column: 1 / -1; }
}
details summary { cursor: pointer; font-weight: 600; color: var(--primary); }
.placeholder-list code { background: var(--primary-soft); padding: .05rem .3rem; border-radius: 4px; }
.mail-preview { background: var(--bg); border-radius: 8px; padding: 1rem; font-size: .92rem; }
.edit-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
.edit-slots .slot { padding: .4rem .6rem; }
.danger-zone { border-color: #f4c3be; }

@media print {
  .admin-top, .admin-nav, .toolbar .actions, .no-print, .btn { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 0; padding: 0; }
  table { font-size: 11px; }
  .station-print { break-inside: avoid; }
}

/* ====================================================================
 * Ergänzungen Anmeldetool 5. Klassen
 * ==================================================================== */
.rec-choice { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .6rem; }
.rec-choice .slot { background: #fff; padding: .8rem .9rem; }
.appointment .app-date { font-weight: 700; color: var(--primary); margin: 0 0 .2rem; }
.appointment .app-date::before { content: "📅 "; }
.appointment[hidden] { display: none; }
.appointment.is-full { background: var(--full); box-shadow: none; }
.rec-tag { display: inline-block; font-size: .8rem; font-weight: 600; background: var(--warn-soft); color: var(--warn); border-radius: 99px; padding: .1rem .6rem; }
.notes { background: var(--primary-soft); border-radius: 8px; padding: .6rem .8rem; font-size: .92rem; margin: .4rem 0; }
.notes p { margin: 0 0 .4rem; }
.notes p:last-child { margin: 0; }
#termine.is-locked .appointment { opacity: .5; pointer-events: none; }
.appointment-summary { border-left: 4px solid var(--ok); padding: .3rem 0 .3rem 1rem; margin: 1rem 0; }
.appointment-summary .when { font-size: 1.1rem; font-weight: 600; }

/* Admin: Termine */
.app-row { grid-template-columns: 1.4fr 150px 1fr; }
.rec-checks { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin-top: .3rem; }
.rec-checks .check { font-size: .9rem; color: var(--ink); align-items: center; }
.rec-checks .check input { margin-top: 0; }
.series-row { grid-template-columns: 110px 110px 110px 110px auto; }
.rec-row { grid-template-columns: 1fr 110px auto auto; }
.app-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.badge.past { background: var(--full); color: #8a96a3; }
.edit-apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.edit-apps .slot { padding: .4rem .6rem; }
@media (max-width: 760px) {
  .app-row, .series-row, .rec-row { grid-template-columns: 1fr 1fr; }
  .app-row > :first-child { grid-column: 1 / -1; }
}
