/* Marco común de las pantallas de cuenta (entrar, crear cuenta, recuperar y
   restablecer contraseña): panel de marca violeta + formulario sobre blanco.
   En móvil el panel se reduce a una franja y el formulario sube como hoja.
   Lo propio de cada pantalla vive en su CSS; acá va solo lo que comparten. */

body { background: #3D1A6E !important; }

.auth-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  /* En Safari de iPhone 100vh no descuenta la barra del navegador y corta el pie. */
  min-height: 100dvh;
}

/* ---- Panel de marca (decorativo) ---- */

.auth-brand {
  position: relative;
  overflow: hidden;
  flex: 0 0 139px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
  background: #3D1A6E;
}

.auth-glow {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.auth-glow-uno {
  width: 460px;
  height: 460px;
  top: -230px;
  right: -160px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.4) 0%, rgba(139, 92, 246, 0) 68%);
}

.auth-glow-dos { display: none; }

.auth-brand-mark {
  position: relative;
  width: 133px;
  max-width: 100%;
  height: auto;
  opacity: 0.02;
}

.auth-brand-foot { display: none; }

/* ---- Hoja del formulario ---- */

.auth-panel {
  position: relative;
  flex: 1 1 auto;
  background: #ffffff;
  border-radius: 24px 24px 0 0;
  padding: 30px 24px calc(28px + env(safe-area-inset-bottom));
}

.auth-form { width: 100%; }

.auth-title {
  margin: 0 0 4px;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: #111827;
}

.auth-subtitle {
  margin: 0 0 24px;
  font-size: 0.875rem;
  color: #6B7280;
}

/* ---- Campos ---- */

.auth-field { margin-bottom: 0.875rem; }

.auth-field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
}

.auth-form .form-label {
  margin-bottom: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #374151;
}

.auth-field-head .form-label { margin-bottom: 0; }

.auth-form .form-control,
.auth-form .form-select {
  padding: 0 14px;
  /* 16px: menos que eso, iOS hace zoom al enfocar el campo. */
  font-size: 1rem;
  color: #111827;
  background-color: #ffffff;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* La altura fija solo en los campos con etiqueta arriba: los de etiqueta
   flotante (registro) la calcula Bootstrap y pisarla rompe la animación. */
.auth-field > .form-control,
.auth-field > .form-select,
.auth-field > .input-group > .form-control {
  height: 48px;
}

.auth-form .form-control:focus,
.auth-form .form-select:focus {
  border-color: #8B5CF6;
  box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.12);
}

.auth-form .form-control.is-invalid,
.auth-form .form-control.is-invalid:focus {
  border-color: #DC2626;
}

.auth-form .invalid-feedback {
  font-size: 0.8125rem;
  color: #B91C1C;
}

.auth-form .form-text {
  font-size: 0.8125rem;
  color: #6B7280;
}

/* Ojo de mostrar/ocultar: va pegado al campo, sin borde propio a la izquierda. */
.auth-form .input-group-merge .form-control {
  border-right: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.auth-form .input-group-merge .input-group-text {
  color: #9CA3AF;
  background: #ffffff;
  border: 1px solid #E5E7EB;
  border-left: 0;
  border-radius: 0 8px 8px 0;
  padding-right: 14px;
}

.forgot-link {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #6D28D9;
  text-decoration: none;
}

.forgot-link:hover {
  color: #3D1A6E;
  text-decoration: underline;
}

.auth-check {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 1rem;
}

.auth-check .form-check-input {
  width: 17px;
  height: 17px;
  margin: 0;
  flex-shrink: 0;
}

.auth-check .form-check-label {
  font-size: 0.875rem;
  color: #374151;
}

.form-check-input:checked {
  background-color: #6D28D9;
  border-color: #6D28D9;
}

.form-check-input:focus {
  border-color: #8B5CF6;
  box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.12);
}

/* ---- Botón principal ---- */

