/*
 * benning.css – Anmeldeseite auth.benning.one im Stil „Benning Studio“
 * Für Authelia v4.39.19 (MUI v7, Emotion). Eingebunden per nginx sub_filter (siehe einbau.md).
 *
 * Regeln für diese Datei:
 * - Nur IDs aus dem Authelia-Quelltext (v4.39.19) und feste MUI-Klassen (.MuiButton-root, …).
 *   KEINE gehashten Klassen (.mui-abc123 / .css-abc123) – die ändern sich bei jedem Update.
 * - Alles unter #root (Spezifität ID) schlägt die Emotion-Klassen von MUI; Menüs/Dialoge
 *   hängen als Portal direkt an <body> und werden über „html body …“ erfasst.
 * - Seite fest dunkel (unabhängig von theme in configuration.yml).
 *
 * Farben / Kontrast (WCAG, nachgerechnet):
 *   Text #ecebe6 auf #141413 15,4:1 · auf Karte #1d1d1b 14,1:1
 *   Knopf: Schrift #141413 auf #f97316 6,6:1 (weiß auf #f97316 wäre nur 2,8:1)
 *   Link #f97316 auf #141413 6,6:1 · auf Karte 6,0:1
 *   Grau #9a9890 auf Karte 5,8:1 · Feldrand #6b6963 zu #141413 3,4:1 (≥ 3:1 für Bedienelemente)
 */

:root {
  --bs-grund: #141413;
  --bs-karte: #1d1d1b;
  --bs-rand: #2f2e2b;
  --bs-feldrand: #6b6963;
  --bs-text: #ecebe6;
  --bs-grau: #9a9890;
  --bs-orange: #f97316;
  --bs-orange-hell: #fb923c;
  --bs-fehler: #f87171;
  --bs-schrift: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

/* ---------- Grund ---------- */
html, html body {
  background-color: var(--bs-grund) !important;
}
html body {
  color: var(--bs-text);
  font-family: var(--bs-schrift);
  background-image: radial-gradient(900px 500px at 50% -10%, rgba(249, 115, 22, .16), transparent 60%) !important;
  background-repeat: no-repeat;
  background-attachment: fixed;
  min-height: 100vh;
}
#root, #root .MuiTypography-root, #root .MuiButtonBase-root, #root .MuiInputBase-root,
#root .MuiFormLabel-root, html body .MuiMenuItem-root, html body .MuiAlert-message {
  font-family: var(--bs-schrift);
  letter-spacing: normal;
}
#root .MuiTypography-root { color: inherit; }

/* ---------- Kopfleiste / Sprachauswahl ---------- */
#root .MuiAppBar-root { background: transparent; box-shadow: none; color: var(--bs-grau); }
#root #language-button,
#root .MuiToolbar-root .MuiIconButton-root {
  min-height: 44px;
  min-width: 44px;
  border-radius: 10px;
  color: var(--bs-grau);
}
#root #language-button:hover { background: rgba(249, 115, 22, .10); color: var(--bs-text); }
#root #language-button .MuiTypography-root { font-size: 14px; }
html body .MuiMenu-paper, html body .MuiPopover-paper {
  background: var(--bs-karte);
  color: var(--bs-text);
  border: 1px solid var(--bs-rand);
  border-radius: 12px;
  background-image: none;
}
html body .MuiMenuItem-root { min-height: 44px; font-size: 15px; }
html body .MuiMenuItem-root:hover,
html body .MuiMenuItem-root.Mui-focusVisible { background: rgba(249, 115, 22, .12); }
html body .MuiMenuItem-root.Mui-selected { background: rgba(249, 115, 22, .20); }

/* ---------- Kopf: Logo + Titel ---------- */
#root .MuiContainer-root { padding-left: 16px; padding-right: 16px; }
#root .MuiContainer-maxWidthXs { max-width: 412px; }
/* Logo (eigenes logo.png über asset_path) */
#root .MuiContainer-root img[alt="Logo"] {
  width: 76px !important;
  height: 76px;
  margin: 0 auto 0 !important;
  display: block;
  border-radius: 18px;
  box-shadow: 0 8px 30px rgba(249, 115, 22, .25);
}
/* Ersatz-Symbol, falls kein logo.png gefunden wird */
#root #UserSvg { fill: var(--bs-orange); width: 64px; }

