/* Login y registro: todo queda encapsulado en .auth-page. */
.auth-page {
  --auth-card: rgba(13, 18, 28, .92);
  --auth-field: rgba(255, 255, 255, .065);
  --auth-field-focus: rgba(255, 255, 255, .10);
  background: #05070b;
}

.auth-page .video-bg,
.auth-page .auth-static-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.auth-page .auth-static-bg {
  background:
    radial-gradient(800px 520px at 15% 5%, rgba(43, 140, 255, .22), transparent 60%),
    radial-gradient(720px 520px at 90% 20%, rgba(37, 207, 145, .10), transparent 60%),
    linear-gradient(160deg, #05070b, #0b111c 65%, #07101a);
}

.auth-page #bg-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(.34) saturate(.75);
}

.auth-page .bg-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 20%, rgba(43, 140, 255, .14), transparent 48%),
    linear-gradient(180deg, rgba(4, 6, 10, .42), rgba(4, 6, 10, .94));
}

.auth-page .auth-page-content {
  position: relative;
  z-index: 1;
  height: var(--app-height);
  min-height: 0;
  overflow-y: auto;
  padding:
    calc(var(--app-safe-top, env(safe-area-inset-top, 0px)) + 14px)
    clamp(12px, 4vw, 34px)
    calc(var(--app-safe-bottom, env(safe-area-inset-bottom, 0px)) + 24px);
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  display: grid;
  align-items: center;
}

.auth-page .auth-shell {
  width: min(100%, 520px);
  margin: auto;
}

.auth-page .auth-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--auth-card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.auth-page .auth-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: clamp(18px, 4vw, 28px) clamp(18px, 4vw, 30px) 14px;
}

.auth-page .auth-logo {
  width: 62px;
  height: 62px;
  object-fit: contain;
  flex: 0 0 auto;
  padding: 8px;
  border-radius: 17px;
  background: rgba(255, 255, 255, .055);
}

.auth-page .auth-kicker {
  color: #77b3ff;
  font-size: .74rem;
  font-weight: 900;
  letter-spacing: .18em;
}

.auth-page .auth-header h1 {
  margin: 4px 0 3px;
  color: var(--text-1);
  font-size: clamp(1.35rem, 5vw, 1.85rem);
  line-height: 1.08;
}

.auth-page .auth-header p {
  margin: 0;
  color: var(--text-2);
  font-size: .94rem;
}

.auth-page .auth-form {
  padding: 12px clamp(18px, 4vw, 30px) clamp(20px, 4vw, 30px);
}

.auth-page .auth-two-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.auth-page .auth-field {
  display: block;
  margin-bottom: 14px;
}

.auth-page .auth-field > span {
  display: block;
  margin: 0 0 7px 2px;
  color: #d8dfeb;
  font-size: .88rem;
  font-weight: 750;
}

.auth-page .auth-field input {
  width: 100%;
  min-height: 50px;
  margin: 0;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 13px;
  outline: none;
  background: var(--auth-field);
  color: var(--text-1);
  caret-color: #79b5ff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.auth-page .auth-field input::placeholder { color: #788396; }

.auth-page .auth-field input:focus {
  background: var(--auth-field-focus);
  border-color: rgba(43, 140, 255, .72);
  box-shadow: 0 0 0 3px rgba(43, 140, 255, .16);
}

.auth-page .auth-password-row {
  position: relative;
}

.auth-page .auth-password-row input { padding-right: 58px; }

.auth-page .auth-toggle-pass {
  position: absolute;
  top: 3px;
  right: 4px;
  width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #aeb8c8;
  display: grid;
  place-items: center;
}

.auth-page .auth-toggle-pass:active { background: rgba(255, 255, 255, .08); }

.auth-page .auth-remember {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--text-2);
  font-size: .9rem;
}

.auth-page .auth-remember input {
  width: 20px;
  height: 20px;
  accent-color: var(--brand);
}

