/* =========================================================
   Pixenty · auth.css
   Estilos del formulario de registro y de la verificación.
   Reutiliza las variables de styles.css.
   ========================================================= */

.auth-page {
  /* tipografía en línea con la landing */
  --lp-display: 'Sora', system-ui, sans-serif;
  --lp-mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  font-family: var(--lp-display);
  background: var(--bg);
  /* sutil halo rojo de marca, sin distraer */
  background-image:
    radial-gradient(circle at 18% 10%, rgba(229, 9, 20, 0.08) 0%, transparent 34%),
    radial-gradient(circle at 82% 90%, rgba(229, 9, 20, 0.06) 0%, transparent 38%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.auth-page button, .auth-page input { font-family: var(--lp-display); }

/* ============ HEADER ============ */
.auth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px clamp(20px, 5vw, 60px);
  border-bottom: 1px solid var(--line);
}

/* ============ LAYOUT ============ */
.auth-main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(32px, 6vw, 64px) 20px 80px;
}
.auth-shell {
  width: 100%;
  max-width: 460px;
}
.auth-shell--wide {
  max-width: 640px;
}
.auth-shell--narrow {
  max-width: 420px;
  text-align: center;
  padding: clamp(24px, 5vw, 48px) 0;
}

.auth-intro {
  margin-bottom: 28px;
}
.auth-title {
  font-size: clamp(28px, 4vw, 36px);
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.15;
  margin-bottom: 8px;
}
.auth-sub {
  font-size: 16px;
  color: var(--text-2);
  line-height: 1.5;
}

/* ============ FIELDS ============ */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ff {
  position: relative;
}
.ff-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.ff-input {
  width: 100%;
  height: 60px;
  padding: 22px 14px 6px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.ff-input:hover { border-color: var(--text-3); }
.ff-input:focus {
  border-color: var(--text);
  background: rgba(28, 28, 28, 0.92);
}
.ff-label {
  position: absolute;
  left: 14px;
  top: 10px;
  transform: none;
  color: var(--text-3);
  font-size: 12px;
  pointer-events: none;
  transition: color 0.15s ease-out;
}
/* Al enfocar, el label toma el color de marca para dar feedback */
.ff-input:focus + .ff-label {
  color: var(--text-2);
}
/* date y select: el navegador siempre muestra contenido (placeholder vacío
   no aplica), así que el label va arriba desde el principio */
.ff-label--static {
  top: 14px;
  transform: translateY(0);
  font-size: 12px;
  color: var(--text-3);
}
.ff-input--date,
.ff-input--select {
  padding-top: 24px;
  color: var(--text);
}
/* En date inputs vacíos Chrome muestra "dd/mm/aaaa" muy claro; lo igualamos */
.ff-input--date:not(:focus):invalid { color: transparent; }
.ff-input--date:not(:focus):invalid::-webkit-datetime-edit { color: transparent; }
.ff-input--date::-webkit-calendar-picker-indicator {
  filter: invert(0.6);
  cursor: pointer;
}

/* select arrow custom */
.ff-input--select {
  appearance: none;
  -webkit-appearance: none;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='none' stroke='%23b3b3b3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5l5 5 5-5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.ff-input--select option {
  background: #141414;
  color: var(--text);
}

.ff-optional {
  color: var(--text-3);
  font-weight: 400;
}

/* mensajes de validación */
.ff-msg {
  margin-top: 6px;
  padding: 0 4px;
  font-size: 13px;
  line-height: 1.35;
  min-height: 0;
  color: var(--danger);
}
.ff-hint {
  margin-top: 6px;
  padding: 0 4px;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.4;
}
.ff[data-state="error"] .ff-input { border-color: var(--danger); border-width: 2px; }


/* ----- campo "Te invitó X" bloqueado al venir de un enlace ----- */
.ff--locked .ff-input {
  background: rgba(229, 9, 20, 0.06);
  border-color: rgba(229, 9, 20, 0.28);
  color: var(--text-2);
  cursor: not-allowed;
}
.ff--locked .ff-input:focus {
  /* el campo es readonly: no debe pintar foco rojo intenso ni cambiar nada */
  background: rgba(229, 9, 20, 0.06);
  border-color: rgba(229, 9, 20, 0.28);
  box-shadow: none;
}
.ff-hint--locked {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
}
.ff-hint--locked svg { color: var(--brand-hot); flex-shrink: 0; }
.ff-hint--locked strong { color: var(--text); font-weight: 600; }

/* flash message global */
.form-flash {
  margin-bottom: 16px;
  padding: 12px 16px;
  background: rgba(232, 124, 3, 0.12);
  border-left: 3px solid var(--danger);
  color: #ffcf80;
  font-size: 14px;
  border-radius: 4px;
}

/* checkbox */
.ff--check { margin-top: 6px; }
.check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.45;
}
.check input { display: none; }
.check-box {
  flex-shrink: 0;
  width: 20px; height: 20px;
  border: 1.5px solid var(--line-strong);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  margin-top: 1px;
}
.check input:checked + .check-box {
  background: var(--brand);
  border-color: var(--brand);
}
.check-box svg { opacity: 0; transition: opacity 0.15s; }
.check input:checked + .check-box svg { opacity: 1; }
.check-label a { color: var(--text); text-decoration: underline; }
.check-label a:hover { color: var(--brand-hot); }

