@import url('https://fonts.googleapis.com/css2?family=Figtree:wght@300..800&display=swap');

/* =========================================================
   intraNET · Login v3 (solo SSO) · Propuesta C
   Escritorio: panel dividido (marca a la izquierda, acceso a la derecha)
   Móvil (≤ 900px): cabecera de marca arriba + panel de acceso debajo
   ========================================================= */

:root {
    --azul-oscuro: #0e4667;
    --azul: #007bc2;
    --azul-claro: #7cc8f2;
    --texto: #0e4667;
    --texto-sec: #3d5266;
    --texto-ter: #4a5f72;
    --borde: #d5e1ee;
    --rojo: #cf1f2f;
}

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

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
    font-optical-sizing: auto;
    color: var(--texto);
    background-color: #f4f7fb;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Layout general (escritorio) ---------- */

.login {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
}

/* ---------- Columna de marca ---------- */

.login-brand {
    flex: 0 0 clamp(380px, 42vw, 600px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 32px;
    padding: 64px 64px 48px;
    color: #fff;
    background-image: linear-gradient(160deg, #0e4667 10%, #007bc2);
}

.login-logo {
    display: block;
    width: 230px;
    height: auto;
}

.login-brand-copy {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 420px;
}

.login-brand-copy h2 {
    margin: 0;
    font-size: 40px;
    line-height: 1.15;
    font-weight: 600;
}

.login-brand-copy p {
    margin: 0;
    font-size: 16px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.85);
}

.login-brand-bottom {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
}

.login-brand-foot {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.72);
}

/* ---------- Aviso entorno de pruebas (pre) ---------- */

.login-env {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    max-width: 420px;
}

.login-env-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 193, 7, 0.5);
    background-color: rgba(255, 193, 7, 0.14);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
}

.login-env-dot {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #ffc107;
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.28);
}

.login-env p {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.72);
}

.login-env a {
    font-weight: 600;
    color: #fff;
    text-underline-offset: 2px;
}

.login-env a:hover {
    color: #ffd666;
}

/* ---------- Columna de acceso ---------- */

.login-access {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 32px;
    background-image: url("../img/intranet/intranet-bg-alt.jpg");
    background-size: cover;
    background-position: center;
}

/* Capa difusa que resalta el contenido */
.login-panel {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    padding: 44px 40px 32px;
    border-radius: 22px;
    background-color: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 24px 60px rgba(14, 70, 103, 0.14);
    -webkit-backdrop-filter: blur(10px) saturate(1.1);
    backdrop-filter: blur(10px) saturate(1.1);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .login-panel {
        background-color: rgba(255, 255, 255, 0.88);
    }
}

.login-panel h1 {
    margin: 0 0 10px;
    font-size: 26px;
    line-height: 1.25;
    font-weight: 700;
}

.login-sub {
    margin: 0 0 32px;
    font-size: 15px;
    line-height: 1.5;
    color: var(--texto-sec);
}

/* ---------- Tarjetas de proveedor ---------- */

