/* auth.css - Formular-Seiten des M2-Auth-Fundaments (Login, Registrierung,
 * Passwort-Setzen/-Vergessen, Konto, Freigabe-Queue).
 *
 * Mobile First: zentrierte Card (max ~440px), Brand-Navy/Gold. Nutzt die
 * Layout-Token aus tokens.css/base.css mit, definiert hier aber eigene,
 * robuste Fallback-Werte, damit die Seiten auch ohne diese Tokens stehen.
 */

:root {
  --auth-navy: #01426a;
  --auth-navy-deep: #002a47;
  --auth-gold: #F5C518;
  --auth-bg: #f6f7f9;
  --auth-card: #ffffff;
  --auth-line: #e3e7ee;
  --auth-text: var(--text-body);
  --auth-muted: #5f6b78;   /* WCAG AA: 5,44:1 auf weiß, 5,07:1 auf #f6f7f9 (vorher #6d7a89 = 4,38:1) */
  --auth-ok-bg: #e8f7ee;
  --auth-ok-border: #9bd9b3;
  --auth-ok-text: #1c6b3c;
  --auth-err-bg: #fdeceb;
  --auth-err-border: #efb1ac;
  --auth-err-text: #a32c22;
}

/* === Seiten-Wrapper === */
.auth-main {
  min-height: 60vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 16px 64px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--auth-card);
  border: 1px solid var(--auth-line);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(1, 66, 106, 0.08);
  padding: 28px 24px;
}

@media (min-width: 600px) {
  .auth-card { padding: 36px 32px; }
}

/* Registrierung: breitere Karte - das lange Formular wirkte in 440px zu schmal. */
.reg-wide .auth-card { max-width: 640px; }
.auth-card h1 {
  margin: 0 0 6px;
  font-size: 1.5rem;
  line-height: 1.2;
  color: var(--auth-navy);
}

.auth-card .auth-lead {
  margin: 0 0 22px;
  color: var(--auth-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* === Felder === */
.auth-field { margin-bottom: 16px; }

.auth-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--auth-text);
  margin-bottom: 6px;
}

.auth-field input[type="text"],
.auth-field input[type="email"],
.auth-field input[type="password"],
.auth-field input[type="tel"],
.auth-field input[type="url"],
.auth-field input[type="number"],
.auth-field select,
.auth-field textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--auth-text);
  background: #fff;
  border: 1px solid var(--auth-line);
  border-radius: 10px;
  -webkit-appearance: none;
  appearance: none;
}

/* Number-Feld (z.B. Mitgliederzahl): native Spinner entfernen, damit es sauber
   wie die übrigen Felder wirkt. Nur im auth-Kontext. */
.auth-field input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
.auth-field input[type="number"]::-webkit-outer-spin-button,
.auth-field input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.auth-field input:focus,
.auth-field select:focus,
.auth-field textarea:focus {
  outline: none;
  border-color: var(--auth-navy);
  box-shadow: 0 0 0 3px rgba(1, 66, 106, 0.14);
}

.auth-field textarea { min-height: 90px; resize: vertical; }

.auth-field .auth-hint {
  display: block;
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--auth-muted);
}

/* === Registrierung: 3-Wege-Typauswahl (Ehrenamt/Verein/Gewerbe) ===
 * Anklickbare Karten als Radio-Gruppe. Mobile First: gestapelt, ab 560px in
 * drei Spalten. Die nativen Radios sind verborgen; visueller Zustand auf .reg-kind-card. */