/* CTA */
.btn-block {
  width: 100%;
  margin-top: 8px;
}
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 24px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.btn-secondary:hover { background: var(--nav-hover); border-color: var(--text-3); }

.form-foot {
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-2);
  text-align: center;
}
.form-foot a { color: var(--text); text-decoration: underline; }
.form-foot a:hover { color: var(--brand-hot); }

/* botón en estado "enviando" */
.btn-primary[disabled],
.btn-primary[aria-busy="true"] {
  opacity: 0.7;
  cursor: progress;
}

/* ============ ÉXITO (post-registro) ============ */
.auth-success {
  text-align: center;
  padding: 16px 0;
}
.success-icon {
  width: 88px; height: 88px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: rgba(229, 9, 20, 0.12);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-success h2 {
  font-size: clamp(24px, 3.4vw, 32px);
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 12px;
}
.auth-success p {
  color: var(--text-2);
  line-height: 1.55;
  margin-bottom: 12px;
}
.auth-success strong { color: var(--text); }
.success-hint {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 20px;
}

/* ============ VERIFICAR (página independiente) ============ */
.verify-state { padding: 24px 0; }
.verify-icon {
  width: 88px; height: 88px;
  margin: 0 auto 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.verify-icon--ok  { background: rgba(29, 185, 84, 0.12); color: #1db954; }
.verify-icon--err { background: rgba(232, 124, 3, 0.12); color: var(--danger); }
.verify-state .btn-primary,
.verify-state .btn-secondary { margin-top: 28px; }

/* ============ RESPONSIVE ============ */
@media (max-width: 560px) {
  .auth-header { padding: 16px 18px; }
  .brand-logo { height: 26px; }
  .ff-row { grid-template-columns: 1fr; gap: 14px; }
  .ff-row--doc { grid-template-columns: 1fr !important; }
  .ff-input { height: 56px; }
  .auth-main { padding: 24px 16px 60px; }
}

/* Fila con el tipo de documento: tipo estrecho + resto ancho.
   Como .ff-row es grid, usamos una variante con columnas asimétricas. */
.ff-row--doc { grid-template-columns: 1fr 38% !important; }

/* ============ TOGGLE MOSTRAR/OCULTAR CONTRASEÑA ============ */
.ff--password { position: relative; }
.ff-input--password { padding-right: 48px; }  /* hueco para el ojo */
.ff-pwd-toggle {
  position: absolute;
  top: 30px;               /* centrado vertical del input de 60px */
  right: 10px;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-3);
  cursor: pointer;
  padding: 0;
  transition: color 0.15s, background 0.15s;
}
.ff-pwd-toggle:hover { color: var(--text); background: rgba(255,255,255,0.06); }
@media (max-width: 560px) {
  .ff-pwd-toggle { top: 28px; }  /* input de 56px en móvil */
}

/* ============ BOTÓN GRANDE ============ */
.btn-primary--lg {
  height: 54px;
  font-size: 16px;
  font-weight: 600;
}

/* ============ PASO 2FA (código de autenticación) ============ */
/* Input del código TOTP: grande, centrado, monoespaciado tipo OTP */
.ff-input--code {
  text-align: center;
  font-family: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: 0.4em;
  /* el letter-spacing añade espacio tras el último dígito; lo compensamos
     con text-indent igual para que el contenido quede centrado de verdad */
  text-indent: 0.4em;
  /* sin label flotante: padding vertical simétrico para centrar en alto */
  padding-top: 0;
  padding-bottom: 0;
  padding-left: 14px;
  padding-right: 14px;
  height: 64px;
  line-height: 64px;
}
.ff-input--code::placeholder {
  letter-spacing: 0.4em;
  text-indent: 0.4em;
  color: var(--text-3);
  opacity: 0.5;
}
/* Input del código de recuperación */
.ff-input--code-recovery {
  text-align: center;
  font-family: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  font-size: 18px;
  letter-spacing: 0.1em;
  text-indent: 0.1em;
  text-transform: uppercase;
  /* sin label flotante: padding vertical simétrico */
  padding-top: 0;
  padding-bottom: 0;
  padding-left: 14px;
  padding-right: 14px;
  line-height: 60px;
}
.ff-input--code-recovery::placeholder {
  letter-spacing: 0.1em;
  text-indent: 0.1em;
}

/* Desplegable de "¿perdiste el acceso a tu app?" */
.auth-2fa-recovery {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
}
.auth-2fa-recovery summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.15s, background 0.15s;
}
.auth-2fa-recovery summary::-webkit-details-marker { display: none; }
.auth-2fa-recovery summary::before {
  content: "";
  width: 7px; height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
}
.auth-2fa-recovery[open] summary::before { transform: rotate(45deg); }
.auth-2fa-recovery summary:hover { color: var(--text); background: rgba(255,255,255,0.03); }
.auth-2fa-recovery p {
  font-size: 13px;
  color: var(--text-3);
  padding: 0 16px;
  margin: 4px 0 12px;
  line-height: 1.5;
}
.auth-2fa-recovery .auth-form { padding: 0 16px 16px; }

/* Enlace "Cancelar y volver" */
.auth-alt {
  margin-top: 20px;
  text-align: center;
  font-size: 14px;
}
.auth-alt a {
  color: var(--text-2);
  text-decoration: none;
  transition: color 0.15s;
}
.auth-alt a:hover { color: var(--text); }

/* ============ ISOTIPO + INTRO CENTRADO (rediseño en línea con landing) ============ */
.auth-iso {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px; height: 60px;
  margin-bottom: 22px;
  border-radius: 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.auth-iso img { height: 34px; width: auto; display: block; }

/* Intro centrado y más cuidado */
.auth-intro { text-align: center; }
.auth-title {
  font-family: var(--lp-display);
  letter-spacing: -0.025em;
}
.auth-sub { max-width: 360px; margin: 0 auto; }

/* Tarjeta del formulario: contenedor sutil para "más cuidado" */
.auth-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: clamp(24px, 4vw, 34px);
  box-shadow: var(--shadow-md);
}
/* dentro de la tarjeta los inputs van sobre el fondo de la app para contraste */
.auth-card .ff-input { background: var(--bg-soft); }

/* Botón "Crear cuenta" del header en mono, discreto */
.auth-header .btn-signin {
  font-family: var(--lp-mono);
  font-size: 13px;
  font-weight: 500;
}

/* Toggle de tema en el header junto al CTA */
.auth-header-right { display: flex; align-items: center; gap: 12px; }