/* =========================================================
   LOGIN ITSAL — CSS CORREGIDO Y RESPONSIVO
   Reemplaza por completo el contenido de estiloLogin.css
   ========================================================= */

:root {
    --verde: #2f6f50;
    --verde-oscuro: #245a40;
    --verde-claro: #eef6f1;
    --texto: #17211c;
    --gris: #68716c;
    --borde: #dce3df;
    --fondo: #f4f7f5;
    --blanco: #ffffff;
    --sombra: 0 20px 55px rgba(20, 55, 39, 0.12);
}

/* NORMALIZACIÓN ENTRE NAVEGADORES */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: clamp(16px, 3vw, 36px);
    display: grid;
    place-items: center;
    overflow-x: hidden;
    background:
        radial-gradient(circle at top left, rgba(47, 111, 80, 0.08), transparent 34%),
        var(--fondo);
    color: var(--texto);
    font-family: "Segoe UI", Arial, Helvetica, sans-serif;
    line-height: 1.5;
}

button,
input {
    font: inherit;
}

button {
    border: 0;
}

img,
svg {
    display: block;
    max-width: 100%;
}

/* CONTENEDOR PRINCIPAL */
.contenedor {
    width: min(1180px, 100%);
    min-height: 650px;
    height: min(760px, calc(100dvh - 48px));
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(420px, 0.92fr);
    overflow: hidden;
    border: 1px solid rgba(47, 111, 80, 0.08);
    border-radius: 30px;
    background: var(--blanco);
    box-shadow: var(--sombra);
}

/* PANEL IZQUIERDO */
.lado-imagen {
    position: relative;
    min-width: 0;
    overflow: hidden;
    background: linear-gradient(145deg, #edf5f0, #dcebe2);
}

.imagen {
    position: absolute;
    inset: 0;
    background-color: #e9f1ec;
    background-image:
        linear-gradient(to bottom, rgba(10, 45, 30, 0.02), rgba(10, 45, 30, 0.18)),
        url("../../public/imagenes/Campus.jpeg");
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
}

/* Si la imagen Campus.jpeg está dentro de public/imagenes,
   cambia únicamente la ruta anterior por:
   url("../imagenes/Campus.jpeg");
*/

.logo {
    position: absolute;
    z-index: 3;
    top: 28px;
    left: 32px;
    width: clamp(125px, 12vw, 165px);
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 5px 12px rgba(0, 0, 0, 0.08));
}

.curva {
    position: absolute;
    z-index: 2;
    left: 0;
    right: 0;
    bottom: 0;
    min-height: 176px;
    padding: 28px 24px 22px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    align-items: center;
    gap: 12px;
    border-radius: 120px 0 0 0;
    background: linear-gradient(180deg, rgba(54, 121, 84, 0.95), rgba(34, 86, 60, 0.98));
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.item {
    min-width: 0;
    color: var(--blanco);
    text-align: center;
}

.icono {
    width: 54px;
    height: 54px;
    margin: 0 auto 12px;
    display: grid;
    place-items: center;
    border: 2px solid rgba(255, 255, 255, 0.32);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
}

.icono i,
.icono svg {
    width: 22px;
    height: 22px;
    color: var(--blanco);
    font-size: 21px;
}

.item h4 {
    margin: 0;
    font-size: clamp(14px, 1.15vw, 17px);
    font-weight: 650;
    line-height: 1.35;
}

/* PANEL DERECHO */
.lado-login {
    min-width: 0;
    padding: 34px clamp(28px, 4vw, 54px) 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: var(--blanco);
}

.card {
    width: min(100%, 440px);
    padding: 34px 34px 32px;
    border: 1px solid rgba(47, 111, 80, 0.08);
    border-radius: 24px;
    background: var(--blanco);
    box-shadow: 0 14px 38px rgba(21, 58, 40, 0.09);
}

.icon-login {
    width: 76px;
    height: 76px;
    margin: 0 auto 18px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--verde-claro);
    color: var(--verde);
}

.icon-login i {
    font-size: 29px;
}

.icon-login svg {
    width: 28px;
    height: 28px;
}

