/* ============================================================================
   Brütsch Technology — Keycloak Login Theme
   Design System: Brütsch Technology Design System (Styleguide 2025)
   Theme type: login · Parent: keycloak · Target: Keycloak 26.5.7

   Loaded last in theme.properties, so every rule here wins over the parent.
   Tokens below are the subset of brand.css the login flow needs — keep the
   values in sync with the design system, do not invent new ones.
   ========================================================================== */

/* Neue Frutiger World — selbst gehostet.
   Die @import-Zeilen auf use.typekit.net und fonts.googleapis.com sind
   entfernt: auf einer Anmeldeseite ist jeder externe Abruf ein
   CSP-Eintrag, eine Datenschutzfrage und ein Ladezeit-Posten.

   ACHTUNG LIZENZ: Die Dateien liegen NICHT im Repository und duerfen
   nicht aus dem Adobe-Fonts-Projekt qhi0jrm herausgezogen werden -
   Adobe Fonts erlaubt kein Self-Hosting. Die drei Schnitte brauchen
   eine eigene Webfont-Lizenz von Monotype. Erst dann die Dateien unter
   resources/fonts/ ablegen; siehe resources/fonts/README.md.

   Solange sie fehlen, greift die Ersatzkette in --font-ui. Die Seite
   bleibt vollstaendig benutzbar, sieht aber nicht nach Marke aus. */
@font-face {
  font-family: "Neue Frutiger World";
  src: url("../fonts/neue-frutiger-world-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Neue Frutiger World";
  src: url("../fonts/neue-frutiger-world-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Neue Frutiger World";
  src: url("../fonts/neue-frutiger-world-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Primärsystem */
  --klarblau: #006eb6;
  --admiralsblau: #375172;
  --white: #ffffff;
  --blue-100: #d9ecf8;
  --blue-400: #76c7ee;

  /* Sekundärsystem — nur Funktion (Fehler/Erfolg) */
  --sec-red: #eb5b57;
  --sec-red-20: #fbdedd;
  --sec-green: #5bb37c;
  --sec-green-20: #def1e5;
  --sec-yellow: #fecb22;
  --sec-yellow-20: #fff5d3;

  /* Neutrale, zu Admiralsblau getönt */
  --grey-900: #1b2733;
  --grey-700: #3d4b5a;
  --grey-500: #5d6b7a;
  --grey-300: #98a3ae;
  --grey-200: #e1e5ea;
  --grey-100: #f1f3f6;

  /* Bereits im Referenz-Artefakt verwendete Farbwerte. Sämtliche
     Komponenten lesen Farben ausschliesslich aus diesem Tokenblock. */
  --stage-dark: #1a2a3a;
  --stage-mid: #2b3d50;
  --stage-light: #35485d;
  --brand-active: #2c4260;
  --error-text: #8e2b28;
  --success-text: #2f6b47;
  --warning-text: #6b5300;
  --info-text: #0b4f7d;
  --white-82: rgba(255, 255, 255, 0.82);
  --white-72: rgba(255, 255, 255, 0.72);
  --white-35: rgba(255, 255, 255, 0.35);
  --white-30: rgba(255, 255, 255, 0.30);
  --white-22: rgba(255, 255, 255, 0.22);
  --white-16: rgba(255, 255, 255, 0.16);
  --white-10: rgba(255, 255, 255, 0.10);
  --error-border: rgba(235, 91, 87, 0.35);
  --success-border: rgba(91, 179, 124, 0.35);
  --warning-border: rgba(254, 203, 34, 0.45);
  --info-border: rgba(0, 110, 182, 0.25);

  --brand: var(--klarblau);
  --brand-hover: var(--admiralsblau);
  --heading-strong: var(--admiralsblau);
  --text-body: var(--grey-700);
  --text-muted: var(--grey-500);

  --font-ui: "Neue Frutiger World", "Frutiger", "Open Sans",
             "Segoe UI", "Helvetica Neue", Arial, sans-serif;

  /* Nur drei Schnitte - die Familie hat kein Semibold und kein Light.
     300 und 600 standen hier, waren unbenutzt und haetten synthetische
     Schnitte erzeugt, sobald jemand sie benutzt. */
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-heavy: 700;

  --fs-title: clamp(26px, 3vw, 30px);
  --fs-lead: 15.5px;
  --fs-body: 15px;
  --fs-small: 14px;
  --fs-meta: 12px;
  --lh-body: 1.55;
  --tracking-caps: 0.04em;

  --radius-sm: 6px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  --shadow-card: 0 1px 3px rgba(20, 30, 40, 0.08), 0 8px 24px rgba(20, 30, 40, 0.06);
  --shadow-raised: 0 2px 6px rgba(20, 30, 40, 0.10), 0 18px 40px rgba(20, 30, 40, 0.12);

  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast: 140ms;
  --dur-base: 220ms;

  /* Bühne: ruhige blaugraue Fläche, kein Foto, kein Muster */
  --stage-bg: linear-gradient(90deg, var(--stage-dark) 0%, var(--stage-mid) 55%, var(--stage-light) 100%);
  --gradient-brand: linear-gradient(135deg, var(--klarblau) 0%, var(--admiralsblau) 100%);

  --card-w: 456px;
}

/* ---------------------------------------------------------------- Reset ---- */

html { box-sizing: border-box; }
*, *::before, *::after { box-sizing: inherit; }

body.bt-login,
body[class*="login-pf"] {
  margin: 0;
  min-height: 100vh;
  background: var(--stage-bg);
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text-body);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; transition: color var(--dur-fast) var(--ease-standard); }
a:hover, a:focus-visible { color: var(--brand-hover); text-decoration: underline; }

a:focus-visible,
button:focus-visible,
input[type="submit"]:focus-visible,
input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--blue-100);
}

