/* ============================================================================
   VITALIX - PANTALLAS DE AUTENTICACION
   ============================================================================

   Una sola hoja para las seis pantallas: iniciar sesion, registro, recuperar
   contraseña, restablecer contraseña, verificar correo y confirmar contraseña.

   QUE HAY AQUI
     1. Pagina y fondo
     2. Columna y marca
     3. Tarjeta
     4. Avisos
     5. Campos
     6. Medidor de contraseña
     7. Casilla de verificacion
     8. Botones y enlaces
     9. Notas, estadisticas y pie
    10. Responsive y multiplataforma
    11. Impresion

   ----------------------------------------------------------------------------
   POR QUE UNA HOJA NUEVA Y NO ARREGLAR LAS TRES ANTERIORES
   ----------------------------------------------------------------------------
   Antes habia tres hojas -login.css, register.css y forgot-password.css- de
   unas 95 reglas cada una, casi identicas entre si, y el layout cargaba LAS TRES
   en todas las pantallas de autenticacion. Problemas que eso causaba:

     - Los colores estaban escritos a mano con la escala esmeralda de Tailwind
       (#10B981, #059669, #047857), que no es la paleta de la marca. El panel usa
       teal (#09855D, #087250). Se notaba el cambio de tono al pasar del login al
       panel: eran dos verdes distintos.
     - Blanco sobre #10B981 da 2.42:1, por debajo del minimo legible de 4.5:1. El
       boton principal de la pantalla de entrada no cumplia.
     - Las tres hojas se pisaban entre si: al compartir nombres de clase
       (.input-group, .alert, .error-message), el orden de carga decidia como se
       veia cada pantalla. Restablecer contraseña dependia de que las otras
       estuvieran cargadas.
     - Restablecer contraseña tenia su propio bloque de estilos con un degradado
       MORADO (#667eea -> #764ba2), ajeno a la marca, y ademas estaba dentro de un
       @section('styles') que el layout nunca pintaba, asi que no se aplicaba.

   Ahora los colores salen de public/css/vitalix-tokens.css y las seis pantallas
   comparten la misma maqueta.

   CONTRASTE (verificado con _fixpack/comprobar_contraste_armazon.py)
     blanco sobre teal 600 ................ 4.64:1   boton principal, peor punto
     teal 700 sobre blanco ................ 5.94:1   enlaces
     tinta 500 sobre blanco ............... 4.83:1   ayudas y pie
     #B91C1C sobre blanco ................. 6.47:1   errores
     teal 800 sobre teal 50 ............... 7.37:1   aviso de exito
   ========================================================================== */


/* ============================================================================
   1. PAGINA Y FONDO
   ========================================================================== */

.auth-page {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;

    /* --vx-vh-px es la altura real de la ventana en el movil: la calcula la capa
       multiplataforma (dvh y, donde no existe, una medida por JavaScript). Con
       100vh a secas, en iOS la barra de direcciones recorta la tarjeta. */
    min-height: var(--vx-vh-px);

    /* Espacio para la muesca y la barra de gestos. env() vale 0 en un
       dispositivo sin recorte, asi que en escritorio no cambia nada. */
    padding-block: calc(1.5rem + var(--vx-safe-top)) calc(1.5rem + var(--vx-safe-bottom));
    padding-inline: calc(1rem + var(--vx-safe-left)) calc(1rem + var(--vx-safe-right));

    background-color: var(--vx-surface);
    font-family: var(--vx-font, 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    color: var(--vx-text);
}

/* Dos resplandores suaves de marca sobre el fondo blanco.
   Son puramente decorativos y van con aria-hidden, por eso no llevan texto ni
   contraste que cumplir. */
.auth-page__glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(70px);
    pointer-events: none;
    z-index: 0;
}

.auth-page__glow--uno {
    top: -18%;
    left: -12%;
    width: min(60vw, 520px);
    aspect-ratio: 1;
    background: radial-gradient(circle, var(--vx-teal-100) 0%, transparent 70%);
}

.auth-page__glow--dos {
    bottom: -20%;
    right: -14%;
    width: min(55vw, 460px);
    aspect-ratio: 1;
    background: radial-gradient(circle, var(--vx-lima-100) 0%, transparent 70%);
}


