﻿
/* --- 1. Reset --- */
*, *::before, *::after {
    box-sizing: border-box;
}

:where(*:not(dialog, [popover])) {
    margin: 0;
}

:where(html) {
    scrollbar-gutter: stable;
    color-scheme: light;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    overflow-x: clip;
}

:where(body) {
    max-inline-size: 100%;
    min-block-size: 100dvh;
    line-height: 1.5;
    font-family: "Inter", sans-serif;
}

/* --- 2. Tipografia --- */
:where(h1, h2, h3, h4, h5, h6) {
    text-wrap: balance;
    overflow-wrap: break-word;
}

:where(p) {
    text-wrap: pretty;
    overflow-wrap: break-word;
}

:where(ol, ul) {
    list-style: none;
    margin: 0;
    padding: 0;
}

:where(a) {
    text-decoration-skip-ink: auto;
    text-underline-offset: 0.2ex;
}

:where(hr) {
    border: none;
    border-block-start: 1px solid;
    color: inherit;
}

:where(code, kbd, samp, pre) {
    font-size: 0.875em;
}

/* --- 3. Mídia --- */
:where(img, picture, video, canvas, svg) {
    display: block;
    max-inline-size: 100%;
    block-size: auto;
}

/* --- 4. Formulários --- */
:where(input, button, textarea, select) {
    font: inherit;
    letter-spacing: inherit;
    word-spacing: inherit;
    color: currentColor;
}

:where(textarea, select, input) {
    max-inline-size: 100%;
}

:where(button) {
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}

:where(button:disabled) {
    cursor: not-allowed;
}

/* --- 5. Utilitários --- */
.flex {
    display: flex;
}

.flex-column {
    display: flex;
    flex-direction: column;
}

.align-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.mt-1 {
    margin-top: 1rem;
}

/* --- 6. Tokens --- */
:root {
    --blue-600: #2563eb;
    --blue-700: #1d4ed8;
    --navy-900: #0f1f4b;
    --sky-50: #f1f6ff;
    --sky-100: #dce8ff;
    --amber-500: #f5a524;
    --slate-700: #334155;
    --slate-500: #64748b;
}

/* --- 7. Layout principal --- */

main {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 1rem;
    background-color: #f8f8f8;
}

.login-main-wrapper {
    display: grid;
    grid-template-columns: minmax(0, 45fr) minmax(0, 55fr);
    gap: 1rem;
    height: calc(100vh - 2rem);
    height: calc(100dvh - 2rem);
    min-height: 0;
}

.login-visual {
    position: relative;
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    isolation: isolate;
    border-radius: 2rem;
    background-color: #c3d9ff;
    color: var(--navy-900);
}

/* Texto sobre a ilustração */
.login-visual-copy {
    position: relative;
    z-index: 2;
    max-width: 32rem;
    padding: clamp(1.5rem, 3vw, 2.75rem);
}

    .login-visual-copy h2 {
        max-width: 26rem;
        font-size: clamp(1.8rem, 2.7vw, 2.5rem);
        font-weight: 800;
        line-height: 1.12;
        letter-spacing: -0.035em;
        text-wrap: balance;
    }

    .login-visual-copy p {
        max-width: 25rem;
        margin-top: 1rem;
        font-size: clamp(0.9rem, 1.1vw, 1rem);
        font-weight: 500;
        line-height: 1.6;
        color: #0f1f4bcc;
    }

/* A área da imagem cobre toda a coluna */
.login-visual-stage {
    position: absolute;
    z-index: 1;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

/* A imagem ocupa o painel inteiro */
.login-visual-img {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    object-position: center center;
}

/* Responsividade */
@media (max-width: 860px) {
    main {
        min-height: 100dvh;
        height: auto;
        padding: 1rem;
    }

    .login-main-wrapper {
        display: block;
        height: auto;
        min-height: 0;
    }

    .login-visual {
        display: none;
    }

    .login-main-wrapper > section:nth-of-type(2) {
        min-height: calc(100dvh - 2rem);
    }
}

/* Ilustração extraída */
.login-visual-img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    object-position: center center;
}

/* --- 9. Coluna do formulário --- */
.login-main-wrapper > section:nth-of-type(2) {
    min-width: 0;
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem clamp(1.5rem, 4vw, 4rem);
    border-radius: 2rem;
}

    .login-main-wrapper > section:nth-of-type(2) > img {
        width: 40px;
        height: auto;
        object-fit: contain;
    }