/* -------------------------------------------------------------- Bühne ------ */

.bt-page { position: relative; min-height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

/* Bewusst kein Hintergrundfoto und kein Muster: eine ruhige Fläche.
   Kein Bild-Request auf der Login-Seite, kein Kontrastrisiko hinter der Karte. */
.bt-page__media { position: absolute; inset: 0; background: var(--stage-bg); }

/* Kreis-Muster (Styleguide S. 23) — im Login-Theme abgeschaltet (btPattern=false).
   Nur reaktivieren, wenn es ausdrücklich gewünscht ist; nie hinter Text. */
.bt-page__pattern {
  position: absolute; right: -80px; bottom: -120px; width: 520px; height: 520px;
  background:
    radial-gradient(circle at 50% 50%, transparent 0 13px, var(--white-30) 13px 14px, transparent 14px),
    radial-gradient(circle at 50% 50%, var(--white-22) 0 4px, transparent 4px);
  background-size: 56px 56px;
  pointer-events: none;
}

/* ------------------------------------------------------------- Kopfzeile --- */

.bt-topbar {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 22px clamp(20px, 3vw, 32px);
}
.bt-topbar__logo { display: block; height: 32px; width: auto; }
.bt-topbar > a { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; }

.bt-locale { display: flex; align-items: center; gap: 2px; }
.bt-locale__link {
  font-size: var(--fs-meta); font-weight: var(--fw-medium); letter-spacing: var(--tracking-caps);
  text-transform: uppercase; color: var(--white-72);
  padding: 8px 10px; border-radius: var(--radius-sm); min-height: 44px;
  display: inline-flex; align-items: center;
}
.bt-locale__link:hover { color: var(--white); background: var(--white-10); text-decoration: none; }
.bt-locale__link[aria-current="true"] { color: var(--white); background: var(--white-16); }
.bt-locale__sep { color: var(--white-35); font-size: var(--fs-meta); }

/* ----------------------------------------------------------------- Karte --- */

.bt-stage {
  position: relative; z-index: 2; flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px; padding: 24px clamp(20px, 3vw, 32px) 36px;
}

.bt-card {
  width: 100%; max-width: var(--card-w);
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-raised);
  padding: clamp(28px, 3vw, 40px);
}
.bt-screen--wide .bt-card { max-width: 520px; }
.bt-card__logo { display: none; height: 28px; width: auto; margin-bottom: 24px; }
.bt-card__eyebrow {
  margin: 0 0 10px; font-size: var(--fs-meta); font-weight: var(--fw-medium);
  letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--brand);
}
.bt-card__title {
  margin: 0; font-size: var(--fs-title); font-weight: var(--fw-heavy);
  line-height: 1.15; color: var(--heading-strong); letter-spacing: -0.01em;
}
.bt-card__lead {
  margin: 12px 0 0; font-size: var(--fs-lead); color: var(--text-muted);
  max-width: 40ch; text-wrap: pretty;
}
.bt-card__body { margin-top: 26px; }

.bt-card__footer {
  margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--grey-200);
  font-size: var(--fs-small); color: var(--text-muted);
}