/* ============================================================================
   2. COLUMNA Y MARCA
   ========================================================================== */

.auth-shell {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: 100%;
    max-width: 480px;
}

.auth-logo {
    display: grid;
    place-items: center;
    width: 132px;
    height: 132px;
    padding: 0.5rem;

    background: var(--vx-surface);
    border: 1px solid var(--vx-border);
    border-radius: var(--vx-radius-lg);
    box-shadow: var(--vx-shadow-sm);
}

.auth-logo__img {
    width: 100%;
    height: auto;
}

.auth-brand {
    text-align: center;
}

.auth-brand__name {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--vx-ink-900);
}

.auth-brand__tagline {
    margin-top: 0.125rem;
    font-size: 0.85rem;
    color: var(--vx-ink-500);
}


/* ============================================================================
   3. TARJETA
   ========================================================================== */

.auth-card {
    position: relative;
    width: 100%;
    overflow: hidden;

    background: var(--vx-surface);
    border: 1px solid var(--vx-border);
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(8, 114, 80, 0.08), 0 8px 20px rgba(11, 17, 32, 0.04);
}

/* Filete de marca en el borde superior. Es decorativo: no lleva texto. */
.auth-card__accent {
    height: 4px;
    background: linear-gradient(90deg, var(--vx-teal-600) 0%, var(--vx-lima-400) 100%);
}

.auth-card__head {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.75rem 1.75rem 0;
    text-align: center;
}

.auth-card__icon {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;

    color: var(--vx-teal-700);
    background: var(--vx-teal-50);
    border: 1px solid var(--vx-teal-100);
    border-radius: var(--vx-radius);
}

.auth-card__icon svg {
    width: 26px;
    height: 26px;
}

.auth-card__title {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--vx-ink-900);
}

.auth-card__subtitle {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--vx-ink-500);
}

/* La palabra destacada de un titulo ("¿Olvidaste tu contraseña?"). */
.auth-card__title em {
    font-style: normal;
    color: var(--vx-teal-700);
}

.auth-card__body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem 1.75rem 1.75rem;
}


/* ============================================================================
   4. AVISOS
   ========================================================================== */

.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.75rem 0.875rem;

    font-size: 0.82rem;
    line-height: 1.5;

    border: 1px solid;
    border-radius: var(--vx-radius-sm);
    transition: opacity 0.3s var(--vx-ease);
}

.auth-alert__icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin-top: 1px;
}

.auth-alert__icon svg {
    width: 18px;
    height: 18px;
}

.auth-alert__text {
    min-width: 0;
    overflow-wrap: anywhere;
}

.auth-alert--ok {
    color: var(--vx-teal-800);
    background: var(--vx-teal-50);
    border-color: var(--vx-teal-200);
}

.auth-alert--error {
    color: #B91C1C;
    background: #FEF2F2;
    border-color: #FECACA;
}

.auth-alert--info {
    color: var(--vx-ink-700);
    background: var(--vx-ink-50);
    border-color: var(--vx-border);
}


/* ============================================================================
   5. CAMPOS
   ========================================================================== */

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    min-width: 0;
}

.auth-field__label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--vx-ink-700);
}

