/*
 * ela-login.css — Aussehen der Keycloak-Anmeldung (Theme „ela“).
 *
 * Aufbau: Taskom-Bild ganzflächig, Marke (Zeichen + ELA) über der Karte,
 * Sprache als Umschalter darunter. Die Karte wie `ui/card` (weiß, 1 px --li, Radius 10). Maße der App: Text 13 px,
 * Titel 20/600, Felder und Knöpfe 36 px mit Radius 6, Fokus als 2-px-Kontur
 * mit Abstand 2. Werte aus frontend/src/index.css, Geist aus frontend/src/fonts. Keycloak liefert das
 * Frontend-CSS nicht aus, deshalb stehen die Werte hier noch einmal; bei einer
 * Änderung im Frontend hier nachziehen.
 *
 * Kein Aufruf nach außen (Schrift, Bild und Symbole liegen im Theme).
 */

@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(../fonts/geist-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(../fonts/geist-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --tx: #191F39;
  --tx-titel: #12172B;
  --tx-meta: #6B7290;
  --tx-zart: #9AA0B8;
  --nav: #191F39;
  --fl-grund: #EEF1F6;
  --fl: #FFFFFF;
  --fl-zart: #F4F7FC;
  --li: #DDE1E9;
  --li-stark: #D3D9E4;
  --akt: #191F39;
  --akt-hov: #0E1226;
  --akt-fg: #FFFFFF;
  --fokus: #6B7290;
  --err: #B03A2B; --err-fl: #FAE5E1; --err-li: #D8A69B;
  --ok: #17795A;  --ok-fl: #DDF0E6;  --ok-li: #BFE0CF;
  --warn: #8A3F13; --warn-fl: #FBE7D6; --warn-li: #F2D6BE;
  --info: #1F5FA8; --info-fl: #EAF3FF; --info-li: #B9D4FF;
  --radius-card: 10px;
  --radius: 6px;
  --radius-sm: 4px;
}

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

html.ela { height: 100%; }

.ela-body {
  margin: 0;
  min-height: 100%;
  font-family: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 13px;
  line-height: 19px;
  color: var(--tx);
  background: var(--nav);
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------- Bild */

.ela-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--nav);
}
.ela-backdrop-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 40%;
  display: block;
}
/* In Navy getönt: Marke und Sprache bleiben auf jedem Bildteil lesbar, das
   Bild tritt hinter die Karte zurück, die Stadt bleibt erkennbar. */
.ela-backdrop::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(25, 31, 57, 0.6) 0%, rgba(25, 31, 57, 0.3) 45%, rgba(25, 31, 57, 0.65) 100%);
}

/* ---------------------------------------------------------------- Seite */

.ela-page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 48px 16px;
}

/* Marke über der Karte: Taskom-Zeichen, Trennstrich, Produktname. */
.ela-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #FFFFFF;
}
.ela-brand-logo {
  height: 36px;
  width: auto;
  display: block;
}
.ela-brand-divider {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.4);
}
.ela-brand-name {
  font-size: 18px;
  line-height: 24px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

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

.ela-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 380px;
  background: var(--fl);
  border: 1px solid var(--li);
  border-radius: var(--radius-card);
  padding: 24px;
  /* In der App liegen Karten schattenlos auf dem Seitengrund. Auf dem Bild
     braucht die Karte eine leise Abhebung, mehr nicht. */
  box-shadow: 0 1px 2px rgba(14, 18, 38, 0.06), 0 12px 32px -12px rgba(14, 18, 38, 0.4);
}

.ela-card-header { margin-bottom: 20px; }

#kc-page-title {
  margin: 0;
  font-size: 20px;
  line-height: 26px;
  font-weight: 600;
  color: var(--tx-titel);
  text-wrap: balance;
}
.ela-subtitle,
.ela-required-note {
  margin: 4px 0 0;
  color: var(--tx-meta);
  text-wrap: pretty;
}
.ela-required-note .required,
.ela-label .required { color: var(--err); }

/* Nach dem ersten Schritt steht oben der Benutzer, mit „neu beginnen“. */
.ela-username {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 4px 0 12px;
  border: 1px solid var(--li);
  border-radius: var(--radius);
  background: var(--fl-zart);
  font-weight: 500;
}
#kc-attempted-username {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ela-username-reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: var(--tx-meta);
}
.ela-username-reset:hover { background: var(--fl); color: var(--tx); }

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

.ela-form,
#kc-form-wrapper > form,
#kc-content-wrapper > form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ela-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
}
/* Formulare aus `base` stapeln Gruppen ohne eigenes Formular-Gap. */
#kc-content-wrapper form > .ela-field + .ela-field { margin-top: 0; }