#root .MuiContainer-root .MuiTypography-h5 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.25;
  margin: 16px 0 2px;
  color: var(--bs-text);
}
#root .MuiContainer-root .MuiTypography-h6 { font-size: 17px; font-weight: 600; color: var(--bs-text); }

/* Anmelde-Ansicht: sichtbarer Titel „Benning Studio“ + Unterzeile „Bitte anmelden“.
   Der echte Text „Anmelden“ bleibt im DOM (Screenreader), wird nur optisch ersetzt.
   Grund: Titel und Knopf nutzen in Authelia denselben Übersetzungsschlüssel „Sign in“. */
#root #first-factor-stage .MuiTypography-h5 {
  font-size: 0;
  line-height: 0;
  margin-bottom: 28px;
}
#root #first-factor-stage .MuiTypography-h5::before {
  content: "Benning Studio";
  display: block;
  font-size: 26px;
  line-height: 1.25;
  font-weight: 700;
}
#root #first-factor-stage .MuiTypography-h5::after {
  content: "Bitte anmelden";
  display: block;
  margin-top: 4px;
  font-size: 15px;
  line-height: 1.5;
  font-weight: 400;
  color: var(--bs-grau);
}

/* ---------- Karte ---------- */
#root #form-login,
#root #form-reset-password-username,
#root #form-reset-password,
#root #form-consent-openid-device-code-authorization,
#root #second-factor-stage .MuiBox-root:has(> [id$="-method"]) {
  display: block;
  width: 100%;
  background: var(--bs-karte);
  border: 1px solid var(--bs-rand);
  border-radius: 16px;
  padding: 22px;
  text-align: left;
  box-sizing: border-box;
}
/* Abstände im Raster der Karte ruhiger */
#root #form-login > .MuiGrid-container,
#root #form-reset-password-username > .MuiGrid-container,
#root #form-reset-password > .MuiGrid-container {
  row-gap: 16px;
  --Grid-rowSpacing: 0px;
  margin: 0;
}

/* „Passwort zurücksetzen?“ unter die Karte, rechtsbündig (wie Entwurf) */
#root #form-login { position: relative; margin-bottom: 58px; }
#root #form-login .MuiGrid-root:has(> #reset-password-button) {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  left: 0;
  text-align: right;
  padding: 0;
}

/* ---------- Felder ---------- */
#root .MuiTextField-root .MuiInputLabel-root {
  position: static;
  transform: none;
  max-width: none;
  text-align: left;
  margin: 0 0 6px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--bs-grau);
  pointer-events: auto;
}
#root .MuiTextField-root .MuiInputLabel-root.Mui-focused { color: var(--bs-text); }
#root .MuiTextField-root .MuiInputLabel-root.Mui-error { color: var(--bs-fehler); }
#root .MuiFormLabel-asterisk { display: none; }
#root .MuiOutlinedInput-notchedOutline legend { display: none; }
#root .MuiOutlinedInput-notchedOutline { top: 0; }