.auth-field__required {
    color: var(--vx-error-strong, #DC2626);
}

.auth-field__hint {
    font-size: 0.72rem;
    line-height: 1.5;
    color: var(--vx-ink-500);
}

.auth-field__error {
    font-size: 0.75rem;
    font-weight: 500;
    color: #B91C1C;
}

/* Caja del campo con su icono (y, si procede, el boton de ver la contraseña). */
.auth-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-input-icon {
    position: absolute;
    inset-inline-start: 0.875rem;
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;

    color: var(--vx-ink-500);
    pointer-events: none;
}

.auth-input-icon svg {
    width: 20px;
    height: 20px;
}

.auth-input {
    width: 100%;
    min-height: 48px;
    padding: 0.75rem 0.875rem;

    font-family: inherit;
    /* 16px reales. Por debajo de ese tamano, Safari en iOS hace zoom sobre el
       campo al enfocarlo y la pantalla se descuadra. La capa multiplataforma ya
       lo fuerza en tactil; aqui se deja directamente en 16px porque estas
       pantallas se usan sobre todo desde el movil. */
    font-size: 16px;
    color: var(--vx-ink-900);

    background: var(--vx-surface);
    border: 1.5px solid var(--vx-border);
    border-radius: var(--vx-radius-sm);
    transition: border-color 0.18s var(--vx-ease), box-shadow 0.18s var(--vx-ease);
}

/* El campo lleva icono: se le deja sitio para que el texto no lo pise. */
.auth-input-icon ~ .auth-input {
    padding-inline-start: 2.75rem;
}

/* Y si ademas lleva el boton de ver la contraseña, sitio tambien a la derecha. */
.auth-input-wrap:has(.auth-eye) .auth-input {
    padding-inline-end: 3rem;
}

.auth-input::placeholder {
    color: var(--vx-ink-400);
}

.auth-input:focus {
    outline: none;
    border-color: var(--vx-teal-600);
    box-shadow: 0 0 0 3px rgba(9, 133, 93, 0.15);
}

.auth-input:focus-visible {
    outline: none;
}

.auth-input[aria-invalid="true"] {
    border-color: var(--vx-error-strong, #DC2626);
}

/* El relleno automatico del navegador pinta el campo de amarillo o azul y deja
   el formulario hecho un patchwork. Se sustituye por el fondo de la casa. */
.auth-input:-webkit-autofill,
.auth-input:-webkit-autofill:hover,
.auth-input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--vx-ink-900);
    -webkit-box-shadow: 0 0 0 1000px var(--vx-surface) inset;
    box-shadow: 0 0 0 1000px var(--vx-surface) inset;
    caret-color: var(--vx-ink-900);
}

/* Boton de ver / ocultar la contraseña. */
.auth-eye {
    position: absolute;
    inset-inline-end: 0.375rem;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;

    color: var(--vx-ink-500);
    background: transparent;
    border: none;
    border-radius: var(--vx-radius-sm);
    cursor: pointer;
}

.auth-eye svg {
    width: 20px;
    height: 20px;
}

@media (hover: hover) {
    .auth-eye:hover {
        color: var(--vx-teal-700);
        background: var(--vx-teal-50);
    }
}

.auth-eye:focus-visible {
    outline: 3px solid var(--vx-lima-400);
    outline-offset: -2px;
}

/* El ojo tachado solo se ve cuando la contraseña esta a la vista. */
.auth-eye__off {
    display: none;
}

.auth-eye[aria-pressed="true"] .auth-eye__on {
    display: none;
}

.auth-eye[aria-pressed="true"] .auth-eye__off {
    display: block;
}


/* ============================================================================
   6. MEDIDOR DE CONTRASEÑA
   ========================================================================== */

.auth-strength {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-top: 0.125rem;
}

.auth-strength__track {
    flex: 1 1 auto;
    height: 6px;
    background: var(--vx-ink-100);
    border-radius: var(--vx-radius-full);
    overflow: hidden;
}

.auth-strength__bar {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--vx-ink-300);
    transition: width 0.25s var(--vx-ease), background-color 0.25s var(--vx-ease);
}

/* Colores de ESTADO: describen la calidad de la contraseña, no la marca. */
.auth-strength__bar[data-nivel="debil"] { background: #DC2626; }
.auth-strength__bar[data-nivel="regular"] { background: var(--vx-aviso); }
.auth-strength__bar[data-nivel="buena"] { background: var(--vx-teal-500); }
.auth-strength__bar[data-nivel="fuerte"] { background: var(--vx-teal-700); }

.auth-strength__text {
    flex: 0 0 auto;
    min-width: 9ch;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--vx-ink-500);
}


/* ============================================================================
   7. CASILLA DE VERIFICACION
   ========================================================================== */

.auth-check {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    cursor: pointer;
}

/* La casilla real se oculta a la vista pero sigue existiendo para el teclado y
   los lectores de pantalla: con display:none desapareceria tambien para ellos. */
.auth-check__input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.auth-check__box {
    position: relative;
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    margin-top: 1px;

    background: var(--vx-surface);
    border: 1.5px solid var(--vx-ink-300);
    border-radius: 6px;
    transition: background-color 0.18s var(--vx-ease), border-color 0.18s var(--vx-ease);
}

/* La marca de verificacion se dibuja con un borde girado: asi no hace falta
   ninguna imagen ni icono adicional. */
