/* ===== Auth split layout (login / register / forgot) ===== */
body.auth-body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: #1e3a8a;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: block;
  padding: 0;
  position: relative;
}

body.auth-body::before {
  display: none;
}

/*
 * Dos columnas (formulario centrado en su mitad).
 * La foto se disuelve con mask hacia el azul del shell:
 * mismo color detrás del formulario = sin línea divisoria.
 */
.auth-shell {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  position: relative;
  background: #1e3a8a;
}

.auth-shell.form-right {
  grid-template-columns: 1.08fr 0.92fr;
}

.auth-shell.form-left {
  grid-template-columns: 0.92fr 1.08fr;
}

.auth-shell.form-right .auth-visual { order: 1; }
.auth-shell.form-right .auth-panel { order: 2; }
.auth-shell.form-left .auth-visual { order: 2; }
.auth-shell.form-left .auth-panel { order: 1; }

.auth-visual,
.auth-panel {
  position: relative;
  min-height: 100vh;
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.45s ease;
}

.auth-visual {
  overflow: hidden;
  background: transparent;
  z-index: 1;
}

.auth-visual-fallback {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 40%, rgba(96, 165, 250, 0.35), transparent 55%),
    radial-gradient(circle at 70% 70%, rgba(249, 115, 22, 0.22), transparent 50%),
    linear-gradient(160deg, #1e3a8a 0%, #0f172a 55%, #1e40af 100%);
  -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 55%, transparent 100%);
  mask-image: linear-gradient(90deg, #000 0%, #000 55%, transparent 100%);
}

