/* ================================
   Intiqore – Auth Styles (Center + Overflow Fix)
   Datei: auth.css
   ================================ */

/* ===== Theme Tokens wie bei dir ===== */
:root {
  --auth-bg: var(--bg);
  --auth-bg-soft: color-mix(in oklab, var(--surface) 85%, var(--bg) 15%);
  --auth-card-bg: color-mix(in oklab, var(--surface) 96%, #ffffff 4%);
  --auth-text: var(--text);
  --auth-muted: var(--muted);

  --auth-primary: var(--brand);
  --auth-primary-600: var(--brand-600);
  --auth-primary-700: color-mix(in oklab, var(--brand-600) 88%, #000 12%);

  --auth-success: #22c55e;
  --auth-warning: var(--warn);
  --auth-error: #f97316;

  --auth-card-border: var(--border);
  --auth-input-bg: rgba(255, 255, 255, 0.03);
  --auth-input-border: rgba(255, 255, 255, 0.16);
  --auth-input-border-focus: color-mix(in oklab, var(--brand) 70%, transparent);

  --auth-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --auth-shadow-md: var(--shadow);

  --auth-radius: var(--radius);
  --auth-radius-sm: 10px;
  --auth-radius-lg: 20px;
}

@media (prefers-color-scheme: light) {
  :root {
    --auth-bg: var(--bg);
    --auth-bg-soft: color-mix(in oklab, #ffffff 85%, var(--bg) 15%);
    --auth-card-bg: #ffffff;
    --auth-text: var(--text);
    --auth-muted: var(--muted);

    --auth-input-bg: #ffffff;
    --auth-input-border: rgba(0, 0, 0, 0.12);
    --auth-input-border-focus: color-mix(in oklab, var(--brand) 65%, transparent);
  }
}

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

.u-center { text-align: center; }

.link {
  color: var(--auth-primary);
  text-decoration: none;
  font-weight: 600;
}
.link:hover { text-decoration: underline; }

/* ================================
   AUTH PAGE LAYOUT
   ================================ */

.page--auth {
  width: 100%;
  max-width: 100%;
  margin: 0;

  min-height: 100dvh;
  display: grid;
  justify-items: center;
  align-items: center;

  /* Standard-Padding für den Fall, dass KEIN outer container existiert */
  padding-inline: clamp(12px, 4vw, 32px);
  padding-block: clamp(16px, 4vw, 40px);

  color: var(--auth-text);
}

/* Wenn die Auth-Section direkt in einem .container liegt,
   vermeiden wir doppeltes Padding + mögliche Überbreite */
.container > .page--auth {
  padding-inline: 0;
}

/* Optionaler "starker" Reset, falls du irgendwo .page global definiert hast */
.page.page--auth {
  width: 100%;
  max-width: 100%;
  margin: 0;
}

/* Innerer Breiten-Controller */
.page--auth__inner {
  width: 100%;
  max-width: 520px;
  margin-inline: auto;
  display: grid;
  justify-items: center;
}

/* ===== Card ===== */
.page--auth .card {
  /* Parent-basiert, niemals viewport-basiert */
  width: 100%;
  max-width: 460px;

  margin-inline: auto !important;
  justify-self: center !important;

  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02)),
    var(--auth-card-bg);

  border: 1px solid var(--auth-card-border);
  border-radius: var(--auth-radius);
  box-shadow: var(--auth-shadow-md);
  overflow: hidden;
  backdrop-filter: blur(6px);
}

.card__header { padding: 28px 28px 8px; }

.card__title {
  margin: 0 0 6px;
  font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--auth-text);
}

.card__subtitle {
  margin: 0;
  color: var(--auth-muted);
}

.card__body { padding: 24px 28px; }

.card__footer {
  padding: 18px 24px 24px;
  border-top: 1px solid var(--auth-card-border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
}

/* ===== Form ===== */
.form {
  display: grid;
  gap: 16px;
}
.form__row {
  display: grid;
  gap: 8px;
}
.form__label {
  font-size: 0.95rem;
  color: var(--auth-muted);
  font-weight: 600;
}

.input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--auth-input-border);
  background: var(--auth-input-bg);
  color: var(--auth-text);
  outline: none;
  box-shadow: var(--auth-shadow-sm) inset;

  transition:
    border-color 0.18s,
    box-shadow 0.18s,
    background 0.18s,
    transform 0.02s;
}

.input::placeholder {
  color: color-mix(in oklab, var(--auth-muted) 70%, transparent);
}

.input:focus {
  border-color: var(--auth-input-border-focus);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--auth-primary) 20%, transparent);
}

.input.is-invalid {
  border-color: var(--auth-error);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--auth-error) 24%, transparent);
}

/* ===== Actions ===== */
.form__actions {
  display: flex;
  gap: 12px;
  margin-top: 4px;
  align-items: center;
  flex-wrap: wrap;
}

.form__actions--between {
  justify-content: space-between;
}

/* Wichtig für sehr schmale Breiten, verhindert "push-out" */
.form__actions--between > * {
  max-width: 100%;
}

/* ===== A11y Focus ===== */
:where(.link, .input, .btn):focus-visible {
  outline: 3px solid color-mix(in oklab, var(--auth-primary) 45%, transparent);
  outline-offset: 3px;
  border-radius: 14px;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .form__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .form__actions .btn {
    width: 100%;
    justify-content: center;
  }

  .form__actions--between {
    gap: 10px;
  }
}

@media (max-width: 420px) {
  .card__body,
  .card__header,
  .card__footer {
    padding-left: 18px;
    padding-right: 18px;
  }

  .card__title {
    font-size: 1.35rem;
  }

  .page--auth {
    padding-inline: 12px;
  }

  /* Falls outer container existiert, bleibt trotzdem sauber */
  .container > .page--auth {
    padding-inline: 0;
  }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