.auth-check__box::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 6px;
    width: 5px;
    height: 10px;

    border: solid var(--vx-surface);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform 0.15s var(--vx-ease);
}

.auth-check__input:checked + .auth-check__box {
    background: var(--vx-teal-600);
    border-color: var(--vx-teal-600);
}

.auth-check__input:checked + .auth-check__box::after {
    transform: rotate(45deg) scale(1);
}

.auth-check__input:focus-visible + .auth-check__box {
    outline: 3px solid var(--vx-lima-400);
    outline-offset: 2px;
}

.auth-check__text {
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--vx-ink-600);
}

.auth-check__text a {
    color: var(--vx-teal-700);
    font-weight: 600;
    text-decoration: none;
}

@media (hover: hover) {
    .auth-check__text a:hover {
        text-decoration: underline;
    }
}

/* Fila con dos elementos enfrentados: "Recordar sesion" y "¿Olvidaste...?". */
.auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}


/* ============================================================================
   8. BOTONES Y ENLACES
   ========================================================================== */

.auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;

    width: 100%;
    /* 48px: por encima del minimo tactil de 44px, sin depender de una media
       query. Es la accion principal de la pantalla. */
    min-height: 48px;
    padding: 0.75rem 1.25rem;

    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;

    border: 1.5px solid transparent;
    border-radius: var(--vx-radius-sm);
    cursor: pointer;
    transition: background-color 0.18s var(--vx-ease), border-color 0.18s var(--vx-ease),
                box-shadow 0.18s var(--vx-ease), transform 0.18s var(--vx-ease);
}

.auth-btn svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.auth-btn:focus-visible {
    outline: 3px solid var(--vx-lima-400);
    outline-offset: 2px;
}

.auth-btn[disabled],
.auth-btn[aria-busy="true"] {
    opacity: 0.72;
    cursor: progress;
}

/* El degradado termina en teal 600, no en un tono mas claro: con texto blanco
   encima, el teal claro se queda en 2.36:1 y no se lee (el minimo es 4.5:1). */
.auth-btn--primary {
    color: #FFFFFF;
    background: linear-gradient(135deg, var(--vx-teal-700) 0%, var(--vx-teal-600) 100%);
    box-shadow: 0 4px 14px rgba(8, 114, 80, 0.22);
}

@media (hover: hover) {
    .auth-btn--primary:hover {
        background: linear-gradient(135deg, var(--vx-teal-800) 0%, var(--vx-teal-700) 100%);
        box-shadow: 0 8px 22px rgba(8, 114, 80, 0.28);
    }
}

.auth-btn--primary:active {
    transform: translateY(1px);
}

.auth-btn--ghost {
    color: var(--vx-ink-700);
    background: var(--vx-surface);
    border-color: var(--vx-border);
}

@media (hover: hover) {
    .auth-btn--ghost:hover {
        color: var(--vx-teal-700);
        background: var(--vx-teal-50);
        border-color: var(--vx-teal-200);
    }
}

/* Enlace de texto con area de toque suficiente en movil. */
.auth-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;

    font-size: 0.82rem;
    font-weight: 600;
    color: var(--vx-teal-700);
    text-decoration: none;
    border-radius: 6px;
}

.auth-link svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

@media (hover: hover) {
    .auth-link:hover {
        text-decoration: underline;
    }
}

.auth-link:focus-visible {
    outline: 3px solid var(--vx-lima-400);
    outline-offset: 2px;
}

@media (pointer: coarse) {
    .auth-link {
        min-height: 44px;
    }
}

.auth-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding-top: 0.25rem;
    text-align: center;
    font-size: 0.82rem;
    color: var(--vx-ink-500);
}

/* Accion que envia un formulario desde un enlace (cerrar sesion). */
.auth-btn--inline {
    width: auto;
    min-height: 44px;
    padding: 0.5rem 1rem;
    font-size: 0.82rem;
}

/* Bloque de la accion principal. Se separa un poco de los campos para que el
   boton no parezca uno mas del formulario. */
.auth-actions {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    margin-top: 0.25rem;
}


/* ============================================================================
   9. NOTAS, ESTADISTICAS Y PIE
   ========================================================================== */