.reg-kind-fieldset {
  border: 0;
  padding: 0;
  margin: 0 0 16px;
}
.reg-kind-legend {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--auth-text);
  margin-bottom: 6px;
  padding: 0;
}
.reg-kind-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.reg-kind-option {
  display: block;
  position: relative;
  margin: 0;
  cursor: pointer;
}
/* Radio für AT erreichbar, aber visuell durch die Karte ersetzt. */
.reg-kind-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}
.reg-kind-card {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--auth-line);
  border-radius: 10px;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.reg-kind-title {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--auth-text);
}
.reg-kind-desc {
  display: block;
  margin-top: 2px;
  font-size: 0.8rem;
  color: var(--auth-muted);
  line-height: 1.4;
}
.reg-kind-option input[type="radio"]:checked + .reg-kind-card {
  border-color: var(--auth-navy);
  background: #f3f8fc;
  box-shadow: 0 0 0 2px rgba(1, 66, 106, 0.14);
}
.reg-kind-option input[type="radio"]:focus-visible + .reg-kind-card {
  outline: 2px solid var(--auth-navy);
  outline-offset: 2px;
}
.reg-kind-option:hover .reg-kind-card {
  border-color: var(--auth-navy);
}

@media (min-width: 560px) {
  /* Grid statt Flex: exakt gleiche Drittel unabhängig vom Textinhalt
     (flex-basis 0 konnte durch min-content langer Wörter ungleich werden).
     WICHTIG: Selektor mit Eltern-Kontext (.reg-kind-options .reg-kind-option),
     denn die Labels stecken in einem fieldset.auth-field - die generische Regel
     '.auth-field label { display:block }' (Spezifität 0,1,1) schlug das bloße
     '.reg-kind-option' (0,1,0) und verhinderte das Flex-Stretching: die dritte
     Karte (kürzester Text) blieb niedriger als ihre Grid-Zelle. */
  .reg-kind-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;   /* alle drei Optionen gleich hoch */
  }
  .reg-kind-options .reg-kind-option {
    min-width: 0;
    display: flex;          /* die Karte füllt die volle Höhe der Option */
  }
  .reg-kind-card {
    flex: 1;                /* Karte füllt Breite + Höhe -> alle drei Boxen exakt gleich groß */
  }
}

/* Auth-Card-Überschrift auch als h2 (Seiten mit Lead-Hero: h1 sitzt im Hero) */
.auth-card h2.auth-card-title {
  margin: 0 0 6px;
  font-size: 1.5rem;
  line-height: 1.2;
  font-family: var(--font-display);
  color: var(--auth-navy, var(--brand-navy));
}

/* OTP-Code-Eingabe: groß + gespreizt */
.auth-field input.auth-otp {
  text-align: center;
  font-size: 1.5rem;
  letter-spacing: 0.4em;
  font-weight: 700;
  padding-left: 0.4em;
}

/* Honeypot: visuell + für AT verborgen, aber im DOM */
.auth-hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* === Consent-Checkbox === */
.auth-consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 18px;
  font-size: 0.85rem;
  color: var(--auth-text);
  line-height: 1.45;
}
.auth-consent input { margin-top: 3px; flex: 0 0 auto; }
.auth-consent a { color: var(--auth-navy); }

/* === Buttons === */
.auth-btn {
  display: inline-block;
  width: 100%;
  padding: 13px 18px;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  text-align: center;
  text-decoration: none;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--auth-navy), var(--auth-navy-deep));
  color: #fff;
  transition: filter 0.15s ease;
}
.auth-btn:hover { filter: brightness(1.07); }


.auth-btn--ghost {
  background: transparent;
  color: var(--auth-navy);
  border: 1px solid var(--auth-line);
}

.auth-btn + .auth-btn { margin-top: 10px; }

/* === Notes (Fehler / Erfolg / Info / Warnung) - mit Icon-Badge === */
.nb-note {
  position: relative;
  padding: 13px 16px;
  border-radius: 12px;
  font-size: 1rem;
  line-height: 1.5;
  margin-bottom: 18px;
  border: 1px solid transparent;
}
/* Typisierte Boxen: kräftigerer Look + farbiges Icon-Badge links.
   Icon via ::before (absolut, vertikal zentriert) -> kein HTML-Eingriff an den Verwendungen nötig. */
