/* =================================================================
   auth.css — el shell de la PUERTA DE ENTRADA (login + recuperación)
   =================================================================
   Aislado a propósito: todo cuelga del prefijo .auth-* y esta hoja NO
   se carga en ninguna pantalla de dentro del panel. Por eso no puede
   contaminar Admin, sidebar, dashboards ni formularios del CRM, y por
   eso tampoco hereda sus estilos: las medidas son las del diseño
   aprobado, no las del sistema de dentro.

   Las dos familias son las que el producto YA usa (app.css las trae de
   Google Fonts): Open Sans para el texto y Plus Jakarta Sans para los
   botones y los titulares. Se importan aquí porque estas vistas van con
   layout:false y no cargan app.css.
   ================================================================= */
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700&family=Plus+Jakarta+Sans:wght@700;800&display=swap');

:root {
  --auth-azul: #081C72;          /* el azul de la marca */
  --auth-tinta: #14204F;         /* el color del texto */
  --auth-gris: #5B6478;          /* texto secundario */
  --auth-borde: #D9DEEA;         /* borde de input en reposo */
  --auth-linea: #E6E9F2;         /* divisores */
  --auth-suave: #E9EDF7;         /* relleno del botón secundario */
  --auth-suave-2: #F4F6FC;       /* relleno de una opción marcada */
  --auth-amarillo: #FFD810;      /* el amarillo de la marca */
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body.auth-body {
  margin: 0;
  /* En móvil el fondo tras el panel es el azul: el panel blanco sube con
     esquinas redondeadas y debajo tiene que asomar el azul, no blanco. */
  background: var(--auth-azul);
  font-family: 'Open Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--auth-tinta);
  -webkit-font-smoothing: antialiased;
}

/* ── EL ARMAZÓN ────────────────────────────────────────────────────
   Escritorio: dos columnas, la imagen a la izquierda con ancho fijo.
   Móvil: una columna, imagen arriba y panel blanco debajo. #%> */
.auth-shell {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  background: #FFFFFF;
}

/* ── LA IMAGEN ─────────────────────────────────────────────────────
   El panel toma la PROPORCIÓN EXACTA del archivo (2153 x 3390). Con el
   ancho fijo de 560 el `cover` recortaba los lados —se perdía el final
   de la cinta y el borde de la cruz—; igualando la proporción no hay
   nada que recortar: la ilustración se ve entera, y de paso el panel
   crece con el alto de la pantalla y deja menos blanco a la derecha.

   El tope de 52vw es para que en una ventana muy baja y ancha el panel
   no se coma el formulario; el suelo de 420, para que en una muy alta
   siga siendo un lateral y no media pantalla.

   El azul de fondo no es un fallback que luego se sustituya: es el
   mismo color del encuadre, así que no hay parpadeo. */
.auth-arte {
  --arte: 0.63510;            /* 2153 / 3390 */
  flex: 0 0 auto;
  width: clamp(420px, calc(100svh * var(--arte)), 52vw);
  position: relative;
  overflow: hidden;
  background: var(--auth-azul);
}
@supports not (height: 100svh) {
  .auth-arte { width: clamp(420px, calc(100vh * var(--arte)), 52vw); }
}
.auth-arte img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Si el tope de 52vw llega a obligar a recortar, que recorte igual por
     los dos lados y no se vaya la composición a un lado. */
  object-position: center;
  display: block;
}

/* ── EL LADO DEL CONTENIDO ─────────────────────────────────────────  */
.auth-main {
  flex: 1 1 0%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  background: #FFFFFF;
}
.auth-caja {
  width: 400px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 32px;
}
/* Las pantallas con titular (elegir iglesia, recuperación) respiran un
   punto menos entre bloques que el login limpio. */
.auth-caja--compacta { gap: 28px; }

/* ── LOGO ──────────────────────────────────────────────────────────
   width/height explícitos y aspect-ratio: el hueco queda reservado
   desde el primer render y la caja no salta cuando entra la imagen. */
.auth-logo {
  width: 210px;
  height: auto;
  aspect-ratio: 1367 / 349;
  display: block;
  margin: 0 auto;
}
.auth-caja--compacta .auth-logo { width: 160px; }

/* ── TITULARES ─────────────────────────────────────────────────────  */
.auth-tit {
  margin: 0;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--auth-tinta);
}
.auth-sub {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--auth-gris);
}
.auth-sub--ancho { line-height: 1.6; }
.auth-sub strong { color: var(--auth-tinta); }