.ela-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.ela-label,
.ela-label-wrap label {
  font-size: 13px;
  line-height: 18px;
  font-weight: 500;
}
.ela-input-wrap { display: flex; flex-direction: column; gap: 6px; }

.ela-input {
  width: 100%;
  height: 36px;
  padding: 4px 12px;
  font: inherit;
  color: var(--tx);
  background: var(--fl);
  border: 1px solid var(--li-stark);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(14, 18, 38, 0.05);
  outline: none;
  transition: border-color 120ms, background-color 120ms;
}
.ela-textarea { height: auto; min-height: 80px; padding-top: 8px; }
select.ela-input { appearance: auto; }
.ela-input::placeholder { color: var(--tx-zart); }
.ela-input:focus-visible {
  border-color: var(--fokus);
  outline: 2px solid var(--fokus);
  outline-offset: 2px;
}
.ela-input[aria-invalid='true'] {
  border-color: var(--err);
}
.ela-input[aria-invalid='true']:focus-visible { outline-color: var(--err); }
.ela-input:disabled,
.ela-input[readonly] { background: var(--fl-zart); color: var(--tx-meta); }

.ela-input-group { position: relative; display: flex; }
.ela-input-group .ela-input { padding-right: 40px; }

.ela-reveal {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--tx-meta);
  cursor: pointer;
}
.ela-reveal:hover { color: var(--tx); background: var(--fl-zart); }
.ela-reveal:focus-visible { outline: 2px solid var(--fokus); outline-offset: 1px; }

.ela-field-error {
  color: var(--err);
  font-size: 12px;
  line-height: 16px;
}
.ela-help { color: var(--tx-meta); font-size: 12px; line-height: 16px; }

.ela-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-direction: row;
}
.ela-check-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--tx);
}
.ela-check {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--akt);
}
.ela-check-label-disabled { color: var(--tx-zart); }

/* Formular-Optionen aus `base` (z. B. „Zurück zur Anmeldung“). */
#kc-form-options a,
.ela-options-right a,
.ela-link-row a,
#kc-info a,
.ela-card p a,
.ela-card .instruction a {
  color: var(--tx);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--li-stark);
}
#kc-form-options a:hover,
.ela-options-right a:hover,
.ela-link-row a:hover,
#kc-info a:hover,
.ela-card p a:hover { text-decoration-color: currentColor; }

.ela-link-muted {
  color: var(--tx-meta);
  font-size: 12px;
  line-height: 18px;
  font-weight: 500;
  text-decoration: none;
}
.ela-link-muted:hover { color: var(--tx); text-decoration: underline; text-underline-offset: 3px; }

.ela-link-row { margin-top: 16px; text-align: center; }

.ela-actions,
.ela-actions-inner {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#kc-form-buttons { margin-top: 8px; }

/* ---------------------------------------------------------------- Knöpfe */

.ela-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 8px 16px;
  font: inherit;
  font-weight: 500;
  line-height: 19px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 120ms, border-color 120ms, color 120ms, transform 100ms cubic-bezier(0.23, 1, 0.32, 1);
  -webkit-appearance: none;
  appearance: none;
}
.ela-button:focus-visible { outline: 2px solid var(--fokus); outline-offset: 2px; }
.ela-button:disabled,
.ela-button-disabled { opacity: 0.55; pointer-events: none; }

.ela-button-primary {
  background: var(--akt);
  color: var(--akt-fg);
}
.ela-button-primary:hover { background: var(--akt-hov); }
.ela-button:active { transform: scale(0.98); }

.ela-button-outline {
  background: var(--fl);
  color: var(--tx);
  border-color: var(--li-stark);
  box-shadow: 0 1px 2px rgba(14, 18, 38, 0.05);
}
.ela-button-outline:hover { background: var(--fl-zart); }

.ela-button-block { width: 100%; }

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

.ela-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 16px;
  border: 1px solid var(--li);
  border-radius: var(--radius);
  background: var(--fl-zart);
}
.ela-alert .ela-icon { flex: none; margin-top: 2px; }
.ela-alert-text { flex: 1; }
.ela-alert-error   { background: var(--err-fl);  border-color: var(--err-li);  color: var(--err); }
.ela-alert-warning { background: var(--warn-fl); border-color: var(--warn-li); color: var(--warn); }
.ela-alert-success { background: var(--ok-fl);   border-color: var(--ok-li);   color: var(--ok); }
.ela-alert-info    { background: var(--info-fl); border-color: var(--info-li); color: var(--info); }