.auth-page .auth-status {
  min-height: 22px;
  margin: 7px 2px 10px;
  color: var(--text-2);
  font-size: .9rem;
  line-height: 1.35;
}
.auth-page .auth-status.is-error { color: #ff8995; }
.auth-page .auth-status.is-success { color: #5be2b1; }
.auth-page .auth-status.is-info { color: #8ec0ff; }

.auth-page .auth-submit {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(100deg, var(--brand), var(--brand-strong));
  color: white;
  font-weight: 850;
  letter-spacing: .01em;
  box-shadow: 0 13px 30px rgba(23, 111, 232, .27);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.auth-page .auth-submit:disabled { opacity: .65; }
.auth-page .auth-submit-spinner { display: none; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.35); border-top-color: white; border-radius: 50%; animation: auth-spin .75s linear infinite; }
.auth-page .auth-submit.is-loading .auth-submit-spinner { display: inline-block; }
@keyframes auth-spin { to { transform: rotate(360deg); } }

.auth-page .auth-switch {
  margin: 17px 0 0;
  color: var(--text-2);
  text-align: center;
  font-size: .94rem;
}
.auth-page .auth-switch a { color: #82baff; font-weight: 800; }

/* Cuando se abre el teclado, el formulario deja de centrarse y reduce elementos decorativos. */
body.keyboard-open .auth-page .auth-page-content {
  align-items: start;
  padding-top: calc(var(--app-safe-top, env(safe-area-inset-top, 0px)) + 8px);
  padding-bottom: 20px;
}
body.keyboard-open .auth-page .auth-header { padding-top: 13px; padding-bottom: 8px; }
body.keyboard-open .auth-page .auth-logo { width: 44px; height: 44px; }
body.keyboard-open .auth-page .auth-header p { display: none; }

@media (max-width: 520px) {
  .auth-page .auth-page-content { padding-left: 10px; padding-right: 10px; }
  .auth-page .auth-card { border-radius: 18px; }
  .auth-page .auth-header { gap: 12px; }
  .auth-page .auth-logo { width: 52px; height: 52px; }
  .auth-page .auth-two-columns { grid-template-columns: 1fr; gap: 0; }
}

@media (max-height: 680px) and (orientation: landscape) {
  .auth-page .auth-page-content { align-items: start; padding-top: 8px; }
  .auth-page .auth-header { padding-top: 12px; padding-bottom: 7px; }
  .auth-page .auth-logo { width: 42px; height: 42px; }
  .auth-page .auth-header p { display: none; }
  .auth-page .auth-field { margin-bottom: 9px; }
  .auth-page .auth-field input { min-height: 46px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-page #bg-video { display: none; }
}

/* ===== Registro mejorado y recuperación de contraseña ===== */
.auth-page .auth-login-options {
  min-height: 44px;
  margin-top: -3px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.auth-page .auth-forgot-link {
  color: #82baff;
  font-size: .88rem;
  font-weight: 800;
  text-align: right;
}

.auth-page .auth-shell-register { width: min(100%, 590px); }
.auth-page .auth-register-header { padding-bottom: 10px; }
.auth-page .auth-register-benefits {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 0 clamp(18px, 4vw, 30px) 8px;
}
.auth-page .auth-register-benefits span {
  min-height: 54px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(255,255,255,.04);
  color: #aab5c5;
  font-size: .72rem;
  line-height: 1.25;
  text-align: center;
  display: grid;
  place-items: center;
  gap: 3px;
}
.auth-page .auth-register-benefits i { color: #75b5ff; font-size: 20px; }
.auth-page .auth-register-form { padding-top: 8px; }
.auth-page .auth-field-help {
  display: block;
  margin: 7px 2px 0;
  color: #8491a4;
  font-size: .76rem;
}
.auth-page .auth-password-meter {
  height: 4px;
  margin: 8px 2px 0;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.07);
}
.auth-page .auth-password-meter span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: #ff7d73;
  transform: scaleX(var(--password-strength, 0));
  transform-origin: left center;
  transition: transform .2s ease, background .2s ease;
}
.auth-page .auth-password-meter span[data-score="2"] { background: #ffc45f; }
.auth-page .auth-password-meter span[data-score="3"] { background: #72caff; }
.auth-page .auth-password-meter span[data-score="4"] { background: #58d9a4; }
.auth-page .auth-privacy-note {
  margin: 13px 0 0;
  color: #7f8c9f;
  font-size: .76rem;
  line-height: 1.35;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.auth-page .auth-privacy-note .material-icons { color: #68caa2; font-size: 15px; }

.auth-page [hidden] { display: none !important; }
.auth-page .auth-recovery-steps {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 2px clamp(18px, 4vw, 30px) 8px;
}
.auth-page .auth-recovery-steps > span {
  color: #778599;
  font-size: .72rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
}
.auth-page .auth-recovery-steps b {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
  display: grid;
  place-items: center;
}
.auth-page .auth-recovery-steps > i {
  height: 2px;
  border-radius: 99px;
  background: rgba(255,255,255,.07);
}
.auth-page .auth-recovery-steps span.is-active,
.auth-page .auth-recovery-steps span.is-complete { color: #a9d1ff; }
.auth-page .auth-recovery-steps span.is-active b,
.auth-page .auth-recovery-steps span.is-complete b { background: #2b8cff; color: white; }
.auth-page .auth-field-explanation {
  margin: -3px 2px 8px;
  color: #8794a7;
  font-size: .8rem;
  line-height: 1.45;
}
.auth-page .auth-code-sent {
  margin: 0 0 15px;
  padding: 12px 13px;
  border-radius: 13px;
  background: rgba(53,194,139,.08);
  color: #bdebd9;
  display: flex;
  align-items: center;
  gap: 11px;
}
.auth-page .auth-code-sent .material-icons { color: #59d7a7; }
.auth-page .auth-code-sent strong,
.auth-page .auth-code-sent small { display: block; }
.auth-page .auth-code-sent small { margin-top: 2px; color: #8fb6a7; }
.auth-page .auth-code-input {
  letter-spacing: .34em;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.auth-page .auth-recovery-secondary-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 12px;
}
.auth-page .auth-recovery-secondary-actions button {
  padding: 5px;
  border: 0;
  background: transparent;
  color: #82baff;
  font-size: .82rem;
  font-weight: 800;
}

@media (max-width: 520px) {
  .auth-page .auth-register-benefits { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
  .auth-page .auth-register-benefits span { min-height: 49px; padding: 6px 4px; font-size: .66rem; }
  .auth-page .auth-login-options { align-items: flex-start; }
}

@media (max-width: 370px) {
  .auth-page .auth-register-benefits { display: none; }
  .auth-page .auth-login-options { flex-direction: column; gap: 2px; }
  .auth-page .auth-forgot-link { min-height: 36px; display: flex; align-items: center; }
  .auth-page .auth-recovery-steps { grid-template-columns: 1fr; }
  .auth-page .auth-recovery-steps > i { display: none; }
}


/* V14: autenticación estable en Android */
.auth-register-page .auth-page-content,
.auth-page[data-name="login"] .auth-page-content {
  scroll-behavior: auto !important;
  scroll-padding-top: calc(var(--app-safe-top, 0px) + 12px);
  scroll-padding-bottom: 24px;
}

body.keyboard-open .auth-register-page .auth-page-content,
body.keyboard-open .auth-page[data-name="login"] .auth-page-content {
  padding-bottom: 24px !important;
}

body.keyboard-open .auth-register-page .auth-register-benefits {
  display: none !important;
}

body.keyboard-open .auth-register-page .auth-register-header {
  padding-top: 10px !important;
  padding-bottom: 7px !important;
}

body.keyboard-open .auth-register-page .auth-register-header .auth-logo {
  width: 40px !important;
  height: 40px !important;
}

body.keyboard-open .auth-register-page .auth-register-header p,
body.keyboard-open .auth-register-page .auth-kicker {
  display: none !important;
}
