/**
 * Panel dual login/registro — estructura y animación.
 * Colores: tokens del tema (theme.css): prefers-color-scheme y [data-theme] (ho_ally).
 * Solo variables propias del panel (--auth-*).
 */

:root {
  --auth-transition: 0.8s cubic-bezier(0.22, 0.61, 0.36, 1);
  --auth-pulse-duration: 0.55s;
  /* Ancho caja auth: 60vw en todos los anchos (tope adicional: min(..., 100vw - 32px)) */
  --auth-box-width: 60vw;
  --auth-box-height: 70vh;
  /* Proporciones dentro de .customer-auth__main (panel formulario / franja switch) */
  --auth-panel-pct: 60%;
  --auth-switch-pct: 40%;
}

/* Una sola columna de scroll: el body no crece ni hace overflow-x raro */
body.layout-content-only-body {
  width: 100%;
  min-height: 100vh;
  height: 100vh;
  max-height: 100vh;
  min-height: 100dvh;
  height: 100dvh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-soft);
  padding: 16px;
  box-sizing: border-box;
  overflow: hidden;
}

.layout-content-only-body #main-content.layout-content-only-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: none;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.layout-content-only-body #content-wrapper.wrapper__content-content-only {
  max-width: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  flex: 1;
  min-height: 0;
}

.layout-content-only-body .layout-content-only__shell {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 0;
}

/* Evita min-h-screen (100vh) duplicado: fuerza altura flexible dentro del flex */
body.layout-content-only-body .layout-content-only__shell.min-h-screen,
body.layout-content-only-body .wrapper__content-content-only.min-h-screen {
  min-height: 0 !important;
}

/*
 * #content-wrapper usa flex column + align-items: center → los hijos no se estiran en horizontal.
 * Los paneles son position:absolute y no dan ancho al padre: sin align-self: stretch + min-width
 * el bloque colapsa a una franja (min-width: 0 lo empeoraba).
 */
.customer-auth {
  align-self: stretch;
  width: 100%;
  max-width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  padding-block: 0.5rem;
}

/* Notificaciones FO: mismo ancho que la caja auth, encima del panel */
.customer-auth-notifications {
  align-self: stretch;
  width: 100%;
  display: flex;
  justify-content: center;
  box-sizing: border-box;
  padding: 0 0 0.75rem;
}

.customer-auth-notifications__inner {
  width: min(var(--auth-box-width), calc(100vw - 32px));
  max-width: calc(100vw - 32px);
}

/* Burry .alert incluye margin-bottom; el stack usa gap-3 del tema */
.customer-auth-notifications .alert {
  margin-bottom: 0;
}

/* Alerta validación cliente: todo el ancho del #customer-form (no columna estrecha) */
#customer-form .js-customer-auth-client-error {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}

/* Registro: requisitos + barra bajo las dos columnas de contraseña */
.customer-auth-register-passwords.field-password-policy {
  width: 100%;
}

.customer-auth-register-passwords .password-policy-progress-track {
  width: 100%;
  display: block;
}

.customer-auth-register-passwords .password-policy-progress {
  width: 100%;
  display: block;
  height: 10px;
}

.customer-auth-register-passwords .password-requirements {
  width: 100%;
}

/* Checklist registro (sustituye visualmente el feedback PS en esta vista) */
.customer-auth-register-passwords .password-strength-feedback {
  display: none !important;
}

.customer-auth-password-rules {
  width: 100%;
  margin-top: 0.75rem;
  box-sizing: border-box;
}

.customer-auth-password-rules__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 1.25rem;
  width: 100%;
}

@media (max-width: 480px) {
  .customer-auth-password-rules__grid {
    grid-template-columns: 1fr;
  }
}

.customer-auth-password-rules__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.customer-auth-password-rules__item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.875rem;
  line-height: 1.35;
  color: var(--sub);
}

.customer-auth-password-rules__item--ok {
  color: var(--ink);
}

.customer-auth-password-rules__status {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--line) 85%, var(--sub));
  box-sizing: border-box;
  position: relative;
}

.customer-auth-password-rules__item--ok .customer-auth-password-rules__status {
  border-color: var(--ok, #16a34a);
  background-color: var(--ok, #16a34a);
}

.customer-auth-password-rules__item--ok .customer-auth-password-rules__status::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 45%;
  width: 0.28rem;
  height: 0.55rem;
  border: solid var(--bg);
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -50%) rotate(45deg);
  box-sizing: border-box;
}

.customer-auth-password-rules__label {
  flex: 1;
  min-width: 0;
}