/* Seiten wie „Info“ oder „Fehler“ geben Text als <p> aus. */
#kc-content-wrapper > p,
#kc-content-wrapper .instruction,
#kc-info-message p {
  margin: 0 0 16px;
  color: var(--tx-meta);
}
#kc-info-message p:last-child { margin-bottom: 0; }

/* ---------------------------------------------------------------- Andere Dienste */

.ela-social { margin-top: 20px; }
.ela-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--tx-meta);
  font-size: 11px;
  line-height: 16px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.ela-divider::before,
.ela-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--li);
}
.ela-social-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}
.ela-idp-icon { font-size: 16px; }

.ela-info {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--li);
  text-align: center;
  color: var(--tx-meta);
}

/* ---------------------------------------------------------------- Auswahl (Anmeldeart, Einmalcode) */

.ela-choice-list { display: flex; flex-direction: column; gap: 8px; }
.ela-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--li-stark);
  border-radius: var(--radius);
  background: var(--fl);
  color: var(--tx);
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.ela-choice:hover { background: var(--fl-zart); }
.ela-choice-body { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.ela-choice-title { font-weight: 500; }
.ela-choice-text { color: var(--tx-meta); }
.ela-choice-icon { color: var(--tx-meta); }
.ela-otp-input { position: absolute; opacity: 0; pointer-events: none; }
.ela-otp-input:checked + .ela-choice { border-color: var(--akt); box-shadow: 0 0 0 1px var(--akt); }
.ela-codes { font-family: ui-monospace, 'JetBrains Mono', monospace; }

.ela-row { display: flex; flex-direction: column; gap: 4px; }
.ela-mt { margin-top: 16px; }

/* ---------------------------------------------------------------- Sprache */

/* Umschalter unter der Karte: die aktive Sprache weiß und halbfett, die andere
   gedämpft; ein feiner Punkt trennt. Leise genug, um nicht mit „Anmelden“ zu
   konkurrieren, und doch dort, wo man nach dem Formular hinschaut. */
.ela-locale-list {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ela-locale-list-item + .ela-locale-list-item::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 3px;
  margin: 0 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  vertical-align: middle;
}
.ela-locale-item {
  display: inline-block;
  padding: 4px 2px;
  font-size: 13px;
  line-height: 19px;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: color 120ms;
}
a.ela-locale-item:hover { color: #FFFFFF; text-decoration: underline; text-underline-offset: 3px; }
a.ela-locale-item:focus-visible { outline: 2px solid #FFFFFF; outline-offset: 2px; }
.ela-locale-item[aria-current='true'] { color: #FFFFFF; font-weight: 600; }

/* ---------------------------------------------------------------- Symbole (lucide, als Maske) */

.ela-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  flex: none;
  background-color: currentColor;
  -webkit-mask: var(--ela-icon) center / contain no-repeat;
  mask: var(--ela-icon) center / contain no-repeat;
}
.ela-icon-eye     { --ela-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E"); }
.ela-icon-eye-off { --ela-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49'/%3E%3Cpath d='M14.084 14.158a3 3 0 0 1-4.242-4.242'/%3E%3Cpath d='M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143'/%3E%3Cpath d='m2 2 20 20'/%3E%3C/svg%3E"); }
.ela-icon-alert   { --ela-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' x2='12' y1='8' y2='12'/%3E%3Cline x1='12' x2='12.01' y1='16' y2='16'/%3E%3C/svg%3E"); }
.ela-icon-check   { --ela-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='m9 12 2 2 4-4'/%3E%3C/svg%3E"); }
.ela-icon-info    { --ela-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4'/%3E%3Cpath d='M12 8h.01'/%3E%3C/svg%3E"); }
.ela-icon-restart { --ela-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8'/%3E%3Cpath d='M3 3v5h5'/%3E%3C/svg%3E"); }
.ela-icon-user    { --ela-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E"); color: var(--tx-meta); }
.ela-icon-chevron { --ela-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E"); }
.ela-icon-phone   { --ela-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='14' height='20' x='5' y='2' rx='2' ry='2'/%3E%3Cpath d='M12 18h.01'/%3E%3C/svg%3E"); }
.ela-icon-key     { --ela-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4'/%3E%3Cpath d='m21 2-9.6 9.6'/%3E%3Ccircle cx='7.5' cy='15.5' r='5.5'/%3E%3C/svg%3E"); }

/* ---------------------------------------------------------------- Schmal */

@media (max-width: 480px) {
  .ela-page { justify-content: flex-start; padding-top: 40px; }
  .ela-card { padding: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