.card h1 {
    margin: 0 0 8px;
    color: var(--verde-oscuro);
    text-align: center;
    font-size: clamp(30px, 3vw, 39px);
    font-weight: 750;
    line-height: 1.15;
    letter-spacing: -0.03em;
}

.card > p {
    margin: 0 0 26px;
    color: var(--gris);
    text-align: center;
    font-size: 16px;
}

/* FORMULARIO */
form {
    width: 100%;
}

label {
    display: block;
    margin: 0 0 7px;
    color: var(--texto);
    font-size: 15px;
    font-weight: 650;
}

.input {
    width: 100%;
    min-height: 54px;
    margin-bottom: 18px;
    padding: 0 10px 0 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1.5px solid var(--borde);
    border-radius: 13px;
    background: var(--blanco);
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.input:hover {
    border-color: #9cbbaa;
}

.input:focus-within {
    border-color: var(--verde);
    box-shadow: 0 0 0 4px rgba(47, 111, 80, 0.11);
}

.input > i:first-child {
    flex: 0 0 24px;
    width: 24px;
    color: var(--verde);
    text-align: center;
    font-size: 19px;
}

.input > svg:first-child {
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    color: var(--verde);
}

.input input {
    min-width: 0;
    width: 100%;
    height: 50px;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--texto);
    font-size: 16px;
}

.input input::placeholder {
    color: #9aa3a0;
    opacity: 1;
}

/* EVITA EL BOTÓN VER/OCULTAR GIGANTE */
.input button,
.input .toggle-password,
.input #togglePassword {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    min-width: 42px;
    margin: 0;
    padding: 0;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: transparent;
    color: var(--gris);
    box-shadow: none;
    cursor: pointer;
    transition: background 160ms ease, color 160ms ease;
}

.input button:hover,
.input .toggle-password:hover,
.input #togglePassword:hover {
    background: var(--verde-claro);
    color: var(--verde);
    transform: none;
}

.input button i,
.input button svg {
    width: 20px;
    height: 20px;
    font-size: 19px;
}

/* Oculta el revelador nativo de Microsoft Edge cuando existe uno personalizado */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
    display: none;
}

/* OPCIONES */
.opciones {
    margin: 2px 0 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
}

.recordar {
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--texto);
    font-size: 14px;
    font-weight: 500;
}

.recordar input {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: var(--verde);
}

