/*
 * Auth flow — mobile-first del Brief-UX §5 (375-414px → 768 → 1280).
 *
 * Sprint 1 T1.1 (Slice 1) ship base. T1.6 transversal (Slice 3) refina
 * + completa los breakpoints. Esto es el mínimo para que el signup form
 * sea funcional + usable en mobile.
 *
 * Reglas duras:
 *   - Touch targets ≥ 44×44px (WCAG AA + design-review D6).
 *   - Inputs ≥ 16px font-size (iOS no-zoom on focus).
 *   - Single column en mobile, max-width en desktop.
 */

/* =========================================================
 * Page layout (mobile-first 375-414px)
 * ========================================================= */

.auth-body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg-soft, #f6f8fb);
}

.auth-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-24) var(--space-16) var(--space-32);
  gap: var(--space-24);
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-8);
  text-decoration: none;
  color: var(--text-on-light, #1a1a1a);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  min-height: 44px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: var(--radius-lg);
  padding: var(--space-24) var(--space-20);
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
}

.auth-footer {
  font-size: 13px;
  color: var(--text-muted, #94a3b8);
  text-align: center;
  padding-bottom: var(--space-16);
}

/* =========================================================
 * Header (eyebrow + heading + sub)
 * ========================================================= */

.auth-header {
  margin-bottom: var(--space-24);
}

.auth-eyebrow {
  font-family: var(--font-display);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-accent, #2a9d8f);
  margin: 0 0 var(--space-8) 0;
}

.auth-heading {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 26px;
  line-height: 1.2;
  margin: 0 0 var(--space-12) 0;
  color: var(--text-on-light, #1a1a1a);
}

.auth-sub {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-muted, #475569);
  margin: 0;
}

/* =========================================================
 * Form
 * ========================================================= */

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.auth-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-on-light, #1a1a1a);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.auth-hint {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted, #94a3b8);
}

.auth-field input {
  /* 16px font-size = iOS no-zoom contract. NO bajar. */
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.4;
  /* Touch target = 48px > 44px WCAG AA. */
  min-height: 48px;
  padding: var(--space-12) var(--space-16);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border, #cbd5e1);
  background: #fff;
  color: var(--text-on-light, #1a1a1a);
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
}

.auth-field input:focus {
  outline: 2px solid var(--color-accent, #2a9d8f);
  outline-offset: 2px;
  border-color: var(--color-accent, #2a9d8f);
}

.auth-field-error {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--color-critical, #ef4444);
  padding-top: var(--space-4);
}

/* =========================================================
 * Strength meter + HIBP feedback (T1.3 Slice 2)
 * ========================================================= */

.auth-strength {
  font-family: var(--font-body);
  font-size: 12px;
  padding-top: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* El `display: flex` de arriba pisa el `[hidden]` del navegador (misma
   especificidad, autor gana sobre UA). Sin esto, las cajas de strength y
   HIBP se muestran vacías aunque tengan el atributo `hidden`. */
.auth-strength[hidden] {
  display: none;
}

.auth-strength-bar {
  display: block;
  width: 100%;
  height: 4px;
  background: var(--color-border, #e2e8f0);
  border-radius: 2px;
  overflow: hidden;
}

.auth-strength-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--color-border, #94a3b8);
  transition: width 200ms ease, background-color 200ms ease;
}

.auth-strength-label {
  font-weight: 600;
}

.auth-strength.is-weak .auth-strength-fill { background: #ef4444; }
.auth-strength.is-weak .auth-strength-label { color: #b91c1c; }
.auth-strength.is-decent .auth-strength-fill { background: #f59e0b; }
.auth-strength.is-decent .auth-strength-label { color: #b45309; }
.auth-strength.is-strong .auth-strength-fill { background: var(--color-accent, #2a9d8f); }
.auth-strength.is-strong .auth-strength-label { color: var(--color-accent, #2a9d8f); }

.auth-strength-pwned {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.24);
  border-radius: var(--radius-sm);
  padding: var(--space-8) var(--space-12);
  color: #b91c1c;
  font-weight: 600;
}

.auth-form-error {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--color-critical, #ef4444);
  background: rgba(239, 68, 68, 0.08);
  padding: var(--space-12) var(--space-16);
  border-radius: var(--radius-md);
  border: 1px solid rgba(239, 68, 68, 0.24);
}

/* =========================================================
 * CTA button
 * ========================================================= */

.auth-cta {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  /* Touch target 52px (extra cómodo, lo más tappable del form). */
  min-height: 52px;
  padding: var(--space-16) var(--space-24);
  border-radius: var(--radius-pill);
  background: var(--color-accent, #2a9d8f);
  color: #fff;
  border: none;
  cursor: pointer;
  margin-top: var(--space-8);
  -webkit-tap-highlight-color: transparent;
}

.auth-cta:hover {
  background: var(--color-accent-hover, #248579);
}

.auth-cta:active {
  transform: translateY(1px);
}

.auth-cta:focus-visible {
  outline: 3px solid var(--color-accent, #2a9d8f);
  outline-offset: 3px;
}

/* =========================================================
 * Aux links + ToS microcopy
 * ========================================================= */

.auth-tos {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
  line-height: 1.5;
  margin: 0;
  text-align: center;
}

.auth-tos a,
.auth-aux a {
  color: var(--color-accent, #2a9d8f);
  text-decoration: underline;
  min-height: 44px;
  display: inline-block;
  padding: var(--space-8) 0;
}

.auth-aux {
  font-family: var(--font-body);
  font-size: 14px;
  text-align: center;
  margin: var(--space-16) 0 0 0;
  color: var(--text-muted, #475569);
}

/* =========================================================
 * Breakpoints — Brief-UX §5: 375 → 768 → 1280
 * ========================================================= */

@media (min-width: 768px) {
  .auth-main {
    padding: var(--space-40) var(--space-24) var(--space-48);
  }
  .auth-card {
    padding: var(--space-32) var(--space-32);
  }
  .auth-heading {
    font-size: 30px;
  }
}

@media (min-width: 1280px) {
  .auth-main {
    padding: var(--space-64) var(--space-24);
  }
}

/* =========================================================
 * Auth notice — aviso contextual en páginas de auth
 * (ej. sesión expirada al fallar CSRF)
 * ========================================================= */

.auth-notice {
  border-radius: var(--radius-md, 8px);
  padding: 12px 16px;
  margin-bottom: var(--space-16, 16px);
  font-size: 14px;
  line-height: 1.5;
}

.auth-notice--warn {
  background-color: #FEF3C7;
  border: 1px solid #F59E0B;
  color: #92400E;
}