.nb-note.nb-ok,
.nb-note.nb-err,
.nb-note.nb-info,
.nb-note.nb-warn {
  padding-left: 52px;
  box-shadow: 0 2px 9px rgba(1, 66, 106, .09);
  font-weight: 500;
}
.nb-note.nb-ok::before,
.nb-note.nb-err::before,
.nb-note.nb-info::before,
.nb-note.nb-warn::before {
  position: absolute;
  left: 15px;
  top: 13px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 24px;
  text-align: center;
}
.nb-note.nb-ok {
  background: var(--auth-ok-bg);
  border-color: var(--auth-ok-border);
  color: var(--auth-ok-text);
}
.nb-note.nb-ok::before { content: "\2713"; background: #1c9b52; }        /* Haken */
.nb-note.nb-err {
  background: var(--auth-err-bg);
  border-color: var(--auth-err-border);
  color: var(--auth-err-text);
}
.nb-note.nb-err::before { content: "\00D7"; background: #d23a2c; font-size: 19px; }  /* Kreuz */
.nb-note.nb-info {
  background: #eef4fb;
  border-color: #bcd4ec;
  color: #14456f;
}
.nb-note.nb-info::before { content: "i"; background: #2a72c0; }
.nb-note.nb-warn {
  background: #fdf6e3;
  border-color: #ecd595;
  color: #7a5c00;
}
.nb-note.nb-warn::before { content: "!"; background: #d29a00; }
/* Ausnahme: Spezial-Banner mit eigenem Flex-Layout (z.B. Konto-gesperrt-Banner) - kein Badge-Icon.
   Behält Schatten/Fettung, das inline-padding des Banners bleibt maßgeblich. */
.nb-note.nb-note--banner::before { content: none; }

/* === Hilfslinks unter der Card === */
.auth-links {
  margin-top: 18px;
  text-align: center;
  font-size: 0.88rem;
}
.auth-links a { color: var(--auth-navy); }
.auth-links .sep { color: var(--auth-muted); margin: 0 8px; }

.auth-row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* === Konto-Infozeilen === */
.auth-dl {
  margin: 0 0 22px;
  border-top: 1px solid var(--auth-line);
}
.auth-dl .auth-dl-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--auth-line);
  font-size: 0.95rem;
}
.auth-dl .auth-dl-row dt { color: var(--auth-muted); margin: 0; }
.auth-dl .auth-dl-row dd { margin: 0; font-weight: 600; text-align: right; word-break: break-word; }

.auth-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(1, 66, 106, 0.1);
  color: var(--auth-navy);
}
.auth-badge--on { background: var(--auth-ok-bg); color: var(--auth-ok-text); }
.auth-badge--off { background: #eef1f4; color: var(--auth-muted); }

.auth-section {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--auth-line);
}
.auth-section h2 {
  margin: 0 0 8px;
  font-size: 1.05rem;
  color: var(--auth-navy);
}
.auth-section p { margin: 0 0 14px; color: var(--auth-muted); font-size: 0.9rem; line-height: 1.5; }

/* === Freigabe-Queue (admin/veranstalter.php) === */
.queue-wrap { max-width: 880px; margin: 0 auto; padding: 28px 16px 64px; }
.queue-wrap h1 { color: var(--auth-navy); font-size: 1.5rem; margin: 0 0 6px; }
.queue-wrap .queue-lead { color: var(--auth-muted); margin: 0 0 24px; }

.queue-empty {
  background: var(--auth-card);
  border: 1px dashed var(--auth-line);
  border-radius: 14px;
  padding: 32px;
  text-align: center;
  color: var(--auth-muted);
}

.queue-card {
  background: var(--auth-card);
  border: 1px solid var(--auth-line);
  border-radius: 14px;
  padding: 18px 18px 16px;
  margin-bottom: 16px;
  box-shadow: 0 6px 18px rgba(1, 66, 106, 0.05);
}
.queue-card .queue-org { font-size: 1.1rem; font-weight: 700; color: var(--auth-text); margin: 0 0 4px; }
.queue-card .queue-meta { font-size: 0.88rem; color: var(--auth-muted); margin: 0 0 4px; line-height: 1.5; }
.queue-card .queue-meta a { color: var(--auth-navy); }

.queue-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--auth-line);
  align-items: flex-end;
}
.queue-actions form { margin: 0; }
.queue-actions .queue-reject { flex: 1 1 220px; }
.queue-actions .queue-reject label {
  display: block;
  font-size: 0.78rem;
  color: var(--auth-muted);
  margin-bottom: 4px;
}
.queue-actions .queue-reject input[type="text"] {
  width: 100%;
  padding: 9px 11px;
  font-size: 0.9rem;
  border: 1px solid var(--auth-line);
  border-radius: 8px;
  margin-bottom: 8px;
}
.queue-btn {
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: inherit;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
}
.queue-btn--ok { background: var(--auth-navy); color: #fff; }
.queue-btn--ok:hover { filter: brightness(1.08); }
.queue-btn--no { background: #fff; color: var(--auth-err-text); border: 1px solid var(--auth-err-border); }
.queue-btn--no:hover { background: var(--auth-err-bg); }
/* Destruktiv (Soft-Delete): gefülltes Rot - klar abgesetzt vom reversiblen Ablehnen (Rot-Outline). */
.queue-btn--del { background: var(--auth-err-text); color: #fff; border: 1px solid var(--auth-err-text); }
.queue-btn--del:hover { filter: brightness(1.08); }


/* --- MFA: Authenticator-Einrichtung (TOTP) + Wiederherstellungs-Codes --- */
.mfa-setup {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin: 14px 0 18px;
}
.mfa-qr {
  width: 200px;
  height: 200px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--auth-border, #d8dee6);
  border-radius: 12px;
  box-sizing: content-box;
}
.mfa-qr svg { display: block; width: 100%; height: 100%; }
.mfa-setup-manual { text-align: center; }
.mfa-secret {
  display: inline-block;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 1.05rem;
  letter-spacing: 2px;
  font-weight: 700;
  color: var(--auth-navy);
  background: #f1f4f8;
  padding: 8px 12px;
  border-radius: 8px;
  user-select: all;
  word-break: break-all;
}
.mfa-codes {
  list-style: none;
  margin: 14px 0 18px;
  padding: 14px;
  background: #f1f4f8;
  border: 1px solid var(--auth-border, #d8dee6);
  border-radius: 12px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 18px;
}
.mfa-codes li {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 1.05rem;
  letter-spacing: 1px;
  font-weight: 700;
  color: var(--auth-navy);
  user-select: all;
}
.mfa-reauth, .mfa-cancel { margin-top: 12px; }

@media (min-width: 560px) {
  .mfa-qr { width: 220px; height: 220px; }
}

/* === Adress-Autocomplete (Photon-Proxy, geo-autocomplete.js) auf Auth-Seiten ===
   Vorschlagsliste unter dem Straßenfeld (Registrierung); Werte-Fallbacks, da die
   db-*-Variablen aus dashboard.css hier nicht geladen sind. */
.geo-suggest {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 60;
  margin: 4px 0 0; padding: 4px 0; list-style: none;
  background: #fff; border: 1px solid var(--auth-line, #e3e7ee); border-radius: 10px;
  box-shadow: 0 12px 30px rgba(1, 66, 106, 0.16); max-height: 260px; overflow-y: auto;
}
.geo-suggest[hidden] { display: none; }
.geo-suggest__item { padding: 10px 14px; font-size: 0.92rem; line-height: 1.35; color: var(--auth-text, #1c2733); cursor: pointer; }
.geo-suggest__item:hover, .geo-suggest__item.is-active { background: var(--auth-navy, #01426a); color: #fff; }
