/**
 * auth.css – Redesign of the public Sign In / Register pages.
 * Mockup reference: ui-ux-redesign-2026/mockups/sign-in.html + register.html.
 * Uses the global design tokens from tokens.css (--c-*), so dark mode is
 * handled automatically. Load AFTER tokens.css + base.css.
 */

/* ---- Centered page wrapper ---- */
.alx-auth-wrap {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-xl) var(--sp-lg);
  background: radial-gradient(120% 120% at 50% 0%, var(--c-card-2) 0%, var(--c-bg) 60%);
}

/* ---- Card ---- */
.alx-auth {
  width: 100%;
  max-width: 440px;
  background: var(--c-card);
  border: 1px solid var(--c-line);
  border-radius: var(--r-card);
  padding: var(--sp-xl);
  box-shadow: var(--shadow);
  text-align: center;
}
.alx-auth--wide { max-width: 520px; }

.alx-auth__logo {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--c-blue);
  font-size: 1.5rem;
  letter-spacing: .04em;
  margin-bottom: var(--sp-lg);
}
.alx-auth h1 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  text-align: center;
  margin: 0 0 6px;
  color: var(--c-text);
}
.alx-auth__sub {
  text-align: center;
  color: var(--c-muted);
  margin: 0 0 var(--sp-lg);
  font-size: .92rem;
}

/* ---- Fields (static label above input) ---- */
.alx-field {
  margin-bottom: var(--sp-md);
  text-align: left;
}
.alx-field label {
  display: block;
  font-size: .82rem;
  color: var(--c-muted);
  margin-bottom: 6px;
  font-weight: 600;
}
.alx-field input,
.alx-field select {
  width: 100%;
  background: var(--c-bg-muted);
  color: var(--c-text);
  border: 1px solid var(--c-line);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: .95rem;
  font-family: var(--font-body);
}
.alx-field input:focus,
.alx-field select:focus {
  outline: none;
  border-color: var(--c-blue);
  box-shadow: var(--focus-ring);
}

.alx-auth__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

/* ---- Links ---- */
.alx-auth__link {
  color: var(--c-blue);
  text-decoration: none;
  font-weight: 600;
}
.alx-auth__link:hover { text-decoration: underline; }

/* ---- Divider ("or") ---- */
.alx-auth__divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--c-muted);
  font-size: .8rem;
  margin: var(--sp-lg) 0;
}
.alx-auth__divider::before,
.alx-auth__divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--c-line);
}

/* ---- Consent / terms ---- */
.alx-auth__consent {
  display: flex;
  gap: 10px;
  font-size: .82rem;
  color: var(--c-body);
  margin: var(--sp-md) 0;
  line-height: 1.5;
  text-align: left;
}
.alx-auth__consent a { color: var(--c-blue); font-weight: 600; }
.alx-auth__consent input[type="checkbox"] { margin-top: 3px; flex: none; }

.alx-auth__note {
  text-align: center;
  color: var(--c-muted);
  font-size: .82rem;
}

/* ---- Full-width submit (works with existing .green CTA) ---- */
.alx-auth__btn {
  width: 100%;
  justify-content: center;
  margin-top: var(--sp-md);
}

/* Loading state while an auth form submit is in flight.
   The spinner sits AFTER the label (inline) and the label stays visible — this
   works both for async submits (login, stays on page) and full-page submits
   (register, target="_top"): hiding the label during a full-page navigation
   left an empty button because the centered overlay spinner never repainted. */
.alx-auth__btn.is-loading {
  pointer-events: none;
  opacity: 0.8;
}
.alx-auth__btn.is-loading::after {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 8px;
  vertical-align: -2px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: alx-auth-spin 0.6s linear infinite;
}
@keyframes alx-auth-spin {
  to { transform: rotate(360deg); }
}

/* Password strength meter (register) */
.alx-meter {
  height: 6px;
  border-radius: 4px;
  background: var(--c-bg-muted);
  margin-top: 6px;
  overflow: hidden;
}
.alx-meter > span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--c-danger), var(--c-success));
  transition: width .2s;
}

@media (max-width: 480px) {
  .alx-auth { padding: var(--sp-lg); }
}

/* ---- Register modal: wider dialog + hide JS validation help blocks ---- */
.alx-modal__dialog--wide { width: min(480px, calc(100% - 32px)); }
.help-block { display: none !important; }

/* ---- Prominent auth status messages (login / register / password reset) ----
   The ErrorOutput component renders <div class="alert alert-{danger|warning|info}">.
   Inside the auth card/modal these were unstyled (faint) — make errors dominant
   so a wrong reset code or failed register is immediately obvious. */
.alx-auth .alert,
.alx-modal__dialog .alert {
  border-radius: 10px;
  padding: 12px 16px;
  margin: 0 0 var(--sp-md);
  border: 1px solid transparent;
  border-left-width: 4px;
  font-size: .92rem;
  font-weight: 600;
  line-height: 1.4;
  text-align: left;
}
.alx-auth .alert-danger,
.alx-modal__dialog .alert-danger {
  background: rgba(214, 69, 69, .12);
  border-color: var(--c-danger);
  color: var(--c-danger-text);
}
.alx-auth .alert-warning,
.alx-modal__dialog .alert-warning {
  background: rgba(225, 161, 0, .12);
  border-color: var(--c-warning);
  color: var(--c-warning);
}
.alx-auth .alert-info,
.alx-modal__dialog .alert-info {
  background: rgba(28, 88, 142, .10);
  border-color: var(--c-blue);
  color: var(--c-blue);
}
/* Warning-triangle icon before danger/warning, check before info */
.alx-auth .alert::before,
.alx-modal__dialog .alert::before {
  margin-right: 8px;
  font-weight: 700;
}
.alx-auth .alert-danger::before,
.alx-modal__dialog .alert-danger::before,
.alx-auth .alert-warning::before,
.alx-modal__dialog .alert-warning::before { content: "\26A0"; }
.alx-auth .alert-info::before,
.alx-modal__dialog .alert-info::before { content: "\2139"; }
