/* ============================================================
 *  auth.css — Konto-Seiten in der „HW Ink"-Designsprache
 *  (Anmeldung, Registrierung, Passwort, Onboarding, Einladung)
 *
 *  Wird NACH /hw-design.css geladen und baut auf dessen Tokens
 *  auf: dunkle Bühne, blauer Radial-Glow oben, eine zentrierte
 *  Glas-Karte (max 420px), Titillium-Titel, Inter-Text.
 * ============================================================*/

:root {
  /* Aliasse für Inline-Styles der Bestands-Skripte */
  --primary: var(--brand);
  --danger: var(--bad);
}

/* ── Bühne ──────────────────────────────────────────────── */
body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 18px 32px;
}

/* ── Logo-Badge über der Karte ──────────────────────────── */
.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  text-decoration: none;
  color: var(--text);
}
.auth-brand img {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  object-fit: cover;
  border: 1px solid var(--border-strong);
  box-shadow:
    0 0 0 7px rgba(59, 130, 246, 0.08),
    0 12px 32px rgba(0, 0, 0, 0.5);
}
.auth-brand span {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 18px;
  letter-spacing: -0.01em;
}

/* ── Die Glas-Karte ─────────────────────────────────────── */
.auth-card {
  width: 100%;
  max-width: 420px;
  background: rgba(17, 24, 39, 0.72);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-lg);
  padding: 28px 26px 24px;
  animation: hw-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.auth-card.wide { max-width: 520px; }

.auth-card h1 {
  font-size: 23px;
  font-weight: 900;
  text-align: center;
  margin-bottom: 6px;
}
.auth-card .sub {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  margin-bottom: 22px;
}

/* ── Formulare ──────────────────────────────────────────── */
label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 7px;
}
.field { margin-bottom: 16px; }
.field .hint, .hint {
  font-size: 12.5px;
  color: var(--faint);
  margin-top: 6px;
  line-height: 1.45;
}
.hint a { color: var(--brand); }

input[type='text'], input[type='email'], input[type='password'], select {
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font: 500 15px/1.4 var(--font-body);
  outline: none;
  transition: border-color 0.2s ease;
}
input:focus, select:focus {
  border-color: var(--brand);
  box-shadow: var(--ring);
}
/* Der weiche --ring allein erreicht nur ~1,5:1 gegen den Karten-Hintergrund.
   Deshalb zusätzlich ein echter, deutlich sichtbarer Outline-Ring (3:1+). */
input:focus-visible, select:focus-visible, .checkbox-row input:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
input::placeholder { color: var(--faint); }
input[disabled], input[readonly] {
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
}

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  width: 100%;
  /* 44px wie .hw-btn im Designsystem – gleiche Funktion, gleiches Touch-Ziel. */
  min-height: 44px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font: 700 14px/1 var(--font-body);
  cursor: pointer;
  user-select: none;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; box-shadow: var(--ring); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; flex: 0 0 auto; }

/* Weiß auf --brand (#3b82f6) ergibt nur 3,68:1 – zu wenig für 14px/700.
   --brand-strong (#2563eb) bringt 5,17:1; der Fallback hält die Regel auch
   dann ein, wenn hw-design.css das Token (noch) nicht kennt. */
.btn-primary { background: var(--brand-strong, #2563eb); border-color: transparent; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #1d4ed8; }
.btn-secondary { background: rgba(255, 255, 255, 0.05); }
.btn-secondary:hover:not(:disabled) { background: rgba(255, 255, 255, 0.09); }

/* ── Trenner („oder") ───────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--faint);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Checkbox-Zeile (Datenschutz) ───────────────────────── */
.checkbox-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 18px;
  cursor: pointer;
}
.checkbox-row input {
  margin-top: 2px;
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
  flex: 0 0 auto;
  cursor: pointer;
}
.checkbox-row a { color: var(--brand); }

/* ── Meldungen (Fehler / Erfolg / Hinweis) ──────────────── */
.alert {
  padding: 13px 16px;
  border-radius: 14px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}
.alert-error { background: var(--bad-soft);   border-color: var(--bad-line);   color: var(--bad); }
.alert-ok    { background: var(--ok-soft);    border-color: var(--ok-line);    color: var(--ok); }
.alert-info  { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand); }
.alert-warn  { background: var(--warn-soft);  border-color: var(--warn-line);  color: var(--warn); }
.alert[hidden] { display: none; }

/* Meldungsfelder sind Live-Regionen (role="alert" / role="status").
   Damit Screenreader den eingesetzten Text auch wirklich vorlesen, dürfen
   sie NICHT per [hidden]/display:none aus dem Baum genommen werden. Sie
   bleiben deshalb dauerhaft im DOM und fallen nur zusammen, solange sie
   leer sind – ausgeblendet wird also über den Inhalt, nicht über hidden. */
.alert:empty {
  padding: 0;
  border-width: 0;
  margin: 0;
  font-size: 0;
}

/* ── Fußzeilen ──────────────────────────────────────────── */
.auth-foot {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--muted);
  text-align: center;
}
.auth-foot a { color: var(--brand); text-decoration: none; font-weight: 700; }
.auth-foot a:hover { text-decoration: underline; }

.legal {
  margin-top: 26px;
  font-size: 12px;
  color: var(--faint);
  text-align: center;
}
.legal a { color: var(--muted); text-decoration: none; margin: 0 7px; }
.legal a:hover { color: var(--text); }

/* ── Passwortstärke ─────────────────────────────────────── */
.pw-meter {
  height: 4px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  margin-top: 8px;
  overflow: hidden;
}
.pw-meter i {
  display: block;
  height: 100%;
  width: 0;
  transition: width 0.2s ease, background 0.2s ease;
}

/* ── Einladungs-Zusammenfassung ─────────────────────────── */
.summary-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 15px 17px;
  margin-bottom: 20px;
  font-size: 14px;
}
.summary-box dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  margin: 0;
}
.summary-box dt { color: var(--muted); font-size: 13px; font-weight: 600; }
.summary-box dd { margin: 0; font-weight: 700; text-align: right; overflow-wrap: anywhere; }

/* ── Lade-Spinner in Buttons ────────────────────────────── */
.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 480px) {
  body { padding: 26px 14px 26px; }
  .auth-card { padding: 24px 18px 20px; }
}
