/* Termine: öffentliche Liste, Anmelde-Dialog und Verwaltungsbereich */
section[hidden] { display: none !important; }

.termine-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 24px;
  margin-top: 32px;
}

.termin {
  display: flex;
  flex-direction: column;
  background: var(--sand2);
  border: 1px solid var(--line);
  border-top: 4px solid #e6b550;
  border-radius: 26px 26px 26px 6px;
  overflow: hidden;
  transition: transform 0.3s var(--ease-bounce);
}
.termin:nth-child(even) { border-radius: 26px 26px 6px 26px; }
.termin:hover { transform: translateY(-4px); }

.termin-bild { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }

.termin-body { padding: 24px 26px 28px; display: flex; flex-direction: column; flex: 1; }

.termin-kopf { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.termin-datum {
  flex: none;
  min-width: 56px;
  text-align: center;
  background: var(--sand);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 6px 8px;
  font-family: var(--display);
  line-height: 1.1;
}
.termin-datum strong { display: block; font-size: 1.5rem; color: var(--lehm-dark); font-weight: 500; }
.termin-datum span { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.termin-angebot { font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--lehm); }

.termin h3 { font-family: var(--display); font-weight: 500; font-size: 1.3rem; color: var(--lehm-dark); margin: 0 0 10px; }
.termin-meta { list-style: none; margin: 0 0 12px; padding: 0; font-size: 0.93rem; color: var(--muted); }
.termin-meta li { margin-bottom: 2px; }
.termin-meta strong { color: var(--text); font-weight: 600; }
.termin-text { margin: 0 0 18px; font-size: 0.95rem; color: var(--muted); white-space: pre-line; }
.termin .btn { margin-top: auto; align-self: flex-start; border: 0; cursor: pointer; font-family: var(--body); }

.termine-leer {
  grid-column: 1 / -1;
  background: var(--sand2);
  border: 1px dashed var(--line);
  border-radius: 20px;
  padding: 28px;
  color: var(--muted);
}
.termine-more { margin: 28px 0 0; }
.termine-more .btn-line { margin-left: 0; }

/* Anmelde-Dialog */
dialog.anmeldung {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 30px 28px;
  border: 1px solid var(--line);
  border-radius: 26px 26px 26px 8px;
  background: var(--sand);
  color: var(--text);
}
dialog.anmeldung::backdrop { background: rgba(63, 47, 38, 0.45); }
dialog.anmeldung h2 { font-family: var(--display); font-weight: 500; font-size: 1.4rem; color: var(--lehm-dark); margin: 0 0 4px; }
dialog.anmeldung .sub { margin: 0 0 18px; color: var(--muted); font-size: 0.95rem; }

.formrow { margin-bottom: 14px; }
.formrow label, .formrow .lbl { display: block; font-size: 0.88rem; font-weight: 600; margin-bottom: 5px; }
.formrow input[type="text"], .formrow input[type="email"], .formrow input[type="tel"],
.formrow input[type="number"], .formrow input[type="date"], .formrow input[type="time"],
.formrow input[type="password"], .formrow select, .formrow textarea {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  padding: 11px 13px;
  background: #fbf7ef;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.formrow textarea { min-height: 96px; resize: vertical; }
.formrow input:focus, .formrow select:focus, .formrow textarea:focus { outline: 2px solid var(--sonne); outline-offset: 1px; }
.formrow .hint { font-size: 0.82rem; color: var(--muted); margin: 4px 0 0; }
.formrow.check label { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: 0.9rem; }
.formrow.check input { margin-top: 4px; flex: none; }
.formrow.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-status { margin: 12px 0 0; font-size: 0.93rem; min-height: 1.4em; }
.form-status.err { color: #9b2f2f; }
.form-status.ok { color: #4d6b2f; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.form-actions .btn { border: 0; cursor: pointer; font-family: var(--body); margin: 0; }
.form-actions .btn-line { border: 1px solid var(--lehm); }
.form-actions .btn-danger { background: transparent; color: #9b2f2f; border: 1px solid #c58a8a; margin-left: auto; }

/* Verwaltungsbereich: klare Übersicht, normale Schriftstärke, gute Kontraste */
.admin-wrap { max-width: 800px; margin: 0 auto; padding: 48px 20px 90px; color: var(--text); }
.admin-wrap h1 { font-family: var(--display); font-weight: 500; color: var(--lehm-dark); font-size: 2rem; margin: 0 0 6px; }
.admin-card { background: var(--sand2); border: 1px solid var(--line); border-radius: 22px; padding: 26px; margin-top: 22px; }
.admin-top { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 12px; }
.top-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.admin-wrap [hidden] { display: none !important; }

/* Buttons im Verwaltungsbereich: ruhig, gut lesbar, ohne Leuchten */
.admin-wrap .btn { margin: 0; border: 0; cursor: pointer; font-family: var(--body); font-size: 0.95rem; font-weight: 500; padding: 10px 22px; animation: none; }
.admin-wrap .btn:not(.btn-line):not(.btn-white) { background: var(--lehm-dark); color: #fff; box-shadow: none; }
.admin-wrap .btn:not(.btn-line):not(.btn-white):hover { box-shadow: 0 3px 12px rgba(63, 47, 38, 0.28); }
.admin-wrap .btn.btn-line { background: transparent; border: 1.5px solid var(--lehm-dark); color: var(--lehm-dark); }
.admin-wrap .btn.btn-line:hover { box-shadow: none; background: rgba(143, 79, 47, 0.1); }
.admin-wrap .btn.btn-gross { font-size: 1rem; padding: 12px 26px; }
.admin-wrap .btn:focus-visible { outline: 3px solid var(--sonne); outline-offset: 3px; }

.neu-bar { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; justify-content: space-between; margin: 26px 0 8px; }
.neu-bar p { margin: 0; flex: 1 1 280px; color: var(--muted); }

.t-gruppe { font-family: var(--display); font-weight: 500; font-size: 1.25rem; color: var(--lehm-dark); margin: 30px 0 12px; }
.t-leer { background: #fbf7ef; border: 1px dashed #bfae90; border-radius: 16px; padding: 22px; margin: 0; color: var(--muted); }

.t-card {
  display: flex; gap: 16px; align-items: center;
  background: #fffdf8; border: 1px solid #d3c5aa; border-radius: 18px;
  padding: 14px 16px; margin-bottom: 12px;
}
.t-card.vorbei { background: #f3ecdf; }
.t-card.in-serie { margin: 0 0 8px; padding: 12px 14px; }
.t-datum {
  flex: none; width: 62px; text-align: center; line-height: 1.1;
  background: var(--sand2); border: 1px solid #d3c5aa; border-radius: 14px; padding: 7px 4px;
}
.t-datum strong { display: block; font-family: var(--display); font-weight: 500; font-size: 1.5rem; color: var(--lehm-dark); }
.t-datum .t-wt, .t-datum .t-mon { display: block; font-size: 0.72rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.t-wdh { background: #f2e1c2; border-color: #d2b57e; }
.t-main { flex: 1; min-width: 0; }
.t-titel { font-family: var(--display); font-weight: 500; font-size: 1.1rem; color: var(--lehm-dark); margin: 0 0 3px; overflow-wrap: anywhere; }
.t-info { font-size: 0.93rem; color: var(--muted); margin: 0; overflow-wrap: anywhere; }
.t-tags { margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.t-tag { font-size: 0.8rem; font-weight: 500; border-radius: 999px; padding: 2px 11px; }
.t-tag.ok { background: #e1eed6; color: #35541f; }
.t-tag.warn { background: #f6e3be; color: #6f4a05; }
.t-btn { flex: none; }

.t-serienliste { margin: 8px 0 14px 28px; padding-left: 14px; border-left: 3px solid #d3c5aa; }
.t-serienliste[hidden] { display: none; }
.t-serie .t-serienkopf { margin-bottom: 8px; }

.t-vergangen { margin-top: 34px; }
.t-vergangen > summary { cursor: pointer; font-family: var(--display); font-weight: 500; font-size: 1.15rem; color: var(--lehm-dark); padding: 8px 0; margin-bottom: 10px; }
.t-vergangen > summary:focus-visible { outline: 3px solid var(--sonne); outline-offset: 3px; border-radius: 6px; }

.bild-vorschau { max-width: 260px; border-radius: 14px; margin-bottom: 8px; }

/* Termin-Popup */
dialog.editor-dialog {
  width: min(680px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--sand);
  color: var(--text);
  box-shadow: 0 24px 70px rgba(63, 47, 38, 0.35);
}
dialog.editor-dialog::backdrop { background: rgba(63, 47, 38, 0.5); }
dialog.editor-dialog[open] { animation: popup-auf 0.22s ease-out; }
@keyframes popup-auf { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { dialog.editor-dialog[open] { animation: none; } }
.editor-dialog form { padding: 24px 28px 28px; }
.dlg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.dlg-head h2 { font-family: var(--display); font-weight: 500; font-size: 1.5rem; color: var(--lehm-dark); margin: 0; }
.dlg-x { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: #fffdf8; color: var(--text); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.dlg-x:hover { background: var(--sand2); }
.dlg-x:focus-visible { outline: 3px solid var(--sonne); outline-offset: 2px; }

/* Formularfelder im Popup */
.admin-wrap .formrow label, .admin-wrap .formrow .lbl { font-size: 0.92rem; font-weight: 500; margin-bottom: 5px; color: var(--text); }
.admin-wrap .formrow input[type="text"], .admin-wrap .formrow input[type="date"], .admin-wrap .formrow input[type="time"],
.admin-wrap .formrow input[type="password"], .admin-wrap .formrow select, .admin-wrap .formrow textarea { background: #fffdf8; border: 1px solid #c4b494; font-size: 1rem; }
.admin-wrap .formrow .hint { font-size: 0.88rem; color: var(--muted); margin-top: 6px; }
.admin-wrap .formrow.check label { font-size: 0.95rem; font-weight: 400; line-height: 1.45; align-items: flex-start; }
.admin-wrap input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--lehm-dark); margin-top: 2px; }
.admin-wrap input[type="file"] { font-size: 0.95rem; color: var(--text); width: 100%; }
.admin-wrap input[type="file"]::file-selector-button { font: inherit; font-weight: 500; color: var(--lehm-dark); background: #fffdf8; border: 1.5px solid var(--lehm-dark); border-radius: 999px; padding: 7px 16px; margin-right: 12px; cursor: pointer; }
.admin-wrap .form-status { font-size: 0.95rem; }
.admin-wrap .form-status.err { color: #8a1f1f; }
.admin-wrap .form-status.ok { color: #2f5a1c; }
.admin-wrap .form-actions { margin-top: 14px; gap: 12px; }

.danger-zone { margin-top: 26px; padding-top: 16px; border-top: 1px solid #c4b494; }
.danger-zone[hidden] { display: none; }
.dz-titel { margin: 0 0 10px; font-size: 0.92rem; font-weight: 500; color: var(--muted); }
.dz-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.admin-wrap .btn.btn-danger:not(.btn-line):not(.btn-white) { background: #fff4f1; color: #8a1f1f; border: 1.5px solid #b45a5a; box-shadow: none; margin: 0; }
.admin-wrap .btn.btn-danger:not(.btn-line):not(.btn-white):hover { background: #fbe3dd; box-shadow: none; }

@media (max-width: 600px) {
  .formrow.two { grid-template-columns: 1fr; }
  .t-card { flex-wrap: wrap; }
  .t-main { flex: 1 1 calc(100% - 90px); }
  .t-btn { width: 100%; text-align: center; }
  .t-serienliste { margin-left: 6px; padding-left: 10px; }
  .neu-bar .btn { width: 100%; }
  dialog.editor-dialog { width: calc(100vw - 16px); max-height: calc(100vh - 16px); border-radius: 22px; }
  .editor-dialog form { padding: 20px 18px 22px; }
}

/* Passwort vergessen / ändern */
.linkbtn { background: none; border: 0; padding: 0; font: inherit; font-size: 0.95rem; font-weight: 500; color: var(--lehm-dark); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.linkbtn:hover { color: var(--lehm); }
.linkbtn:focus-visible { outline: 2px solid var(--sonne); outline-offset: 3px; border-radius: 4px; }
.forgot { margin: 14px 0 0; }
.pwcard { margin-top: 40px; }
.pwcard summary { cursor: pointer; font-weight: 500; font-size: 1rem; color: var(--lehm-dark); }

/* V21: Buttons pro Termin (Teilnehmende + Bearbeiten) */
.t-btns { display: flex; gap: 8px; flex: none; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 640px) { .t-btns { width: 100%; } .t-btns .t-btn { flex: 1; } }

/* V21: Auge (sichtbar/versteckt) und Mülltonne direkt auf der Karte */
.t-icons { display: inline-flex; gap: 8px; align-items: center; }
.t-icon {
  width: 42px; height: 42px; padding: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--lehm); color: var(--lehm-dark);
  cursor: pointer; font-family: inherit;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.25s ease;
}
.t-icon:hover { box-shadow: 0 0 14px rgba(240, 184, 74, 0.5); }
.t-icon.aus { background: #efe3cf; color: var(--muted); border-style: dashed; }
.t-icon.weg:hover { background: #fbeceb; color: #a3281f; border-color: #a3281f; box-shadow: none; }
.t-icon:focus-visible { outline: 2px solid var(--sonne); outline-offset: 2px; }
.t-card.verborgen .t-main, .t-card.verborgen .t-datum { opacity: 0.55; }
@media (max-width: 640px) {
  .t-icons { width: 100%; justify-content: flex-end; }
}

/* V21: fehlende Pflichtfelder im Termin-Editor rot markieren */
.editor-dialog .fehlt > label, .editor-dialog .fehlt > .lbl { color: #a3281f; font-weight: 600; }
.editor-dialog .fehlt input, .editor-dialog .fehlt select, .editor-dialog .fehlt textarea {
  border-color: #c0392b !important; background: #fdf1ef; box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.18);
}
.editor-dialog .fehlt input:focus { outline-color: #c0392b; }

/* V21: Danke-Fenster nach der Anmeldung */
dialog.danke {
  width: min(420px, calc(100vw - 32px));
  padding: 34px 28px 30px; text-align: center;
  border: 1px solid var(--line); border-radius: 26px 26px 26px 8px;
  background: var(--sand); color: var(--text);
}
dialog.danke::backdrop { background: rgba(63, 47, 38, 0.45); }
dialog.danke[open] { animation: popup-auf 0.25s ease-out; }
dialog.danke h2 { font-family: var(--display); font-weight: 500; font-size: 1.5rem; color: var(--lehm-dark); margin: 14px 0 8px; }
dialog.danke .danke-text { margin: 0 0 22px; color: var(--muted); line-height: 1.55; }
dialog.danke .btn { border: 0; cursor: pointer; font-family: var(--body); margin: 0; }
.danke-icon { width: 68px; height: 68px; margin: 0 auto; }
.danke-icon svg { width: 100%; height: 100%; }
.dk-kreis { fill: #f7e6bd; stroke: var(--glut); stroke-width: 2.5; }
.dk-haken { fill: none; stroke: var(--lehm-dark); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; }
dialog.danke[open] .dk-haken { animation: haken-zeichnen 0.5s 0.2s ease-out forwards; }
@keyframes haken-zeichnen { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  dialog.danke[open] { animation: none; }
  .dk-haken { stroke-dashoffset: 0; }
  dialog.danke[open] .dk-haken { animation: none; }
}
