:root {
    --kpf-navy: #071b31;
    --kpf-navy-strong: #041426;
    --kpf-blue: #0c3358;
    --kpf-gold: #d5a13c;
    --kpf-gold-soft: #e4b554;
    --text-primary: #102238;
    --text-secondary: #687386;
    --border: #d7dde5;
    --white: #ffffff;
}

* {
    box-sizing: border-box;
}

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

body {
    min-height: 100vh;
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;

    color: var(--text-primary);

    background:
        linear-gradient(
            90deg,
            rgba(2, 15, 29, .20),
            rgba(2, 15, 29, .05)
        ),
        url('/images/login/fundo_geral.png')
        center center / cover no-repeat fixed;

    overflow-x: hidden;
}

.login-page {
    min-height: 100vh;
    width: 100%;
    overflow-x: clip;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: clamp(20px, 4vh, 40px) 64px;

    background:
        linear-gradient(
            90deg,
            rgba(2, 15, 29, .20),
            rgba(2, 15, 29, .05)
        ),
        url('/images/login/fundo_geral.png')
        center center / cover no-repeat fixed;
}

.login-layout {
    width: min(1500px, 100%);

    display: grid;
    grid-template-columns:
        minmax(380px, 470px)
        minmax(600px, 1fr);

    align-items: center;
    gap: clamp(50px, 6vw, 110px);
}

/* =========================================================
   CARD LOGIN
========================================================= */

.login-card {
    position: relative;

    background: rgba(255, 255, 255, .985);

    border-radius: 24px;
    overflow: hidden;

    box-shadow:
        0 32px 80px rgba(0, 12, 27, .32),
        0 4px 18px rgba(0, 12, 27, .10);

    backdrop-filter: blur(14px);
}

.login-brand {
    min-height: 190px;

    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;

    padding: 34px 40px 38px;

    color: #fff;

    background:
        radial-gradient(
            circle at 20% 0%,
            rgba(22, 82, 126, .8),
            transparent 55%
        ),
        linear-gradient(
            135deg,
            #092743 0%,
            #04182b 60%,
            #031423 100%
        );

    border-bottom: 4px solid var(--kpf-gold);
}

/*
 * IMPORTANTE:
 * Trocar este bloco pelo logo/ícone oficial já existente
 * no projeto se houver asset próprio da KPF University.
 */
.brand-logo {
    display: block;
    width: min(100%, 260px);
    height: auto;
    margin-bottom: 10px;
    object-fit: contain;
}

.brand-name {
    margin: 0;

    font-size: 34px;
    line-height: 1;
    font-weight: 800;

    letter-spacing: 5px;
}

.brand-university {
    margin-top: 9px;

    color: var(--kpf-gold-soft);

    font-size: 14px;
    font-weight: 600;
    letter-spacing: 5px;

    text-transform: uppercase;
}

.login-content {
    padding: 42px 40px 34px;
}

.login-title {
    margin: 0 0 7px;

    text-align: center;

    color: var(--text-primary);

    font-size: 25px;
    line-height: 1.2;
    font-weight: 750;
}

.login-subtitle {
    margin: 0 0 32px;

    text-align: center;

    color: var(--text-secondary);

    font-size: 14px;
}

/* =========================================================
   FORM
========================================================= */

.form-group {
    margin-bottom: 18px;
}

.input-wrap {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 17px;
    top: 50%;
    z-index: 2;

    transform: translateY(-50%);

    width: 21px;
    height: 21px;

    color: var(--kpf-gold-soft);

    pointer-events: none;

    transition: color .18s ease;
}

.login-page .form-control {
    display: block;

    width: 100%;
    height: 58px;

    padding: 0 48px 0 53px;

    background: var(--kpf-blue);

    border: 1.5px solid #d2ad5d;
    border-radius: 10px;

    outline: none;

    color: #f3f7fc;

    font-size: 15px;

    transition:
        border-color .18s ease,
        box-shadow .18s ease,
        transform .18s ease;
}

.login-page .form-control::placeholder {
    color: #b5c3d2;
}

.login-page .form-control:focus {
    border-color: var(--kpf-gold);
    background: var(--kpf-blue);

    box-shadow:
        0 0 0 4px rgba(213, 161, 60, .12);

    transform: translateY(-1px);
}

.input-wrap:focus-within .input-icon {
    color: var(--kpf-gold-soft);
}

.input-wrap:focus-within .password-toggle {
    color: #b5c3d2;
}

.login-page .form-control:-webkit-autofill,
.login-page .form-control:-webkit-autofill:hover {
    -webkit-text-fill-color: #f3f7fc;
    caret-color: #f3f7fc;
    -webkit-box-shadow: 0 0 0 1000px var(--kpf-blue) inset;
    box-shadow: 0 0 0 1000px var(--kpf-blue) inset;
}

.login-page .form-control:-webkit-autofill:focus {
    -webkit-text-fill-color: #f3f7fc;
    caret-color: #f3f7fc;
    -webkit-box-shadow:
        0 0 0 1000px var(--kpf-blue) inset,
        0 0 0 4px rgba(213, 161, 60, .12);
    box-shadow:
        0 0 0 1000px var(--kpf-blue) inset,
        0 0 0 4px rgba(213, 161, 60, .12);
}