.login-welcome-wrapper {
    width: 100%;
    gap: 0.15rem;
    margin-top: 1.25rem;
    margin-bottom: 1.75rem;
    text-align: center;
}

    .login-welcome-wrapper h1 {
        font-size: 1.5rem;
        font-weight: 700;
        letter-spacing: -0.02em;
        color: var(--navy-900);
    }

    .login-welcome-wrapper p {
        font-size: 0.875rem;
        font-weight: 500;
        color: var(--slate-500);
    }

/* Campos */
.login-form-wrapper {
    width: 100%;
}

.login-input-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

    .login-input-wrapper label {
        color: var(--slate-700);
        font-weight: 600;
        font-size: 0.85rem;
    }

    .login-input-wrapper input {
        width: 100%;
        min-width: 0;
        border: 1px solid #33415530;
        border-radius: 0.6rem;
        background-color: #ffffff;
        color: #0f172a;
        font-size: 0.875rem;
        padding: 0.7rem 0.85rem;
        transition: border-color 160ms ease, box-shadow 160ms ease;
    }

        .login-input-wrapper input::placeholder {
            color: var(--slate-500);
            opacity: 1;
        }

        .login-input-wrapper input:focus {
            outline: none;
            border-color: var(--blue-600);
            box-shadow: 0 0 0 3px rgb(37 99 235 / 22%);
        }

        .login-input-wrapper input:-webkit-autofill,
        .login-input-wrapper input:-webkit-autofill:hover,
        .login-input-wrapper input:-webkit-autofill:focus,
        .login-input-wrapper input:autofill {
            -webkit-box-shadow: 0 0 0 1000px #ffffff inset;
            -webkit-text-fill-color: #0f172a;
        }

/* Esqueci minha senha */
.login-forget-password-wrapper {
    display: flex;
    justify-content: flex-end;
    width: 100%;
}

#login-forget-password {
    color: var(--blue-600);
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: underline;
    text-align: right;
    cursor: pointer;
}

    #login-forget-password:hover {
        color: var(--blue-700);
    }