/* Página registro dedicada: mismo ancho que el panel dual (--auth-box-width) */
.customer-auth.customer-auth--register-only {
  flex-direction: column;
  align-items: stretch;
  width: min(var(--auth-box-width), calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  min-width: min(280px, 100%);
  flex-shrink: 0;
  margin-left: auto;
  margin-right: auto;
}

.customer-auth--register-only .register-form,
.customer-auth--register-only #customer-form {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.customer-auth--register-only input:not([type='checkbox']):not([type='radio']):not([type='hidden']),
.customer-auth--register-only select,
.customer-auth--register-only textarea {
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

.customer-auth--register-only .mb-3 {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.customer-auth--register-only .form-footer,
.customer-auth--register-only .form-footer button[type='submit'] {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.customer-auth--register-only .customer-auth__register-title {
  margin: 0 0 1rem;
  text-align: center;
  font-size: 1.75rem;
  line-height: 1.3;
  font-weight: 700;
  color: var(--ink);
}

.register-form__divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1rem 0;
}

/* Taglines del panel lateral: mismo aspecto que el título pero sin nivel de encabezado duplicado */
.customer-auth__switch-tagline {
  margin: 0;
}

.customer-auth__main {
  position: relative;
  width: min(var(--auth-box-width), calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  min-width: min(280px, 100%);
  flex-shrink: 0;
  height: min(var(--auth-box-height), calc(100vh - 32px));
  min-height: min(var(--auth-box-height), calc(100vh - 32px));
  max-height: calc(100vh - 32px);
  padding: clamp(16px, 2vw, 25px);
  background-color: var(--bg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-sizing: border-box;
}

/* Panel = contenedor posicionado + columna scroll (antes panel + __form) */
.customer-auth__panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  position: absolute;
  top: 0;
  width: var(--auth-panel-pct);
  height: 100%;
  padding: clamp(12px, 2vw, 25px);
  background-color: var(--bg);
  transition: left var(--auth-transition), opacity 0.4s ease;
  will-change: left, opacity;
  overflow-x: hidden;
  overflow-y: auto;
  box-sizing: border-box;
}

.customer-auth__icon-wrap {
  display: flex;
  gap: 10px;
  margin: 6px 0 4px;
  align-self: center;
}

.customer-auth__icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--sub);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  transition: 0.15s;
}

/* SVGs del módulo social login (assets a 30×30 en tpl; caben en el círculo 44px) */
.customer-auth__icon svg {
  width: 30px;
  height: 30px;
  display: block;
  flex-shrink: 0;
}

.customer-auth__icon:hover {
  opacity: 1;
  color: var(--brand);
  border-color: var(--brand-light);
  cursor: pointer;
}

/* Formularios al ancho útil del panel (sin franja estrecha fija) */
.customer-auth__panel #login-form,
.customer-auth__panel #customer-form {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  align-self: stretch;
}

.customer-auth__panel #login-form fieldset,
.customer-auth__panel #customer-form fieldset {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

/* Inicio de sesión (panel B): contenido al 80 % del ancho del panel, centrado */
.customer-auth__panel--b > .customer-auth__title,
.customer-auth__panel--b > .customer-auth__icon-wrap,
.customer-auth__panel--b > .customer-auth__span.customer-auth__muted,
.customer-auth__panel--b #login-form,
.customer-auth__panel--b #login-form fieldset {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

.customer-auth__panel--b > .customer-auth__icon-wrap {
  align-self: center;
  justify-content: center;
}

.customer-auth__panel input:not([type='checkbox']):not([type='radio']):not([type='hidden']),
.customer-auth__panel select,
.customer-auth__panel textarea {
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

.customer-auth__panel .mb-3 {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

/* Registro: botón de envío a todo el ancho */
.customer-auth__panel #customer-form .form-footer,
.customer-auth__panel #customer-form .form-footer button[type='submit'] {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Login: «Iniciar sesión» y «¿Olvidó…?» en la misma fila (nowrap; si no cupiera, el enlace puede encoger) */
.customer-auth__panel #login-form .d-flex.gap-2 {
  width: 100%;
  max-width: 100%;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.customer-auth__panel #login-form .d-flex.gap-2 #submit-login {
  width: auto;
  max-width: none;
  flex: 0 0 auto;
}

.customer-auth__panel #login-form .d-flex.gap-2 a {
  text-align: end;
  flex: 1 1 auto;
  min-width: 0;
}

.customer-auth__span {
  margin-top: 10px;
  margin-bottom: 12px;
}

.customer-auth__muted {
  font-size: 13px;
  letter-spacing: 0.25px;
  text-align: center;
  line-height: 1.6;
  color: var(--sub);
}

.customer-auth #login-form > .text-muted a {
  color: var(--brand);
  font-size: 14px;
  margin-top: 25px;
  border-bottom: 1px solid color-mix(in srgb, var(--brand) 40%, transparent);
  line-height: 2;
  text-decoration: none;
}