/* Tarjeta explicativa: "te hemos enviado un enlace a...". */
.auth-note {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem;

    color: var(--vx-teal-800);
    background: var(--vx-teal-50);
    border: 1px solid var(--vx-teal-100);
    border-radius: var(--vx-radius-sm);
}

.auth-note__icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 32px;
    height: 32px;

    color: var(--vx-teal-700);
    background: var(--vx-surface);
    border-radius: var(--vx-radius-sm);
}

.auth-note__icon svg {
    width: 18px;
    height: 18px;
}

.auth-note__text {
    font-size: 0.78rem;
    line-height: 1.55;
}

.auth-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    width: 100%;
}

.auth-stat {
    padding: 0.75rem 0.5rem;
    text-align: center;

    background: var(--vx-surface);
    border: 1px solid var(--vx-border);
    border-radius: var(--vx-radius-sm);
}

.auth-stat__num {
    display: block;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--vx-teal-700);
}

.auth-stat__label {
    display: block;
    margin-top: 0.125rem;
    font-size: 0.68rem;
    color: var(--vx-ink-500);
}

.auth-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
}

.auth-footer__links {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.auth-footer__links a {
    font-size: 0.78rem;
    color: var(--vx-ink-600);
    text-decoration: none;
}

@media (hover: hover) {
    .auth-footer__links a:hover {
        color: var(--vx-teal-700);
        text-decoration: underline;
    }
}

@media (pointer: coarse) {
    .auth-footer__links a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
}

.auth-footer__sep {
    color: var(--vx-ink-300);
}

.auth-footer__copy {
    font-size: 0.72rem;
    line-height: 1.6;
    color: var(--vx-ink-500);
}

.auth-footer__copy .auth-footer__version {
    /* Tinta 500 y no 400: #9CA3AF sobre blanco da 2.54:1 y no llega al minimo
       legible de 4.5:1. La jerarquia frente a la linea de arriba se mantiene por
       el tamano de letra, que es mas pequeno, no por el contraste. */
    color: var(--vx-ink-500);
}


/* ============================================================================
   10. RESPONSIVE Y MULTIPLATAFORMA
   ========================================================================== */

/* Tableta estrecha y movil: la tarjeta ocupa todo el ancho y se reduce el aire
   interior, que a 375px se come el formulario. */
@media (max-width: 520px) {
    .auth-card {
        border-radius: var(--vx-radius-lg);
    }

    .auth-card__head {
        padding: 1.375rem 1.25rem 0;
    }

    .auth-card__body {
        padding: 1.25rem 1.25rem 1.5rem;
    }

    .auth-logo {
        width: 108px;
        height: 108px;
    }

    .auth-brand__name {
        font-size: 1.5rem;
    }

    .auth-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Movil muy estrecho (iPhone SE de primera generacion, Galaxy Fold cerrado). */
@media (max-width: 360px) {
    .auth-card__title {
        font-size: 1.15rem;
    }

    .auth-stats {
        gap: 0.5rem;
    }

    .auth-stat__num {
        font-size: 1rem;
    }
}

/* Telefono en horizontal: solo hay 320-400px de alto. El logo y las estadisticas
   se comen la pantalla, asi que se retiran y el formulario queda a la vista. */
@media (max-height: 520px) and (orientation: landscape) {
    .auth-page {
        align-items: flex-start;
    }

    .auth-logo,
    .auth-stats,
    .auth-footer__links {
        display: none;
    }

    .auth-brand__tagline {
        display: none;
    }

    .auth-shell {
        gap: 0.5rem;
    }
}

/* En tactil, el navegador mantiene el :hover "pegado" tras el toque; en un boton
   grande eso deja una sombra elevada permanente. Se neutraliza el movimiento,
   no el color. */
@media (hover: none) {
    .auth-btn--primary:hover {
        transform: none;
    }
}


/* ============================================================================
   11. IMPRESION
   ----------------------------------------------------------------------------
   Un formulario de acceso no tiene nada que imprimir: se oculta todo y se deja
   el papel en blanco en lugar de gastar una hoja con una tarjeta vacia.
   ========================================================================== */

@media print {
    .auth-page__glow,
    .auth-btn,
    .auth-eye {
        display: none !important;
    }

    .auth-card {
        box-shadow: none !important;
        border: 1px solid var(--vx-ink-300) !important;
    }
}