#root .MuiOutlinedInput-root {
  min-height: 50px;
  border-radius: 10px;
  background: var(--bs-grund);
  color: var(--bs-text);
  font-size: 16px; /* 16 px verhindert Zoom beim Antippen auf iPhone */
}
#root .MuiOutlinedInput-root .MuiOutlinedInput-notchedOutline {
  border: 1px solid var(--bs-feldrand);
  border-radius: 10px;
}
#root .MuiOutlinedInput-root:hover .MuiOutlinedInput-notchedOutline { border-color: var(--bs-grau); }
#root .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline {
  border: 2px solid var(--bs-orange);
}
#root .MuiOutlinedInput-root.Mui-error .MuiOutlinedInput-notchedOutline { border: 2px solid var(--bs-fehler); }
#root .MuiOutlinedInput-input {
  height: 50px;
  box-sizing: border-box;
  padding: 0 14px;
  color: var(--bs-text);
  caret-color: var(--bs-orange);
}
#root .MuiOutlinedInput-input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 100px var(--bs-grund) inset;
  -webkit-text-fill-color: var(--bs-text);
  caret-color: var(--bs-orange);
  border-radius: 10px;
}
#root .MuiFormHelperText-root { color: var(--bs-grau); margin-left: 0; }
#root .MuiFormHelperText-root.Mui-error { color: var(--bs-fehler); }
/* Auge im Passwortfeld */
#root .MuiInputAdornment-root .MuiIconButton-root { width: 44px; height: 44px; color: var(--bs-grau); }

/* ---------- Kästchen „Angemeldet bleiben“ ---------- */
#root .MuiFormControlLabel-root { min-height: 44px; margin-left: -9px; color: var(--bs-text); }
#root .MuiFormControlLabel-label { font-size: 15px; }
#root .MuiCheckbox-root { color: #8a877f; padding: 10px; }
#root .MuiCheckbox-root.Mui-checked { color: var(--bs-orange); }
#root .MuiCheckbox-root.Mui-focusVisible { outline: 2px solid var(--bs-orange); outline-offset: -4px; border-radius: 8px; }

/* ---------- Knöpfe ---------- */
#root .MuiButton-root {
  min-height: 52px;
  border-radius: 12px;
  font-family: var(--bs-schrift);
  font-size: 17px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: normal;
  box-shadow: none;
}
#root .MuiButton-contained,
#root .MuiButton-containedPrimary {
  background: var(--bs-orange);
  color: #141413;
}
#root .MuiButton-contained:hover { background: var(--bs-orange-hell); box-shadow: none; }
#root .MuiButton-root.Mui-focusVisible { outline: 2px solid var(--bs-text); outline-offset: 2px; }
#root .MuiButton-contained.Mui-disabled {
  background: #3a3935;
  color: var(--bs-grau);
}
/* Zweiter Knopf (z. B. „Abbrechen“ beim Zurücksetzen) ruhiger */
#root #cancel-button,
#root .MuiButton-containedSecondary,
#root .MuiButton-outlined {
  background: transparent;
  color: var(--bs-text);
  border: 1px solid var(--bs-feldrand);
}
#root #cancel-button:hover,
#root .MuiButton-outlined:hover { background: rgba(236, 235, 230, .06); }
#root .MuiButton-text,
#root .MuiButton-textSecondary {
  color: var(--bs-orange);
  min-height: 44px;
  font-size: 15px;
  font-weight: 600;
}
#root .MuiButton-text:hover { background: rgba(249, 115, 22, .10); }

/* ---------- Links ---------- */
#root .MuiLink-root,
#root a {
  color: var(--bs-orange);
  text-decoration: none;
}
#root .MuiLink-button {
  min-height: 44px;
  padding: 0 2px;
  font-size: 14px;
  font-family: var(--bs-schrift);
  display: inline-flex;
  align-items: center;
}
#root .MuiLink-root:hover { text-decoration: underline; }
#root .MuiLink-root:focus-visible { outline: 2px solid var(--bs-orange); outline-offset: 2px; border-radius: 4px; }

/* Fußzeile (Brand): „Betrieben mit Authelia“ und ggf. „Datenschutzerklärung“ dezent */
#root .MuiContainer-root > .MuiGrid-container > .MuiGrid-container:last-child {
  margin-top: 4px;
  column-gap: 12px;
  flex-wrap: nowrap;
}
#root .MuiContainer-root > .MuiGrid-container > .MuiGrid-container:last-child > .MuiGrid-root {
  flex: 0 0 auto;
  width: auto;
  max-width: none;
  white-space: nowrap;
}
#root .MuiContainer-root > .MuiGrid-container > .MuiGrid-container:last-child .MuiLink-root {
  color: var(--bs-grau);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