.customer-auth__title {
  font-size: clamp(1.35rem, 2.8vw + 0.5rem, 1.875rem);
  line-height: 1.35;
  background: none;
  -webkit-text-fill-color: var(--ink);
  color: var(--ink);
  margin: 0;
  width: 100%;
  text-align: center;
  font-weight: 700;
}

/* Panel login: aire bajo el H1 «Sign in to …» antes del bloque social / formulario */
.customer-auth__panel--b > h1.customer-auth__title {
  margin-bottom: 1rem;
}

.customer-auth__description {
  font-size: clamp(0.8125rem, 0.35vw + 0.75rem, 0.875rem);
  letter-spacing: 0.25px;
  text-align: center;
  line-height: 1.6;
  margin: 0;
  width: 100%;
  max-width: 100%;
}

.customer-auth__button {
  width: min(100%, 20rem);
  height: 50px;
  border-radius: 25px;
  margin-top: clamp(1.25rem, 4vh, 3rem);
  margin-left: auto;
  margin-right: auto;
  letter-spacing: 1.15px;
  box-shadow: var(--shadow-sm);
  border: none;
  background: var(--brand);
  color: var(--bg);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  box-sizing: border-box;
}

.customer-auth__panel--a {
  z-index: 100;
  left: calc(100% - var(--auth-panel-pct));
}

.customer-auth__panel--b {
  left: calc(100% - var(--auth-panel-pct));
  z-index: 0;
}

.customer-auth__switch {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: var(--auth-switch-pct);
  padding: clamp(24px, 4vw, 50px);
  z-index: 200;
  transition: left var(--auth-transition), transform var(--auth-transition), border-color 0.35s ease;
  background-color: var(--bg);
  overflow: hidden;
  border-right: 1px solid color-mix(in srgb, var(--brand) 22%, transparent);
  box-shadow: none;
  will-change: left, transform;
  box-sizing: border-box;
}

.customer-auth__switch.is-txr {
  border-right: none;
  border-left: 1px solid color-mix(in srgb, var(--brand) 22%, transparent);
}

.customer-auth__switch-inner {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  position: absolute;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 100%;
  padding: clamp(20px, 4vw, 50px) clamp(16px, 3vw, 55px);
  box-sizing: border-box;
  transition: opacity 0.42s ease, transform 0.5s ease, visibility 0.42s ease;
  transform: translateY(0) scale(1);
}

.customer-auth__switch-inner .customer-auth__title,
.customer-auth__switch-inner .customer-auth__switch-tagline,
.customer-auth__switch-inner .customer-auth__description {
  text-align: center;
  width: 100%;
}

.customer-auth__switch-inner .customer-auth__button {
  align-self: center;
  margin-left: auto;
  margin-right: auto;
}

.customer-auth__switch-button:hover {
  box-shadow: var(--shadow-sm);
  transform: scale(0.985);
  transition: 0.25s;
}

.customer-auth__switch-button:active,
.customer-auth__switch-button:focus {
  box-shadow: none;
  transform: scale(0.97);
  transition: 0.25s;
  outline: none;
}

.customer-auth .is-txr {
  left: calc(100% - var(--auth-switch-pct));
  transition: var(--auth-transition);
  transform-origin: left;
}

.customer-auth .is-txl {
  left: 0;
  transition: var(--auth-transition);
  transform-origin: right;
}

.customer-auth .is-z200 {
  z-index: 200;
}