.bt-legal {
  /* align-items MUSS center sein: die Links sind 44px hohe Klickflaechen mit
     mittigem Text, das Copyright-span hat keine Mindesthoehe. Ohne center
     zieht der Standardwert stretch das span auf 44px und sein Text klebt
     oben - die Zeile sieht dann zweizeilig aus, obwohl sie es nicht ist. */
  margin: 0; display: flex; flex-wrap: wrap; align-items: center;
  gap: 6px 18px; justify-content: center;
  font-size: var(--fs-meta); color: var(--white-72);
}
.bt-legal a { color: var(--white-82); min-height: 44px; display: inline-flex; align-items: center; }
.bt-legal a:hover { color: var(--white); }

/* --------------------------------------------------------------- Formular -- */

#kc-form, #kc-form-wrapper, #kc-form-login, form { margin: 0; }
.bt-form { width: 100%; }

.bt-field + .bt-field, .bt-field + .bt-actions, form > * + * { margin-top: 18px; }

.bt-field__row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.bt-field__row a { display: inline-flex; align-items: center; min-height: 44px; }

label,
.bt-field label,
.pf-v5-c-form__label-text,
.pf-c-form__label-text {
  display: block; font-family: var(--font-ui); font-weight: var(--fw-medium);
  font-size: var(--fs-small); color: var(--heading-strong);
}

input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="number"],
.pf-v5-c-form-control, .pf-c-form-control, .form-control, select, textarea {
  width: 100%; box-sizing: border-box;
  font-family: var(--font-ui); font-size: var(--fs-body); line-height: var(--lh-body);
  color: var(--text-body); background: var(--white);
  border: 1px solid var(--grey-200); border-radius: var(--radius-sm);
  padding: 12px 14px; min-height: 46px; outline: none;
  transition: border-color var(--dur-base) var(--ease-standard), box-shadow var(--dur-base) var(--ease-standard);
}
input::placeholder { color: var(--grey-300); }

input:focus, select:focus, textarea:focus,
.pf-v5-c-form-control:focus-within, .pf-c-form-control:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--blue-100);   /* Fokus ist immer Klarblau + 3px Blue-100 */
}

input[aria-invalid="true"], .bt-field--error input, .pf-v5-c-form-control.pf-m-error, .pf-c-form-control.pf-m-error {
  border-color: var(--sec-red);
}
.bt-field__error {
  margin-top: 8px; font-size: var(--fs-meta); color: var(--sec-red);
  display: flex; align-items: flex-start; gap: 6px;
}
.bt-field__hint { margin-top: 8px; font-size: var(--fs-meta); color: var(--text-muted); }

/* Passwort-Feld mit Sichtbarkeits-Toggle (Parent-Markup: .pf-v5-c-input-group) */
.bt-password { position: relative; display: flex; }
.bt-password input { padding-right: 52px; }
.bt-password__toggle {
  position: absolute; right: 1px; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; display: grid; place-items: center;
  background: none; border: 0; border-radius: var(--radius-pill); cursor: pointer; color: var(--grey-500);
}
.bt-password__toggle:hover { color: var(--brand); background: var(--grey-100); }

/* Checkbox / Terms */
.bt-check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: var(--fs-small); color: var(--text-body); }
.bt-check input[type="checkbox"] {
  width: 18px; height: 18px; min-height: 0; margin: 2px 0 0; flex: none;
  accent-color: var(--brand); border-radius: 3px;
}

.bt-check__input {
  width: 18px; height: 18px; min-height: 0; margin: 2px 0 0; flex: none;
  accent-color: var(--brand); border-radius: 3px;
}
.bt-check__label { font-size: var(--fs-small); color: var(--text-body); line-height: 1.45; }
.bt-choice { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.bt-choice--disabled { opacity: 0.6; }

/* --------------------------------------------------------------- Buttons --- */

.bt-btn, input[type="submit"], button[type="submit"],
.pf-v5-c-button.pf-m-primary, .pf-c-button.pf-m-primary, .btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: auto; min-height: 46px; padding: 13px 28px;
  font-family: var(--font-ui); font-size: var(--fs-small); font-weight: var(--fw-medium);
  color: var(--white); background: var(--brand);
  border: 1px solid transparent; border-radius: var(--radius-pill);
  cursor: pointer; text-decoration: none;
  transition: background-color var(--dur-fast) var(--ease-standard), box-shadow var(--dur-fast) var(--ease-standard);
}
.bt-btn:hover, input[type="submit"]:hover, button[type="submit"]:hover,
.pf-v5-c-button.pf-m-primary:hover, .pf-c-button.pf-m-primary:hover { background: var(--brand-hover); color: var(--white); text-decoration: none; }
.bt-btn:active, input[type="submit"]:active { background: var(--brand-active); }