.opciones a {
    color: var(--verde);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.opciones a:hover {
    text-decoration: underline;
}

/* BOTÓN PRINCIPAL
   Solo afecta botones directos del formulario.
   No afecta el botón del ojo dentro del campo contraseña.
*/
.card form > button,
.card form > .btn-login,
.card form > .boton-login {
    width: 100%;
    min-height: 52px;
    margin: 2px 0 0;
    padding: 12px 18px;
    border-radius: 12px;
    background: var(--verde);
    color: var(--blanco);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 9px 20px rgba(47, 111, 80, 0.20);
    transition: background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.card form > button:hover,
.card form > .btn-login:hover,
.card form > .boton-login:hover {
    background: var(--verde-oscuro);
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(47, 111, 80, 0.23);
}

.card form > button:active,
.card form > .btn-login:active,
.card form > .boton-login:active {
    transform: translateY(0);
}

/* MENSAJES */
.error,
.alerta,
.mensaje-error {
    margin: 0 0 16px;
    padding: 11px 13px;
    border: 1px solid #efb5b5;
    border-radius: 10px;
    background: #fff2f2;
    color: #a52b2b;
    font-size: 14px;
}

/* FOOTER */
footer {
    width: min(100%, 520px);
    margin-top: 22px;
    color: #56605b;
    text-align: center;
    font-size: 13px;
    line-height: 1.6;
}

footer span {
    color: var(--verde);
}

/* ACCESIBILIDAD */
button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 3px solid rgba(47, 111, 80, 0.25);
    outline-offset: 2px;
}

::selection {
    background: var(--verde);
    color: var(--blanco);
}

/* PORTÁTILES Y PANTALLAS MEDIANAS */
@media (max-width: 1100px) {
    body {
        display: block;
        padding: 20px;
    }

    .contenedor {
        height: auto;
        min-height: calc(100dvh - 40px);
        grid-template-columns: 1fr;
    }

    .lado-imagen {
        min-height: 300px;
    }

    .curva {
        min-height: 135px;
        border-radius: 90px 0 0 0;
    }

    .lado-login {
        padding: 38px 24px 26px;
    }
}

/* TABLET */
@media (max-width: 760px) {
    body {
        padding: 14px;
    }

    .contenedor {
        min-height: calc(100dvh - 28px);
        border-radius: 22px;
    }

    .lado-imagen {
        display: none;
    }

    .lado-login {
        min-height: calc(100dvh - 28px);
        padding: 26px 18px 20px;
    }

    .card {
        width: min(100%, 470px);
        padding: 29px 24px 26px;
        border-radius: 20px;
    }

    .icon-login {
        width: 68px;
        height: 68px;
    }

    .card h1 {
        font-size: 30px;
    }

    .card > p {
        font-size: 15px;
    }
}

/* TELÉFONOS */
@media (max-width: 480px) {
    body {
        padding: 0;
        background: var(--blanco);
    }

    .contenedor {
        min-height: 100dvh;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .lado-login {
        min-height: 100dvh;
        padding: 24px 16px 18px;
    }

    .card {
        padding: 25px 18px 24px;
        border: 0;
        box-shadow: none;
    }

    .card h1 {
        font-size: 28px;
    }

    .input {
        min-height: 52px;
    }

    .opciones {
        align-items: flex-start;
        flex-direction: column;
    }

    footer {
        margin-top: 18px;
        font-size: 12px;
    }
}
/* =========================================================
   CORRECCIÓN DE FOCO Y AUTOCOMPLETADO — LOGIN ITSAL
   Pegar AL FINAL de estiloLogin.css
   ========================================================= */

/* El foco se muestra una sola vez, sobre el contenedor completo */
.input {
    position: relative;
    border: 1.5px solid #d8e1dc;
    background: #ffffff;
    box-shadow: none;
    transition:
        border-color 160ms ease,
        box-shadow 160ms ease,
        background-color 160ms ease;
}

.input:hover {
    border-color: #9db8a9;
}

.input:focus-within {
    border-color: var(--verde);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(47, 111, 80, 0.10);
}

/* El input interior no debe dibujar otro borde ni otro contorno */
.input input,
.input input:focus,
.input input:focus-visible {
    outline: none !important;
    border: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    -webkit-appearance: none;
    appearance: none;
    caret-color: var(--verde);
}

/* Evita el doble anillo de foco definido en reglas generales */
input:focus-visible {
    outline: none !important;
    outline-offset: 0 !important;
}

/* Selección de texto más discreta */
.input input::selection {
    background: rgba(47, 111, 80, 0.18);
    color: #17211c;
}

/* Mantiene el mismo estilo cuando Chrome/Edge autocompletan */
.input input:-webkit-autofill,
.input input:-webkit-autofill:hover,
.input input:-webkit-autofill:focus,
.input input:-webkit-autofill:active {
    -webkit-text-fill-color: #17211c !important;
    caret-color: var(--verde);
    -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
    box-shadow: 0 0 0 1000px #ffffff inset !important;
    transition: background-color 9999s ease-out 0s;
}

/* Firefox */
.input input:autofill {
    color: #17211c;
    background: #ffffff !important;
}

/* Botón mostrar/ocultar contraseña */
.input button:focus,
.input button:focus-visible,
.input .toggle-password:focus,
.input .toggle-password:focus-visible,
.input #togglePassword:focus,
.input #togglePassword:focus-visible {
    outline: none;
    background: var(--verde-claro);
    color: var(--verde);
    box-shadow: 0 0 0 2px rgba(47, 111, 80, 0.13);
}

/* El icono no debe interceptar el clic */
.input i,
.input svg {
    pointer-events: none;
}

/* Estados inválidos claros, sin ser agresivos */
.input.campo-error,
.input:has(input[aria-invalid="true"]) {
    border-color: #c94b4b;
    box-shadow: 0 0 0 3px rgba(201, 75, 75, 0.10);
}

.input.campo-correcto,
.input:has(input[aria-invalid="false"]:not(:placeholder-shown)) {
    border-color: #74a88a;
}

/* Respeta preferencias de movimiento */
@media (prefers-reduced-motion: reduce) {
    .input,
    .input button,
    .card,
    .lado-imagen {
        transition: none !important;
        animation: none !important;
    }
}
/* =========================================================
   CORRECCIÓN: EL FOOTER NO DEBE DESAPARECER AL MOSTRAR ERRORES
   Pegar AL FINAL de public/css/estiloLogin.css
   ========================================================= */

/* La página puede crecer y desplazarse cuando aparece un mensaje */
html,
body {
    min-height: 100%;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
}

/* No usar una altura fija: el contenido debe poder aumentar */
.contenedor {
    height: auto !important;
    min-height: min(720px, calc(100dvh - 32px));
    overflow: hidden;
}

/* El lado derecho conserva la tarjeta y el footer dentro del flujo */
.lado-login {
    min-height: 100%;
    height: auto !important;
    padding-top: 28px;
    padding-bottom: 22px;
    justify-content: center;
    overflow: visible;
}

.card {
    flex: 0 0 auto;
}

footer {
    flex: 0 0 auto;
    position: static;
    visibility: visible;
    opacity: 1;
    margin-top: 18px;
    padding-bottom: 4px;
}

/* El mensaje de error ocupa espacio normal y no empuja elementos fuera */
.error,
.alerta,
.mensaje-error {
    position: static;
    width: 100%;
    margin: 0 0 18px;
}

/* En pantallas con poca altura, el contenido empieza arriba y permite scroll */
@media (max-height: 820px) and (min-width: 761px) {
    body {
        align-items: flex-start;
        place-items: start center;
        padding-top: 16px;
        padding-bottom: 16px;
    }

    .contenedor {
        min-height: 700px;
    }

    .lado-login {
        justify-content: flex-start;
    }

    .card {
        margin-top: 0;
    }
}

/* Móviles */
@media (max-width: 760px) {
    .contenedor {
        min-height: 100dvh;
        overflow: visible;
    }

    .lado-login {
        min-height: 100dvh;
        justify-content: center;
    }

    footer {
        margin-top: 16px;
    }
}
/* =========================================================
   NOTIFICACIONES FLOTANTES DEL LOGIN
   Pegar AL FINAL de public/css/estiloLogin.css
   ========================================================= */

.toast-login {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;

    width: min(390px, calc(100vw - 32px));
    padding: 14px 48px 14px 46px;

    border: 1px solid transparent;
    border-radius: 12px;
    background: #ffffff;

    font-family: "Segoe UI", Arial, Helvetica, sans-serif;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.45;

    box-shadow: 0 16px 38px rgba(7, 54, 38, 0.16);

    opacity: 1;
    transform: translateY(0);
    transition:
        opacity 240ms ease,
        transform 240ms ease,
        visibility 240ms ease;
}

.toast-login::before {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);

    width: 22px;
    height: 22px;

    display: grid;
    place-items: center;

    border-radius: 50%;
    font-size: 14px;
    font-weight: 800;
}

.toast-login.success {
    border-color: #a8d6bd;
    background: #eff9f3;
    color: #145c3c;
}

.toast-login.success::before {
    content: "✓";
    background: #d8efe2;
    color: #145c3c;
}

.toast-login.error {
    border-color: #edb6b1;
    background: #fff3f2;
    color: #9f3028;
}

.toast-login.error::before {
    content: "!";
    background: #f8d9d6;
    color: #9f3028;
}

.toast-login.ocultar {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    pointer-events: none;
}

.toast-login__cerrar {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);

    width: 30px;
    height: 30px;
    margin: 0;
    padding: 0;

    display: grid;
    place-items: center;

    border: 0;
    border-radius: 8px;
    background: transparent;
    color: currentColor;

    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    box-shadow: none;
}

.toast-login__cerrar:hover {
    background: rgba(0, 0, 0, 0.06);
    transform: translateY(-50%);
}

.toast-login__cerrar:focus-visible {
    outline: 3px solid rgba(47, 111, 80, 0.22);
    outline-offset: 1px;
}

@media (max-width: 600px) {
    .toast-login {
        top: 14px;
        left: 16px;
        right: 16px;
        width: auto;
    }
}

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