.btn-login {
  width: 100%;
  height: 50px;
  border: none;
  border-radius: 50rem;
  background: #6D28D9;
  color: #ffffff !important;
  font-size: 0.9375rem;
  font-weight: 600;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.btn-login:hover {
  background: #5B21B6;
  box-shadow: 0 8px 20px rgba(109, 40, 217, 0.28);
}

/* Apagado: gris, no violeta claro. En violeta claro se leía como un botón normal
   y la gente lo apretaba sin entender por qué no pasaba nada. */
.btn-login:disabled,
.btn-login.disabled {
  background: #EFEFF3;
  color: #9CA3AF !important;
  box-shadow: none;
  opacity: 1;
  cursor: not-allowed;
}

/* Qué falta para que el botón se encienda. Lo escribe el JS de la pantalla. */
.auth-hint {
  margin: 8px 0 0;
  text-align: center;
  font-size: 0.8125rem;
  color: #6B7280;
}

/* ---- Entrar con Google / Apple ---- */

/* El divisor `.auth-sep` ("o") vive en styles_global.html: es la regla del
   sitio para separar el formulario de los botones sociales, y la modal de las
   páginas públicas la usa igual. */

.auth-social { display: flex; gap: 10px; }

/* Los dos botones traen sus estilos en línea (son partials compartidos con la
   modal de las páginas públicas), así que el ancho, el margen y el grosor del
   borde se pisan desde acá. */
.auth-social .gauth-wrap,
.auth-social .appleauth-wrap {
  flex: 1 1 0;
  min-width: 0;
  margin: 0 !important;
}

.auth-social .btn {
  height: 48px;
  border-width: 1px !important;
  font-size: 0.875rem;
}

/* ---- Pie ---- */

.auth-back {
  margin: 22px 0 0;
  text-align: center;
}

.auth-back a {
  font-size: 0.875rem;
  color: #6B7280;
  text-decoration: none;
}

.auth-back a:hover { color: #374151; }

.auth-alt {
  margin: 10px 0 0;
  text-align: center;
  font-size: 0.875rem;
  color: #6B7280;
}

.auth-alt a {
  font-weight: 600;
  color: #6D28D9;
  text-decoration: none;
}

.auth-alt a:hover { text-decoration: underline; }

/* ---- Avisos y errores ---- */

/* El contenedor no lleva margen: sin mensajes dejaba un hueco. El aire lo pone
   cada .alert con su margen propio. */
.auth-alerts .alert {
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
}

.auth-alerts .alert-danger {
  background: #FEE2E2;
  color: #B91C1C;
}

.auth-alerts .alert p:last-child { margin-bottom: 0; }

/* ---- Móvil ---- */

@media (max-width: 991.98px) {
  /* Botón pegado arriba del teclado (sticky, no fixed: evita jank en iOS) */
  .auth-submit-bar {
    position: sticky;
    bottom: 0;
    z-index: 5;
    background: #ffffff;
    padding-top: 0.5rem;
    padding-bottom: calc(0.25rem + env(safe-area-inset-bottom));
  }
}

/* ---- Escritorio: el panel se abre a la izquierda ---- */

@media (min-width: 992px) {
  .auth-shell { flex-direction: row; }

  .auth-brand {
    flex: 0 0 520px;
    padding: 56px 48px;
  }

  .auth-glow-uno {
    width: 620px;
    height: 620px;
    top: -230px;
    left: -180px;
    right: auto;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.35) 0%, rgba(139, 92, 246, 0) 68%);
  }

  .auth-glow-dos {
    display: block;
    width: 420px;
    height: 420px;
    bottom: -120px;
    right: -140px;
    background: radial-gradient(circle, rgba(167, 139, 250, 0.18) 0%, rgba(167, 139, 250, 0) 70%);
  }

  /* La marca queda centrada en el violeta; el pie se saca del flujo para no
     correrla hacia arriba. */
  .auth-brand-mark {
    width: 428px;
    opacity: 0.03;
  }

  .auth-brand-foot {
    position: absolute;
    left: 48px;
    bottom: 56px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 0.8125rem;
    color: #A78BFA;
  }

  .auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    padding: 48px;
  }

  .auth-form { width: 372px; }
  .auth-form-ancho { width: 420px; }

  .auth-title { font-size: 2rem; margin-bottom: 8px; }
  .auth-subtitle { margin-bottom: 32px; font-size: 0.9375rem; }
  .auth-field { margin-bottom: 1.125rem; }
  .auth-check { margin-bottom: 1.25rem; }

  .auth-alt-esquina {
    position: absolute;
    top: 32px;
    right: 40px;
    margin: 0;
  }

  .auth-back { margin-top: 32px; }

  /* Crear cuenta es largo: centrarlo lo deja cortado arriba en pantallas bajas,
     así que esa pantalla arranca desde arriba. */
  .auth-panel-largo { align-items: flex-start; }
}