.bt-btn--block, .bt-actions input[type="submit"], .bt-actions .bt-btn { width: 100%; }

.bt-btn--ghost, .pf-v5-c-button.pf-m-secondary, .pf-c-button.pf-m-secondary, .btn-default {
  background: var(--white); color: var(--brand); border-color: var(--grey-200);
}
.bt-btn--ghost:hover, .pf-v5-c-button.pf-m-secondary:hover, .pf-c-button.pf-m-secondary:hover {
  background: var(--grey-100); color: var(--brand-hover); border-color: var(--grey-300);
}

.bt-btn--link {
  background: none; border: 0; padding: 12px 4px; color: var(--brand);
  border-radius: var(--radius-pill); font-weight: var(--fw-medium);
}
.bt-btn--link:hover { background: none; color: var(--brand-hover); text-decoration: underline; }

.bt-actions { display: flex; flex-direction: column; gap: 12px; margin-top: 26px; }
.bt-actions--row { flex-direction: row-reverse; align-items: center; }
.bt-actions--row .bt-btn { width: auto; }

/* ------------------------------------------------------ Meldungen / Alerts - */

.bt-alert, #kc-content .alert, .pf-v5-c-alert, .pf-c-alert {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 22px 0 0; padding: 12px 14px;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: var(--fs-small); line-height: 1.45;
}
.bt-alert__icon { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.bt-alert__title { min-width: 0; }
.bt-alert--error, .alert-error, .pf-v5-c-alert.pf-m-danger, .pf-c-alert.pf-m-danger {
  background: var(--sec-red-20); border-color: var(--error-border); color: var(--error-text);
}
.bt-alert--success, .alert-success, .pf-v5-c-alert.pf-m-success, .pf-c-alert.pf-m-success {
  background: var(--sec-green-20); border-color: var(--success-border); color: var(--success-text);
}
.bt-alert--warning, .alert-warning, .pf-v5-c-alert.pf-m-warning, .pf-c-alert.pf-m-warning {
  background: var(--sec-yellow-20); border-color: var(--warning-border); color: var(--warning-text);
}
.bt-alert--info, .alert-info, .pf-v5-c-alert.pf-m-info, .pf-c-alert.pf-m-info {
  background: var(--blue-100); border-color: var(--info-border); color: var(--info-text);
}

/* ---------------------------------------------------- Identity Provider ---- */

.bt-divider { display: flex; align-items: center; gap: 14px; margin: 26px 0 20px; }
.bt-divider::before, .bt-divider::after { content: ""; height: 1px; flex: 1; background: var(--grey-200); }
.bt-divider span {
  font-size: var(--fs-meta); letter-spacing: var(--tracking-caps);
  text-transform: uppercase; color: var(--text-muted);
}

#kc-social-providers ul, .bt-idp-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
#kc-social-providers li a, .bt-idp {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 46px; padding: 12px 20px;
  background: var(--white); color: var(--heading-strong);
  border: 1px solid var(--grey-200); border-radius: var(--radius-pill);
  font-size: var(--fs-small); font-weight: var(--fw-medium);
}
#kc-social-providers li a:hover, .bt-idp:hover {
  background: var(--grey-100); border-color: var(--grey-300); color: var(--brand-hover); text-decoration: none;
}
.bt-idp--disabled, .bt-idp[aria-disabled="true"] { opacity: 0.6; pointer-events: none; }

/* --------------------------------------------------------------- TOTP / QR - */

.bt-totp { display: grid; gap: 20px; }
.bt-totp__qr {
  display: grid; place-items: center; padding: 18px;
  background: var(--white); border: 1px solid var(--grey-200); border-radius: var(--radius-sm);
}
.bt-totp__qr img { display: block; width: 168px; height: 168px; image-rendering: pixelated; }
.bt-totp__steps { margin: 0; padding-left: 20px; font-size: var(--fs-small); color: var(--text-body); }
.bt-totp__steps li + li { margin-top: 8px; }
.bt-secret {
  font-family: var(--font-ui); font-size: var(--fs-small); letter-spacing: 0.08em;
  background: var(--grey-100); border: 1px solid var(--grey-200); border-radius: var(--radius-sm);
  padding: 10px 12px; word-break: break-all; color: var(--heading-strong);
}