.auth-shell.form-left .auth-visual-fallback {
  -webkit-mask-image: linear-gradient(270deg, #000 0%, #000 55%, transparent 100%);
  mask-image: linear-gradient(270deg, #000 0%, #000 55%, transparent 100%);
}

.auth-visual-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  /* La foto se vuelve transparente hacia el formulario = mismo azul del fondo */
  -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 48%, rgba(0, 0, 0, 0.55) 72%, transparent 100%);
  mask-image: linear-gradient(90deg, #000 0%, #000 48%, rgba(0, 0, 0, 0.55) 72%, transparent 100%);
}

.auth-shell.form-right .auth-visual-img {
  object-position: 30% center;
}

.auth-shell.form-left .auth-visual-img {
  object-position: 70% center;
  -webkit-mask-image: linear-gradient(270deg, #000 0%, #000 48%, rgba(0, 0, 0, 0.55) 72%, transparent 100%);
  mask-image: linear-gradient(270deg, #000 0%, #000 48%, rgba(0, 0, 0, 0.55) 72%, transparent 100%);
}

/* Ya no hace falta un fade sólido encima (evita “segunda línea”) */
.auth-visual-fade {
  display: none;
}

.auth-visual-caption {
  position: absolute;
  left: 36px;
  bottom: 40px;
  right: 28%;
  z-index: 2;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.auth-shell.form-left .auth-visual-caption {
  left: 28%;
  right: 36px;
  text-align: right;
  align-items: flex-end;
}

.auth-visual-kicker {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.85;
}

.auth-visual-title {
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  font-weight: 800;
  line-height: 1.2;
  max-width: 16ch;
}

.auth-visual-hint {
  margin-top: 8px;
  font-size: 11px;
  opacity: 0.55;
  font-weight: 500;
}

.auth-visual-hint code {
  font-size: 10px;
  background: rgba(255, 255, 255, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
}

.auth-visual:has(.auth-visual-img) .auth-visual-hint {
  display: none;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 24px;
  z-index: 2;
  overflow-y: auto;
  /* Mismo azul del shell: continúa la difuminación de la foto */
  background: transparent;
}

.auth-panel .login-container,
.auth-panel .register-container,
.auth-panel .container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.auth-panel .login-sky {
  display: none;
}

/* Inputs / botones */
.auth-panel .form-input {
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease, background 0.25s ease;
}

.auth-panel .form-input:hover {
  border-color: #93c5fd;
}

.auth-panel .form-input:focus {
  transform: translateY(-1px);
  border-color: #3b82f6;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.16), 0 10px 24px rgba(30, 64, 175, 0.12);
}

.auth-panel .btn-primary {
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.28s ease, filter 0.2s ease;
}

.auth-panel .btn-primary:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.01);
  filter: brightness(1.05);
}

.auth-panel .btn-primary:active:not(:disabled) {
  transform: translateY(0) scale(0.985);
}

.auth-panel .link {
  position: relative;
  transition: color 0.2s ease, transform 0.2s ease;
}

.auth-panel .link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.28s ease;
  opacity: 0.45;
}

.auth-panel .link:hover::after {
  transform: scaleX(1);
}

/* Entrada / salida con swap */
.auth-shell.is-arriving-forward .auth-visual,
.auth-shell.is-arriving-forward .auth-panel,
.auth-shell.is-arriving-back .auth-visual,
.auth-shell.is-arriving-back .auth-panel {
  animation-duration: 0.55s;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
  animation-fill-mode: both;
}

.auth-shell.form-left.is-arriving-forward .auth-panel {
  animation-name: authPanelInFromRight;
}
.auth-shell.form-left.is-arriving-forward .auth-visual {
  animation-name: authVisualInFromLeft;
}

.auth-shell.form-right.is-arriving-back .auth-panel {
  animation-name: authPanelInFromLeft;
}
.auth-shell.form-right.is-arriving-back .auth-visual {
  animation-name: authVisualInFromRight;
}

.auth-shell.form-right.is-leaving-forward .auth-panel {
  animation: authPanelOutToLeft 0.42s ease forwards;
}
.auth-shell.form-right.is-leaving-forward .auth-visual {
  animation: authVisualOutToRight 0.42s ease forwards;
}

.auth-shell.form-left.is-leaving-back .auth-panel {
  animation: authPanelOutToRight 0.42s ease forwards;
}
.auth-shell.form-left.is-leaving-back .auth-visual {
  animation: authVisualOutToLeft 0.42s ease forwards;
}

@keyframes authPanelInFromRight {
  from { opacity: 0; transform: translateX(56px); }
  to { opacity: 1; transform: none; }
}
@keyframes authPanelInFromLeft {
  from { opacity: 0; transform: translateX(-56px); }
  to { opacity: 1; transform: none; }
}
@keyframes authVisualInFromLeft {
  from { opacity: 0; transform: translateX(-40px) scale(1.03); }
  to { opacity: 1; transform: none; }
}
@keyframes authVisualInFromRight {
  from { opacity: 0; transform: translateX(40px) scale(1.03); }
  to { opacity: 1; transform: none; }
}
@keyframes authPanelOutToLeft {
  to { opacity: 0; transform: translateX(-48px); }
}
@keyframes authPanelOutToRight {
  to { opacity: 0; transform: translateX(48px); }
}
@keyframes authVisualOutToRight {
  to { opacity: 0.35; transform: translateX(36px) scale(1.04); }
}
@keyframes authVisualOutToLeft {
  to { opacity: 0.35; transform: translateX(-36px) scale(1.04); }
}

@media (max-width: 960px) {
  html,
  body.auth-body {
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .auth-shell,
  .auth-shell.form-right,
  .auth-shell.form-left {
    grid-template-columns: 1fr;
    min-height: auto;
    height: auto;
  }

  .auth-shell.form-right .auth-visual,
  .auth-shell.form-left .auth-visual {
    order: 1;
    min-height: 180px;
    max-height: 28vh;
  }

  .auth-shell.form-right .auth-panel,
  .auth-shell.form-left .auth-panel {
    order: 2;
    min-height: auto;
    height: auto;
    padding: 16px 16px calc(40px + env(safe-area-inset-bottom, 0px));
    background: #1e3a8a;
  }

  .auth-visual-img,
  .auth-shell.form-right .auth-visual-img,
  .auth-shell.form-left .auth-visual-img {
    object-position: center;
    -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 55%, transparent 100%);
    mask-image: linear-gradient(180deg, #000 0%, #000 55%, transparent 100%);
  }

  .auth-visual-fallback,
  .auth-shell.form-left .auth-visual-fallback {
    -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 55%, transparent 100%);
    mask-image: linear-gradient(180deg, #000 0%, #000 55%, transparent 100%);
  }

  .auth-visual-caption {
    left: 20px;
    right: 20px;
    bottom: 18px;
  }

  .auth-shell.form-left .auth-visual-caption {
    left: 20px;
    right: 20px;
    text-align: left;
    align-items: flex-start;
  }

  .auth-visual-title {
    max-width: none;
    font-size: 1.25rem;
  }

  .auth-shell.is-leaving-forward .auth-panel,
  .auth-shell.is-leaving-back .auth-panel,
  .auth-shell.is-leaving-forward .auth-visual,
  .auth-shell.is-leaving-back .auth-visual {
    animation: authFadeOut 0.32s ease forwards;
  }

  .auth-shell.is-arriving-forward .auth-panel,
  .auth-shell.is-arriving-back .auth-panel {
    animation: authFadeIn 0.4s ease both;
  }

  .auth-shell.is-arriving-forward .auth-visual,
  .auth-shell.is-arriving-back .auth-visual {
    animation: none;
    opacity: 1;
  }
}

@keyframes authFadeOut {
  to { opacity: 0; transform: translateY(12px); }
}
@keyframes authFadeIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-shell,
  .auth-visual,
  .auth-panel,
  .auth-visual-img,
  .auth-panel .form-input,
  .auth-panel .btn-primary,
  .auth-panel .link::after {
    transition: none !important;
    animation: none !important;
  }
}