/* Botão de login */
.login-submit-button {
    width: 100%;
    min-height: 48px;
    margin-top: 1.25rem;
    padding: 0.75rem 1rem;
    border: 1px solid transparent;
    border-radius: 0.6rem;
    background-color: var(--blue-600);
    color: #ffffff;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 5px rgb(29 78 216 / 20%);
    transition: background-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.professor-login .login-submit-button {
    background-color: #176B50;
    box-shadow: 0 2px 5px rgb(23 107 80 / 20%);
}

.login-submit-button:hover {
    background-color: var(--blue-700);
    box-shadow: 0 6px 14px rgb(29 78 216 / 26%);
    transform: translateY(-1px);
}

.professor-login .login-submit-button:hover {
    background-color: #12543E;
    box-shadow: 0 6px 14px rgb(23 107 80 / 26%);
}

.login-submit-button:active {
    box-shadow: 0 1px 3px rgb(29 78 216 / 22%);
    transform: translateY(0);
}

.login-submit-button:focus-visible {
    outline: 3px solid rgb(37 99 235 / 35%);
    outline-offset: 3px;
}

/* Mensagens de suporte */
.login-support {
    width: 100%;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
    color: var(--slate-500);
    font-size: 0.8rem;
    line-height: 1.5;
    text-align: center;
}

    .login-support a {
        display: inline-block;
        margin-top: 0.2rem;
        color: var(--blue-700);
        font-size: 0.9rem;
        font-weight: 600;
        text-decoration: none;
        transition: color 160ms ease;
    }

        .login-support a:hover {
            color: #1e3a8a;
            text-decoration: underline;
        }

        .login-support a:focus-visible {
            outline: 3px solid rgb(37 99 235 / 30%);
            outline-offset: 3px;
            border-radius: 2px;
        }

/* Seleção de escola */
.login-school-selector {
    width: 100%;
    margin-top: 1.25rem;
}

.choose-school-title {
    margin-bottom: 0.75rem;
    color: var(--navy-900);
    font-size: 1.1rem;
    font-weight: 700;
}

.login-school-search {
    width: 100%;
    margin-bottom: 1rem;
}

.school-item {
    width: 100%;
    margin-top: 0.75rem;
}

    .school-item li {
        margin-top: 0.5rem;
    }

    .school-item input[type="radio"] {
        margin-right: 0.5rem;
        accent-color: var(--blue-600);
    }

.login-school-empty {
    display: block;
    margin-top: 0.75rem;
    color: #b91c1c;
    font-size: 0.85rem;
}

/* --- 10. Responsividade --- */
@media (max-width: 860px) {
    main {
        min-height: 100dvh;
        padding: 1rem;
    }

    .login-main-wrapper {
        display: block;
        min-height: auto;
    }

    .login-visual {
        display: none;
    }

    .login-main-wrapper > section:nth-of-type(2) {
        width: 100%;
        min-height: calc(100dvh - 2rem);
        padding: 2.5rem clamp(1.25rem, 6vw, 3rem);
    }
}

@media (max-width: 400px) {
    main {
        padding: 0.5rem;
    }

    .login-main-wrapper > section:nth-of-type(2) {
        min-height: calc(100dvh - 1rem);
        padding: 2rem 1rem;
        border-radius: 1.25rem;
    }

    .login-welcome-wrapper h1 {
        font-size: 1.35rem;
    }
}

/* --- 11. Acessibilidade --- */
@media (prefers-reduced-motion: reduce) {
    .login-submit-button,
    .login-support a,
    .login-input-wrapper input {
        transition: none;
    }
}

/* Seleção de escola */
.login-school-selector {
    width: 100%;
    margin-top: 1.25rem;
}

.choose-school-title {
    margin-bottom: 0.75rem;
    color: var(--navy-900);
    font-size: 1.1rem;
    font-weight: 700;
}

.login-school-search {
    width: 100%;
    margin-bottom: 1rem;
}

.login-school-empty {
    display: block;
    margin-top: 0.75rem;
    color: #b91c1c;
    font-size: 0.85rem;
}

/* Lista de escolas */
.school-item {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    width: 100%;
    max-height: 280px;
    margin-top: 0.75rem;
    padding: 0.4rem;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 0.85rem;
    background: #ffffff;
    scrollbar-width: thin;
    scrollbar-color: #bfd3fb transparent;
}

    .school-item > li {
        position: relative;
        margin: 0;
    }

    /* O input real continua no DOM para teclado e postback, mas invisível */
    .school-item input[type="radio"] {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: 0;
        opacity: 0;
        pointer-events: none;
    }

    /* A linha inteira é o alvo de clique */
    .school-item label {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        width: 100%;
        margin: 0;
        padding: 0.75rem 0.9rem;
        border: 1px solid transparent;
        border-radius: 0.65rem;
        color: #1e293b;
        font-size: 0.875rem;
        font-weight: 500;
        line-height: 1.4;
        cursor: pointer;
        transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
    }

        /* Indicador circular à direita */
        .school-item label::after {
            content: "";
            flex: 0 0 18px;
            width: 18px;
            height: 18px;
            border: 2px solid #94a3b8;
            border-radius: 50%;
            background-color: #ffffff;
            transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
        }

        .school-item label:hover {
            background-color: #f8fbff;
            border-color: #e2e8f0;
        }

    /* Escola selecionada */
    .school-item > li:has(input[type="radio"]:checked) label {
        background-color: #eff6ff;
        border-color: #bfdbfe;
        color: var(--navy-900);
        font-weight: 600;
    }

        .school-item > li:has(input[type="radio"]:checked) label::after {
            border-color: var(--blue-600);
            background-color: var(--blue-600);
            box-shadow: inset 0 0 0 4px #ffffff;
        }

    /* Foco acessível pelo teclado */
    .school-item input[type="radio"]:focus-visible + label {
        outline: 3px solid rgb(37 99 235 / 30%);
        outline-offset: 2px;
    }

@media (max-width: 860px) {
    .school-item {
        max-height: 40dvh;
    }
}

@media (prefers-reduced-motion: reduce) {
    .school-item label,
    .school-item label::after {
        transition: none;
    }
}

/* Esqueci minha senha (inline) */
.login-recovery {
    width: 100%;
}

    .login-recovery .login-form-wrapper {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

.login-forgot-link,
.login-back-link {
    color: var(--blue-600);
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: underline;
    cursor: pointer;
}

    .login-forgot-link:hover,
    .login-back-link:hover {
        color: var(--blue-700);
    }

.login-back-link {
    display: block;
    margin-top: 1.25rem;
    text-align: center;
}

.login-success {
    display: block;
    margin-top: 0.75rem;
    padding: 0.75rem 0.9rem;
    border-radius: 0.6rem;
    background-color: #eff6ff;
    color: var(--navy-900);
    font-size: 0.85rem;
    line-height: 1.5;
}