/* OTP-Ziffernfeld */
.bt-otp input {
  font-size: 22px; letter-spacing: 0.32em; text-align: center; font-weight: var(--fw-medium);
  padding: 14px; color: var(--heading-strong);
}

/* --------------------------------------------------------- Statusmeldung --- */

.bt-status { display: grid; gap: 18px; justify-items: start; }
.bt-status__mark {
  width: 52px; height: 52px; border-radius: var(--radius-pill);
  display: grid; place-items: center; background: var(--blue-100); color: var(--brand);
}
.bt-status__mark--error { background: var(--sec-red-20); color: var(--sec-red); }
.bt-status__mark--success { background: var(--sec-green-20); color: var(--success-text); }

/* -------------------------------------------------------- Passwort-Regeln -- */

.bt-rules { list-style: none; margin: 12px 0 0; padding: 0; font-size: var(--fs-meta); color: var(--text-muted); }
.bt-rules li { display: flex; align-items: center; gap: 8px; }
.bt-rules li + li { margin-top: 6px; }
.bt-rules li::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--grey-300); flex: none;
}
.bt-rules li[data-met="true"]::before { background: var(--sec-green); }

/* ------------------------------------------------------------- Responsive -- */

@media (max-width: 600px) {
  .bt-page__pattern { display: none; }
  .bt-topbar { padding: 16px 20px; }
  .bt-topbar__logo { height: 28px; }
  .bt-card { border-radius: var(--radius-lg); padding: 24px 20px; box-shadow: var(--shadow-card); }
  .bt-stage { justify-content: flex-start; padding-top: 8px; }
}

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

/* Elemente des Parent-Themes, die das Layout doppeln würden */
#kc-header, #kc-header-wrapper, .login-pf-page-header, #kc-page-title ~ #kc-header { display: none; }
.login-pf-page { padding: 0; }

/* ------------------------------------------------ Nachtrag Screens 03-11 --- */

/* Statusmarke direkt in der Karte (Screens 07, 10, 11) */
.bt-card > .bt-status__mark { margin: 0 0 20px; }

/* Nutzungsbedingungen: langer Text bleibt in der Karte scrollbar,
   damit die Aktionen ohne Seitenscroll erreichbar sind. */
.bt-terms {
  max-height: 210px; overflow-y: auto;
  margin: 22px 0 0; padding: 16px 18px;
  background: var(--grey-100); border: 1px solid var(--grey-200);
  border-radius: var(--radius-sm);
  font-size: var(--fs-small); line-height: 1.55; color: var(--text-body);
}
#kc-registration-terms-text {
  max-height: 210px; overflow-y: auto;
  margin: 12px 0; padding: 16px 18px;
  background: var(--grey-100); border: 1px solid var(--grey-200);
  border-radius: var(--radius-sm);
  font-size: var(--fs-small); line-height: 1.55; color: var(--text-body);
}
.bt-terms p { margin: 0; }
.bt-terms p + p { margin-top: 12px; }
.bt-terms:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--blue-100); }

/* TOTP-Einrichtung zweispaltig (Screen 05), fällt unter 200px je Spalte
   von selbst auf eine Spalte zurück. */
.bt-totp--split { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); align-items: start; }
.bt-totp__steps ul { margin: 8px 0 0; padding-left: 18px; color: var(--text-muted); }

/* Fussbereich auch als <p> (logout-confirm) */
p.bt-card__footer { margin-bottom: 0; }
.bt-card__footer a { display: inline-flex; align-items: center; min-height: 44px; }

/* Benutzername in mehrstufigen Login-Flows (z. B. login-password.ftl). */
.bt-user {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 14px; min-height: 46px;
  background: var(--grey-100); border-radius: var(--radius-sm);
  color: var(--heading-strong); font-weight: var(--fw-medium);
}
.bt-user__reset { display: inline-flex; align-items: center; min-height: 44px; font-size: var(--fs-small); }

/* Gesperrter Knopf (Zustimmung noch nicht gesetzt) */
.bt-btn:disabled, input[type="submit"]:disabled {
  background: var(--grey-300); border-color: transparent; cursor: not-allowed;
}
.bt-btn:disabled:hover, input[type="submit"]:disabled:hover { background: var(--grey-300); }