.password-toggle {
    position: absolute;
    right: 15px;
    top: 50%;
    z-index: 2;

    transform: translateY(-50%);

    display: flex;
    align-items: center;
    justify-content: center;

    width: 32px;
    height: 32px;

    padding: 0;

    border: 0;
    background: transparent;

    color: #b5c3d2;

    cursor: pointer;
}

.login-options {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    margin: 4px 0 25px;

    font-size: 14px;
}

.remember {
    display: inline-flex;
    align-items: center;
    gap: 9px;

    color: var(--text-primary);

    cursor: pointer;
}

.remember input {
    width: 17px;
    height: 17px;

    accent-color: var(--kpf-navy);
}

.forgot-link {
    color: var(--text-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.login-page .forgot-link:hover,
.login-page .forgot-link:focus-visible {
    color: #0759bd;
}

/* =========================================================
   BUTTONS
========================================================= */

.btn-login {
    width: 100%;
    height: 62px;

    display: flex;
    align-items: center;
    justify-content: center;

    position: relative;

    border: 0;
    border-radius: 999px;

    color: var(--kpf-gold-soft);

    background:
        linear-gradient(
            110deg,
            #041a31 0%,
            #06365d 100%
        );

    font-size: 18px;
    font-weight: 750;

    cursor: pointer;

    box-shadow:
        0 12px 25px rgba(3, 27, 51, .20);

    transition:
        transform .18s ease,
        box-shadow .18s ease,
        background .18s ease;
}

.btn-login:hover {
    transform: translateY(-2px);

    box-shadow:
        0 16px 30px rgba(3, 27, 51, .28);
}

.btn-login-arrow {
    position: absolute;
    right: 25px;

    font-size: 30px;
    font-weight: 300;

    line-height: 1;
}

.access-divider {
    display: flex;
    align-items: center;
    gap: 14px;

    margin: 18px 0 15px;

    color: #8b929c;

    font-size: 12px;
}

.access-divider::before,
.access-divider::after {
    content: "";

    flex: 1;

    height: 1px;

    background: #e1e4e8;
}

.btn-manager {
    width: 100%;
    height: 52px;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 11px;

    border: 1.5px solid #7a8798;
    border-radius: 999px;

    color: var(--text-primary);
    background: #fff;

    font-size: 14px;
    font-weight: 600;

    text-decoration: none;

    transition:
        color .18s ease,
        border-color .18s ease,
        background .18s ease,
        transform .18s ease;
}

.btn-manager:hover {
    color: var(--kpf-navy);
    border-color: var(--kpf-gold);

    background: #fffdf8;

    transform: translateY(-1px);
}

.manager-icon {
    color: var(--kpf-gold);
}

.secure-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;

    margin-top: 23px;

    color: #85909f;

    font-size: 11px;
}

/* =========================================================
   ERROS
========================================================= */

.login-error {
    margin-bottom: 20px;
    padding: 11px 14px;

    color: #a52a2a;
    background: #fff3f3;

    border: 1px solid #f1c4c4;
    border-radius: 8px;

    font-size: 13px;
}

/* =========================================================
   MONITOR / CARROSSEL
========================================================= */

.visual-area {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: center;

    min-width: 0;
}

.monitor {
    position: relative;

    flex: 0 0 auto;
    width: min(
        calc(100% + clamp(60px, calc(50vw - 530px), 430px)),
        1350px,
        calc(150vh - 120px)
    );
    max-width: none;

    aspect-ratio: 1.50;

    transform: translateX(
        clamp(12px, calc(10vw - 80px), 80px)
    );

    filter:
        drop-shadow(0 35px 36px rgba(0, 0, 0, .33));
}

/*
 * Área onde as imagens aparecem.
 *
 * Os percentuais abaixo servem para encaixar o carousel
 * dentro da tela transparente do pc.png.
 *
 * Se necessário, o Codex deve fazer apenas ajuste fino
 * destes quatro números olhando o asset real.
 */
.monitor-screen {
    position: absolute;

    z-index: 1;

    left: calc(13.9% - 1px);
    top: calc(7.6% - 1px);

    width: calc(72.1% + 2px);
    height: calc(56.4% + 2px);

    overflow: hidden;

    background: #06182c;
}

.carousel-track {
    position: relative;

    width: 100%;
    height: 100%;
}

.carousel-slide {
    position: absolute;
    inset: 0;

    width: 100%;
    height: 100%;

    object-fit: cover;

    opacity: 0;

    transform: scale(1.015);

    transition:
        opacity .75s ease,
        transform 5.8s ease;
}

.carousel-slide.is-active {
    opacity: 1;
    transform: scale(1);
}

.monitor-frame {
    position: absolute;
    inset: 0;

    z-index: 2;

    width: 100%;
    height: 100%;

    object-fit: contain;

    pointer-events: none;

    user-select: none;
}

.carousel-dots {
    position: absolute;

    z-index: 3;

    left: 50%;
    bottom: 28.5%;

    transform: translateX(-50%);

    display: flex;
    align-items: center;
    gap: 11px;
}

.carousel-dot {
    width: 7px;
    height: 7px;

    padding: 0;

    border: 0;
    border-radius: 50%;

    background: rgba(255, 255, 255, .65);

    cursor: pointer;

    transition:
        width .2s ease,
        border-radius .2s ease,
        background .2s ease;
}

.carousel-dot.is-active {
    width: 25px;

    border-radius: 999px;

    background: var(--kpf-gold);
}

/* =========================================================
   RESPONSIVO
========================================================= */

@media (min-width: 1500px) {
    .visual-area {
        justify-content: flex-end;
    }

    .monitor {
        transform: translateX(
            calc(64px - min(8vw, 170px) + 10.8%)
        );
    }
}

@media (min-width: 1628px) {
    .monitor {
        transform: translateX(
            calc(50vw - 750px - min(8vw, 170px) + 10.8%)
        );
    }
}

@media (min-width: 1500px) and (max-width: 1900px) {
    .monitor {
        width: min(
            calc(
                100%
                + clamp(60px, calc(50vw - 530px), 430px)
                - clamp(40px, calc(325px - 15vw), 100px)
            ),
            1350px,
            calc(150vh - 120px)
        );
    }
}

@media (max-width: 1180px) {
    .login-page {
        padding: 32px;
    }

    .login-layout {
        grid-template-columns:
            minmax(360px, 440px)
            minmax(480px, 1fr);

        gap: 35px;
    }

    .monitor {
        width: 100%;
        max-width: 890px;
        transform: none;
    }
}

@media (max-width: 960px) {
    body {
        background-position: center;
    }

    .login-page {
        padding: 28px 20px;
    }

    .login-layout {
        display: block;

        width: min(470px, 100%);
    }

    .visual-area {
        display: none;
    }
}

@media (max-width: 520px) {
    .login-page {
        padding: 18px 14px;
    }

    .login-card {
        border-radius: 18px;
    }

    .login-brand {
        min-height: 155px;
        padding: 26px;
    }

    .brand-mark {
        width: 60px;
        height: 60px;

        font-size: 28px;
    }

    .brand-name {
        font-size: 28px;
    }

    .brand-university {
        font-size: 12px;
    }

    .login-content {
        padding: 31px 24px 26px;
    }

    .login-title {
        font-size: 22px;
    }

    .login-options {
        align-items: flex-start;
        gap: 12px;

        font-size: 13px;
    }
}

body:has(.login-page) footer,
body:has(.login-page) .switch-mode {
    display: none;
}

.login-page .form-control.is-invalid {
    border-color: #cf3342;
    background-image: none;
}

.login-page .form-control.is-invalid:focus {
    box-shadow: 0 0 0 4px rgba(207, 51, 66, .12);
}

.login-page .form-control.is-invalid:-webkit-autofill:focus {
    -webkit-box-shadow:
        0 0 0 1000px var(--kpf-blue) inset,
        0 0 0 4px rgba(207, 51, 66, .12);
    box-shadow:
        0 0 0 1000px var(--kpf-blue) inset,
        0 0 0 4px rgba(207, 51, 66, .12);
}

/* Keep the light login form stable when Backpack has dark mode selected. */
body:has(.login-page) .login-page input.form-control:not(:disabled),
body:has(.login-page) .login-page input.form-control:not(:disabled):focus,
body:has(.login-page) .login-page input.form-control:not(:disabled):hover {
    color: #f3f7fc !important;
    background-color: var(--kpf-blue) !important;
    -webkit-text-fill-color: #f3f7fc !important;
}

body:has(.login-page) .login-page input.form-control:-webkit-autofill,
body:has(.login-page) .login-page input.form-control:-webkit-autofill:hover {
    -webkit-text-fill-color: #f3f7fc !important;
    caret-color: #f3f7fc !important;
    -webkit-box-shadow: 0 0 0 1000px var(--kpf-blue) inset !important;
    box-shadow: 0 0 0 1000px var(--kpf-blue) inset !important;
}

body:has(.login-page) .login-page input.form-control:-webkit-autofill:focus {
    -webkit-box-shadow:
        0 0 0 1000px var(--kpf-blue) inset,
        0 0 0 4px rgba(213, 161, 60, .12) !important;
    box-shadow:
        0 0 0 1000px var(--kpf-blue) inset,
        0 0 0 4px rgba(213, 161, 60, .12) !important;
}

body:has(.login-page) .login-page a.forgot-link,
body:has(.login-page) .login-page a.forgot-link:visited {
    color: #102238 !important;
}

body:has(.login-page) .login-page a.forgot-link:hover,
body:has(.login-page) .login-page a.forgot-link:focus-visible {
    color: #0759bd !important;
}

@media (prefers-reduced-motion: reduce) {
    .carousel-slide,
    .btn-login,
    .form-control {
        transition: none;
    }
}