.auth-cab { display: flex; flex-direction: column; gap: 16px; }
.auth-cab-txt { display: flex; flex-direction: column; gap: 8px; }
.auth-cab-txt--aire { gap: 10px; }

/* ── EL ICONO DE CABECERA ──────────────────────────────────────────
   Caja de 52 con radio 14. El tono lo pone el modificador, no el SVG. */
.auth-ico {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.auth-ico svg { width: 24px; height: 24px; }
.auth-ico--azul   { background: var(--auth-suave); color: var(--auth-azul); }
.auth-ico--correo { background: #E9F9FF; color: #0B6E97; }
.auth-ico--aviso  { background: #FFF4D1; color: #7A5600; }
.auth-ico--ok     { background: #E6F4EC; color: #1E6B45; }
.auth-ico--ok svg { width: 26px; height: 26px; stroke-width: 2.4; }

/* ── FORMULARIO ────────────────────────────────────────────────────  */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin: 0;
}
.auth-campo { display: flex; flex-direction: column; gap: 8px; }
.auth-label {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--auth-tinta);
}
/* La línea donde el rótulo comparte fila con el enlace de recuperar. */
.auth-label-fila {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.auth-input {
  height: 50px;
  width: 100%;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--auth-borde);
  background: #FFFFFF;
  font-family: inherit;
  font-size: 15px;
  color: var(--auth-tinta);
  outline: none;
  /* El borde de foco crece de 1 a 1.5: sin transición salta el texto. */
  transition: border-color .12s ease, box-shadow .12s ease;
}
.auth-input::placeholder { color: #9AA3B8; }
.auth-input:focus {
  border: 1.5px solid var(--auth-azul);
  box-shadow: 0 0 0 4px rgba(8, 28, 114, .1);
}

/* ── BOTONES ───────────────────────────────────────────────────────  */
.auth-btn {
  height: 52px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 12px;
  background: var(--auth-azul);
  color: #FFFFFF;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 15.5px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.auth-btn:hover { background: #0A2389; }
.auth-form > .auth-btn { margin-top: 6px; }

.auth-btn-2 {
  height: 48px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 12px;
  background: var(--auth-suave);
  color: var(--auth-azul);
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 14.5px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.auth-btn-2:hover { background: #DFE5F4; }

/* ── ENLACES ───────────────────────────────────────────────────────  */
.auth-link {
  color: var(--auth-azul);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}
.auth-link:hover { text-decoration: underline; }

/* «Volver», con su flecha. */
.auth-volver {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  font-size: 14px;
  font-weight: 700;
  color: var(--auth-azul);
  text-decoration: none;
}
.auth-volver svg { width: 16px; height: 16px; stroke-width: 2.2; }
.auth-volver:hover { text-decoration: underline; }

/* ── EL PIE: registrar mi iglesia ──────────────────────────────────  */
.auth-pie {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 24px;
  border-top: 1px solid var(--auth-linea);
}
.auth-pie-txt {
  margin: 0;
  font-size: 13.5px;
  color: var(--auth-gris);
  text-align: center;
}

/* ── AVISOS ────────────────────────────────────────────────────────  */
.auth-aviso {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
}
.auth-aviso svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.auth-aviso span { font-size: 14px; font-weight: 600; line-height: 1.45; }

.auth-aviso--error {
  background: #FDEEEE;
  border: 1px solid #F3CACA;
  color: #A12C2C;
}
.auth-aviso--error span { color: #8F2323; }

.auth-aviso--nota {
  background: #FFF8DC;
  border: 1px solid #F1DE9C;
  color: #7A5600;
}
.auth-aviso--nota svg { margin-top: 2px; }
.auth-aviso--nota span {
  font-size: 13.5px;
  font-weight: 400;
  line-height: 1.55;
  color: #6E4E00;
}
.auth-aviso ul { margin: 0; padding-left: 18px; }

/* ── ELEGIR IGLESIA ────────────────────────────────────────────────  */
.auth-iglesias {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
}
.auth-iglesia {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  height: 68px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid var(--auth-borde);
  background: #FFFFFF;
  cursor: pointer;
  text-align: left;
  font: inherit;
}
/* Marcada = la que el cursor o el teclado está señalando. En reposo
   todas pesan lo mismo: ninguna iglesia es «la principal». */
.auth-iglesia:hover,
.auth-iglesia:focus-visible {
  border: 1.5px solid var(--auth-azul);
  background: var(--auth-suave-2);
  outline: none;
  /* El borde pasa de 1 a 1.5: se compensa para que la fila no se mueva. */
  padding: 0 15.5px;
}
.auth-iglesia-av {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--auth-suave);
  color: var(--auth-azul);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 17px;
  font-weight: 800;
  flex-shrink: 0;
  overflow: hidden;
}
.auth-iglesia-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.auth-iglesia:hover .auth-iglesia-av,
.auth-iglesia:focus-visible .auth-iglesia-av {
  background: var(--auth-azul);
  color: var(--auth-amarillo);
}
.auth-iglesia-nom {
  flex: 1 1 0%;
  font-size: 15.5px;
  font-weight: 700;
  color: var(--auth-tinta);
}
.auth-iglesia-ir { color: #9AA3B8; display: flex; }
.auth-iglesia-ir svg { width: 18px; height: 18px; stroke-width: 2.2; }
.auth-iglesia:hover .auth-iglesia-ir,
.auth-iglesia:focus-visible .auth-iglesia-ir { color: var(--auth-azul); }

/* El enlace de recuperar que en escritorio va en la fila del rótulo y
   en móvil baja debajo del botón. Cada uno se apaga donde no toca. */
.auth-olvide-movil { display: none; }

/* ── FOCO VISIBLE ──────────────────────────────────────────────────
   Coherente con el diseño: el mismo halo azul del input. */
.auth-btn:focus-visible,
.auth-btn-2:focus-visible,
.auth-link:focus-visible,
.auth-volver:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(8, 28, 114, .28);
  border-radius: 8px;
}

/* ── ENTRE MEDIAS ──────────────────────────────────────────────────
   El lateral de 560 es una medida de 1440. Por debajo de ~1180 ya no
   cabe junto a los 400 del formulario más sus 48 de aire a cada lado,
   y la página se iba 32 px por la derecha. Se le deja la MISMA
   proporción que tiene en el diseño (560/1440 = 39 %) en vez de un
   ancho fijo: la composición se mantiene y siempre cabe. */
@media (min-width: 861px) and (max-width: 1180px) {
  /* Aquí manda que el formulario quepa: el panel cede antes que él. */
  .auth-arte { width: clamp(300px, calc(100svh * var(--arte)), 42vw); }
  .auth-main { padding: 48px 40px; }
}

/* ══ MÓVIL ═════════════════════════════════════════════════════════
   No es el escritorio apilado: la imagen se vuelve una franja de 150
   y el panel blanco sube por encima con esquinas redondeadas. */
@media (max-width: 860px) {
  .auth-shell {
    flex-direction: column;
    background: var(--auth-azul);
  }

  .auth-arte {
    width: auto;
    flex: 0 0 150px;
    height: 150px;
  }
  /* El encuadre de la franja no es el del lateral: se sube el punto de
     interés para que no quede cortado por el panel. */
  .auth-arte img { object-position: center 22%; }

  .auth-main {
    flex: 1 1 0%;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    background: transparent;
  }
  .auth-caja {
    width: 100%;
    gap: 26px;
    background: #FFFFFF;
    border-radius: 24px 24px 0 0;
    padding: 32px 22px 28px;
  }
  .auth-caja--compacta { gap: 24px; }

  .auth-logo { width: 170px; }
  .auth-caja--compacta .auth-logo { width: 150px; }

  .auth-tit { font-size: 25px; }

  .auth-form { gap: 16px; }
  /* 16 px en los campos: por debajo, iOS hace zoom al enfocar. */
  .auth-input { font-size: 16px; }
  .auth-form > .auth-btn { margin-top: 4px; }

  /* El enlace de recuperar cambia de sitio: sale de la fila del rótulo
     y pasa a ir centrado debajo del botón. */
  .auth-olvide-desktop { display: none; }
  .auth-olvide-movil {
    display: inline-flex;
    align-self: center;
    align-items: center;
    height: 44px;
    font-size: 14px;
    font-weight: 600;
  }

  /* El pie se va al fondo del panel, no detrás del formulario. */
  .auth-pie {
    margin-top: auto;
    gap: 10px;
    padding-top: 20px;
  }
}

/* Pantallas muy bajas: que el panel no obligue a hacer scroll por el
   hueco del pie. */
@media (max-width: 860px) and (max-height: 700px) {
  .auth-arte { flex-basis: 110px; height: 110px; }
  .auth-caja { padding-top: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-input { transition: none; }
}