.customer-auth .is-hidden {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  transform: translateY(12px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.32s ease, transform 0.32s ease, visibility 0.32s ease;
}

.customer-auth .is-gx {
  animation: switch-pulse var(--auth-pulse-duration) cubic-bezier(0.22, 0.61, 0.36, 1);
}

@keyframes switch-pulse {
  0% {
    transform: translateZ(0) scaleX(1);
  }
  50% {
    transform: translateZ(0) scaleX(1.04);
  }
  100% {
    transform: translateZ(0) scaleX(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .customer-auth__panel,
  .customer-auth__switch,
  .customer-auth__switch-inner,
  .customer-auth .is-hidden,
  .customer-auth .is-gx {
    transition: none !important;
    animation: none !important;
  }
}

@supports (height: 1dvh) {
  .customer-auth__main {
    height: min(var(--auth-box-height), calc(100dvh - 32px));
    min-height: min(var(--auth-box-height), calc(100dvh - 32px));
    max-height: calc(100dvh - 32px);
  }

  @media (max-width: 1199px) {
    .customer-auth__main {
      height: auto;
      min-height: 0;
      max-height: none;
    }
  }
}

/* Escritorio ancho: panel dual; altura un poco mayor (ancho sigue 60vw) */
@media (min-width: 1200px) {
  :root {
    --auth-box-height: 76vh;
  }
}

/*
 * <1200px: vista compacta (60vw × 86vh), una sola pestaña + switch arriba, scroll natural.
 * Único breakpoint “responsive” (antes 768 + 1000).
 */
@media (max-width: 1199px) {
  :root {
    --auth-box-height: 86vh;
  }

  body#authentication.layout-content-only-body #main-content.layout-content-only-main,
  body#registration.layout-content-only-body #main-content.layout-content-only-main {
    justify-content: flex-start;
    align-items: stretch;
  }

  body#authentication.layout-content-only-body .layout-content-only__shell,
  body#registration.layout-content-only-body .layout-content-only__shell,
  body#authentication.layout-content-only-body #content-wrapper.wrapper__content-content-only,
  body#registration.layout-content-only-body #content-wrapper.wrapper__content-content-only {
    justify-content: flex-start;
    align-items: stretch;
    width: 100%;
  }

  body#authentication.layout-content-only-body .customer-auth,
  body#registration.layout-content-only-body .customer-auth {
    align-items: stretch;
    justify-content: flex-start;
    width: 100%;
    flex: 0 0 auto;
    padding-block: 0.75rem 1.5rem;
  }

  .customer-auth__main {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    min-width: 0;
   /* max-width: min(var(--auth-box-width), calc(100vw - 32px));*/
    margin-inline: auto;
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
    padding: clamp(12px, 3vw, 20px);
  }

  /* Switch arriba; solo un panel visible según data-active-tab (sincroniza customer-auth.js) */
  .customer-auth__switch {
    order: 1;
  }

  .customer-auth__panel--a,
  .customer-auth__panel--b {
    order: 2;
  }

  .customer-auth[data-active-tab='register'] .customer-auth__panel--a {
    display: flex !important;
  }

  .customer-auth[data-active-tab='register'] .customer-auth__panel--b {
    display: none !important;
  }

  .customer-auth[data-active-tab='login'] .customer-auth__panel--b {
    display: flex !important;
  }

  .customer-auth[data-active-tab='login'] .customer-auth__panel--a {
    display: none !important;
  }

  .customer-auth__panel {
    position: relative !important;
    left: auto !important;
    top: auto;
    width: 100% !important;
    height: auto;
    min-height: 0;
    flex: 0 1 auto;
    z-index: auto !important;
    will-change: auto;
    justify-content: flex-start;
    align-items: stretch;
    overflow-x: hidden;
    overflow-y: visible;
    padding: clamp(8px, 2vw, 16px) clamp(8px, 3vw, 16px);
  }

  .customer-auth__switch {
    position: relative !important;
    left: auto !important;
    top: auto;
    width: 100% !important;
    height: auto;
    min-height: 0;
    flex: 0 0 auto;
    z-index: 1;
    will-change: auto;
    margin: 0 0 0.75rem;
    padding: 0.75rem clamp(10px, 3vw, 18px) 1rem;
    border: none;
    border-bottom: 1px solid color-mix(in srgb, var(--brand) 22%, transparent);
    box-shadow: none;
  }

  .customer-auth__switch.is-txr {
    border-left: none;
    border-right: none;
    border-bottom: 1px solid color-mix(in srgb, var(--brand) 22%, transparent);
  }

  .customer-auth__main .is-txl,
  .customer-auth__main .is-txr {
    left: auto !important;
    transform: none;
  }

  .customer-auth .is-gx {
    animation: none;
  }

  .customer-auth__switch-inner {
    position: relative;
    left: auto;
    right: auto;
    width: 100%;
    max-width: 100%;
    padding: 0.25rem clamp(4px, 2vw, 12px);
    align-items: center;
    text-align: center;
  }

  .customer-auth__switch-inner.is-hidden {
    display: none !important;
  }

  .customer-auth__description {
    max-width: 100%;
  }

  .customer-auth__switch .customer-auth__button {
    margin-top: 1rem;
    margin-left: auto;
    margin-right: auto;
    width: min(100%, 20rem);
    max-width: 280px;
    align-self: center;
  }

  .customer-auth__title {
    font-size: clamp(1.35rem, 5vw, 1.75rem);
    line-height: 1.35;
  }

  .customer-auth__span {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
  }

  .customer-auth__panel input:not([type='checkbox']):not([type='radio']):not([type='hidden']),
  .customer-auth__panel select,
  .customer-auth__panel textarea {
    max-width: 100%;
  }

  .customer-auth__panel .mb-3 {
    max-width: 100%;
  }

  .customer-auth.customer-auth--register-only {
    min-width: 0;
  }
}

/* Móvil: rejillas de 2 columnas del registro → una columna (nombre/apellidos, contraseñas, etc.) */
@media (max-width: 767px) {
  .customer-auth .customer-auth-form-row.grid-2,
  .customer-auth--register-only .customer-auth-form-row.grid-2 {
    grid-template-columns: 1fr;
  }
}