#root .MuiContainer-root > .MuiGrid-container > .MuiGrid-container:last-child .MuiDivider-root {
  border-color: var(--bs-rand);
}

/* ---------- Zweiter Faktor (TOTP) ---------- */
#root #otp-input input {
  width: 44px !important;
  height: 52px;
  box-sizing: border-box;
  padding: 0 !important;
  font-size: 22px;
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--bs-grund);
  color: var(--bs-text);
  border-radius: 10px;
  /* Rahmen per Schatten, damit der rote Fehler-Rahmen von Authelia sichtbar bleibt */
  box-shadow: inset 0 0 0 1px var(--bs-feldrand);
  margin-left: 3px;
  margin-right: 3px;
}
#root #otp-input input:focus { outline: 2px solid var(--bs-orange); outline-offset: 1px; }
/* ID beginnt mit Ziffer → nur als Attribut-Selektor gültig */
#root [id="2fa-container"] { height: auto !important; min-height: 200px; }
#root #second-factor-stage .MuiTypography-h6 { margin-bottom: 8px; }
/* Karte des zweiten Faktors: Authelia setzt sie mit hellem Rahmen #d6d6d6 und min-width 300px */
#root #second-factor-stage .MuiBox-root:has(> [id$="-method"]) { min-width: 0; margin: 16px 0; text-align: center; }
#root #second-factor-stage .MuiTypography-body1 { color: var(--bs-grau); }
#root #methods-button, #root #selection-link, #root #register-link { color: var(--bs-orange); }
#root #second-factor-stage .MuiCircularProgress-root,
#root .MuiCircularProgress-root { color: var(--bs-orange); }

/* ---------- Benachrichtigungen (Snackbar) ---------- */
html body .MuiSnackbar-root .MuiAlert-root,
#root .MuiAlert-root.notification {
  border-radius: 12px;
  font-size: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
}
html body .MuiAlert-filledError   { background: #b91c1c; color: #fff; }   /* 6,5:1 */
html body .MuiAlert-filledSuccess { background: #15803d; color: #fff; }   /* 5,0:1 */
html body .MuiAlert-filledWarning { background: #f97316; color: #141413; }
html body .MuiAlert-filledInfo    { background: #2f2e2b; color: var(--bs-text); }
html body .MuiAlert-standardError { background: rgba(248, 113, 113, .12); color: #fecaca; }
html body .MuiAlert-standardWarning { background: rgba(249, 115, 22, .12); color: #fed7aa; }

/* ---------- Dialoge (Auswahl zweiter Faktor, Zustimmung) ---------- */
html body .MuiDialog-paper {
  background: var(--bs-karte);
  color: var(--bs-text);
  border: 1px solid var(--bs-rand);
  border-radius: 16px;
  background-image: none;
}
html body .MuiDialog-paper .MuiButton-root { min-height: 44px; text-transform: none; color: var(--bs-orange); }
html body .MuiBackdrop-root:not(.MuiBackdrop-invisible) { background: rgba(0, 0, 0, .6); }

/* ---------- Zustimmung (OpenID) und Listen ---------- */
#root .MuiList-root .MuiListItem-root { color: var(--bs-text); }
#root .MuiListItemIcon-root, #root .MuiSvgIcon-root { color: inherit; }
#root #openid-consent-accept { background: var(--bs-orange); color: #141413; }
#root #openid-consent-deny { background: transparent; color: var(--bs-text); border: 1px solid var(--bs-feldrand); }

/* ---------- Schmale Bildschirme ---------- */
@media (max-width: 420px) {
  #root #form-login,
  #root #form-reset-password-username,
  #root #form-reset-password,
  #root #second-factor-stage .MuiBox-root:has(> [id$="-method"]) { padding: 18px; }
  #root #otp-input input { width: 40px !important; margin-left: 2px; margin-right: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  #root *, html body .MuiSnackbar-root * { transition: none !important; animation: none !important; }
}