.login-providers {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.provider {
    /* reset de <button> */
    appearance: none;
    -webkit-appearance: none;
    font: inherit;
    text-align: left;
    cursor: pointer;

    width: 100%;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    border-radius: 14px;
    border: 1px solid var(--borde);
    background-color: rgba(255, 255, 255, 0.86);
    color: var(--texto);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.provider:hover {
    transform: translateY(-2px);
    border-color: var(--azul);
    background-color: #fff;
    box-shadow: 0 12px 28px rgba(14, 70, 103, 0.16);
}

.provider:focus-visible {
    outline: 3px solid var(--azul);
    outline-offset: 2px;
}

.provider:active {
    transform: translateY(0);
    box-shadow: none;
}

.provider:disabled {
    opacity: 0.6;
    cursor: progress;
    transform: none;
}

.provider-icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background-color: #fff;
    border: 1px solid #e5eaf0;
}

.provider-text {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.provider-name {
    font-size: 16px;
    font-weight: 600;
}

.provider-desc {
    font-size: 13px;
    color: var(--texto-ter);
}

.provider-arrow {
    flex-shrink: 0;
    color: var(--azul);
}

/* ---------- Mantener sesión (switch) ---------- */

.switch {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    margin-top: 22px;
    font-size: 14px;
    color: #2b4256;
    cursor: pointer;
    user-select: none;
}

.switch input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.switch-track {
    position: relative;
    flex-shrink: 0;
    width: 36px;
    height: 20px;
    border-radius: 20px;
    background-color: #b8c4d0;
    transition: background-color 0.15s;
}

.switch-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: #fff;
    transition: left 0.15s;
}

.switch input:checked + .switch-track {
    background-color: var(--azul);
}

.switch input:checked + .switch-track .switch-knob {
    left: 18px;
}

.switch input:focus-visible + .switch-track {
    outline: 2px solid var(--azul-oscuro);
    outline-offset: 2px;
}

/* ---------- Ayuda / errores ---------- */

.login-divider {
    height: 1px;
    margin: 18px 0;
    background-color: var(--borde);
}

.login-help {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 13.5px;
    color: var(--texto-ter);
}

.login-help a {
    font-weight: 600;
    color: #006aa8;
    text-decoration: none;
}

.login-help a:hover {
    color: var(--azul-oscuro);
    text-decoration: underline;
}

.login-error {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin: -12px 0 24px;
    padding: 12px 14px;
    border-radius: 10px;
    background-color: var(--rojo);
    color: #fff;
    font-size: 14px;
    line-height: 1.4;
}

.login-error button {
    appearance: none;
    border: 0;
    background: none;
    color: #fff;
    font-size: 18px;
    line-height: 1;
    padding: 0 2px;
    cursor: pointer;
}

.browser-support-message {
    background-color: #fff;
    position: absolute;
    inset: 0;
    padding: 0 50px;
    z-index: 10;
}

.browser-support-message p {
    position: relative;
    top: 50%;
    margin: auto;
    text-align: center;
}

/* =========================================================
   RESPONSIVE · tablet y móvil (≤ 900px)
   ========================================================= */

@media (max-width: 900px) {
    .login {
        flex-direction: column;
        background-image: url("../img/intranet/intranet-bg-alt.jpg");
        background-size: cover;
        background-position: center;
    }

    .login-brand {
        flex: 0 0 auto;
        gap: 18px;
        padding: 40px 24px 36px;
        border-radius: 0 0 24px 24px;
    }

    .login-logo {
        width: 175px;
    }

    .login-brand-copy {
        gap: 8px;
    }

    .login-brand-copy h2 {
        font-size: 26px;
        line-height: 1.2;
    }

    .login-brand-copy p {
        font-size: 14px;
        line-height: 1.5;
    }

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

    /* En móvil el pie se oculta: el bloque solo se muestra si lleva el aviso de pre */
    .login-brand-bottom:not(:has(.login-env)) {
        display: none;
    }

    .login-access {
        flex: 1 1 auto;
        align-items: flex-start;
        padding: 16px 16px 24px;
        background: none;
    }

    .login-panel {
        max-width: 560px;
        margin: 0 auto;
        padding: 24px 16px 12px;
        border-radius: 20px;
        box-shadow: 0 16px 40px rgba(14, 70, 103, 0.12);
    }

    .login-panel h1 {
        margin-bottom: 6px;
        font-size: 21px;
    }

    .login-sub {
        margin-bottom: 18px;
        font-size: 14px;
    }

    .login-providers {
        gap: 12px;
    }

    .provider {
        gap: 14px;
        padding: 14px 16px;
    }

    .provider-icon {
        width: 44px;
        height: 44px;
    }

    .provider-name {
        font-size: 15.5px;
    }

    .provider-desc {
        font-size: 12.5px;
    }

    .switch {
        margin-top: 14px;
    }

    .login-divider {
        margin: 12px 0;
    }

    .login-help {
        justify-content: center;
        text-align: center;
        padding-bottom: 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .provider,
    .switch-track,
    .switch-knob {
        transition: none;
    }
}
