/*
|--------------------------------------------------------------------------
| Auth - Fundo a Fundo
|--------------------------------------------------------------------------
| Telas externas: login, recuperação de senha etc.
| Preso em body.auth-body / .pagina-login para não afetar o sistema interno.
|--------------------------------------------------------------------------
*/

:root {
    --verde: #123524;
    --verde-hover: #f1f5f3;
    --verde-claro: #eef6f1;

    --amarelo: #d2a01e;
    --vermelho: #b91c1c;

    --fundo: #f4f6f8;
    --superficie: #ffffff;

    --texto: #1f2933;
    --texto-suave: #667085;

    --borda: #e5e7eb;
}

.tema-rs-clean {
    --primary: #2f6b42;
    --primary-dark: #214d30;
    --secondary: #d2a01e;
    --accent: #a3231d;

    --bg-auth: #f4f6f8;
    --surface: #ffffff;

    --text-primary: #1f2933;
    --text-secondary: #46624d;
    --text-soft: #8a8f98;
    --text-muted: #667085;
    --text-white: #ffffff;

    --border-light: #e5e7eb;

    --success-bg: #e8f5ec;
    --success: #2f6b42;

    --danger-bg: #fdecea;
    --danger: #a3231d;

    --shadow-card: 0 18px 45px rgba(0, 0, 0, 0.14);

    --portal-verde-escuro: #123524;
    --portal-verde: #2f6b42;
    --portal-amarelo: #d2a01e;
    --portal-vermelho: #a3231d;
    --portal-borda: #e5e7eb;
    --portal-suave: #667085;
}

html {
    min-height: 100%;
}

body.auth-body {
    min-height: 100vh;
    margin: 0;
    padding: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg-auth);
    color: var(--text-primary);
    overflow-x: hidden;
}

.pagina-login,
.pagina-login *,
.pagina-login *::before,
.pagina-login *::after {
    box-sizing: border-box;
}

.pagina-login {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-auth);
}

/* Área principal */

.area-principal {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 62px);
    padding: 42px 20px;
    overflow: hidden;
    background: var(--bg-auth);
}

.imagem-fundo {
    position: absolute;
    inset: 0;
    z-index: 1;
    background-image:
        url("../fundo-login.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Logo */

.logo-superior {
    position: absolute;
    top: 28px;
    right: 56px;
    z-index: 4;
    width: 132px;
    height: 132px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-superior img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Card */

.card-login {
    position: relative;
    z-index: 3;
    width: 100%;
    max-width: 416px;
    min-height: 405px;
    padding: 34px 36px 18px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(229, 231, 235, 0.95);
    border-radius: 18px;
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(6px);
    animation: auth-aparecer 0.55s ease;
}

.cabecalho-login {
    margin-bottom: 32px;
}

.texto-sistema {
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 3.5px;
    text-transform: uppercase;
}

.titulo {
    margin: 0 0 14px;
    color: #111111;
    font-size: 42px;
    font-weight: 600;
    line-height: 1;
}

.linha-decorativa {
    width: 170px;
    height: 4px;
    margin-bottom: 18px;
    border-radius: 999px;
    background: linear-gradient(
        90deg,
        var(--primary),
        var(--secondary),
        var(--accent)
    );
}

.subtitulo-login {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 2.8px;
    text-transform: uppercase;
}

/* Formulários */

.formulario-login {
    display: flex;
    flex-direction: column;
}

.formulario-login.oculto {
    display: none;
}

.campo {
    width: 100%;
}

.campo input {
    width: 100%;
    height: 50px;
    padding: 0 16px;
    border: 2px solid var(--border-light);
    border-radius: 9px;
    outline: none;
    background: var(--surface);
    color: var(--text-primary);
    font-size: 16px;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.035);
    transition:
        border-color 0.25s ease,
        box-shadow 0.25s ease,
        transform 0.2s ease;
}

.campo input::placeholder {
    color: var(--text-soft);
}

.campo input:focus {
    border-color: var(--primary);
    box-shadow:
        0 0 0 3px rgba(47, 107, 66, 0.12),
        0 8px 18px rgba(0, 0, 0, 0.06);
}

/* Senha */

.modal-senha {
    display: grid;
    grid-template-rows: 0fr;
    margin-top: 0;
    opacity: 0;
    transform: translateY(-8px);
    transition:
        grid-template-rows 0.45s ease,
        opacity 0.35s ease,
        transform 0.35s ease,
        margin-top 0.35s ease;
}

.modal-senha.visivel {
    grid-template-rows: 1fr;
    margin-top: 14px;
    opacity: 1;
    transform: translateY(0);
}

.modal-senha > div {
    overflow: hidden;
    padding: 3px;
    margin: -3px;
}

.caixa-senha {
    position: relative;
    width: 100%;
}

.caixa-senha input {
    padding-right: 92px;
    border-radius: 9px;
}

.alternar-senha {
    position: absolute;
    top: 50%;
    right: 8px;
    height: 34px;
    padding: 0 12px;
    border: 1px solid rgba(47, 107, 66, 0.18);
    border-radius: 7px;
    background: rgba(47, 107, 66, 0.09);
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transform: translateY(-50%);
    transition:
        background 0.25s ease,
        color 0.25s ease,
        border-color 0.25s ease,
        transform 0.2s ease;
}

.alternar-senha:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--text-white);
}

.alternar-senha:active {
    transform: translateY(-50%) scale(0.97);
}

/* Ações */

.acoes-login {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

.esqueci-senha {
    padding: 5px 8px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition:
        color 0.25s ease,
        background 0.25s ease;
}

.esqueci-senha:hover {
    background: rgba(47, 107, 66, 0.08);
    color: var(--primary);
    text-decoration: underline;
}

.botao-entrar {
    display: block;
    width: 78%;
    height: 50px;
    margin: 18px auto 0;
    border: none;
    border-bottom: 3px solid var(--primary-dark);
    border-radius: 9px;
    background: linear-gradient(180deg, #3f8f56 0%, var(--primary) 100%);
    color: var(--text-white);
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(47, 107, 66, 0.23);
    transition:
        transform 0.25s ease,
        filter 0.25s ease,
        box-shadow 0.25s ease,
        border-bottom-width 0.2s ease;
}

.botao-entrar:hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(47, 107, 66, 0.28);
}

.botao-entrar:active {
    border-bottom-width: 1px;
    transform: translateY(1px);
    box-shadow: 0 6px 14px rgba(47, 107, 66, 0.2);
}

.texto-restrito {
    margin: 12px 0 0;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
}

/* Recuperação */

.formulario-recuperar-senha {
    display: none;
}

.formulario-recuperar-senha.ativo {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.formulario-recuperar-senha .campo {
    width: 100%;
}

.formulario-recuperar-senha .botao-entrar {
    align-self: center;
    width: 78%;
    max-width: 300px;
    margin: 18px auto 0;
}

.formulario-recuperar-senha .acoes-login {
    width: 100%;
    justify-content: flex-end;
    margin-top: 12px;
}

.texto-recuperacao {
    margin: 0 0 18px;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.45;
    text-align: center;
}

/* Mensagens */

.mensagem-sucesso,
.mensagem-erro {
    padding: 12px;
    margin-bottom: 18px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
}

.mensagem-sucesso {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid #b9dfc5;
}

.mensagem-erro {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid #f5c2c0;
}

/* Rodapé novo */

.portal-rodape {
    position: relative;
    z-index: 5;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 18px;
    min-height: 62px;
    padding: 10px 24px;
    border-top: 1px solid var(--portal-borda);
    background: #ffffff;
    color: var(--portal-suave);
    font-size: 12px;
}

.portal-rodape-esquerda,
.portal-rodape-centro,
.portal-rodape-direita {
    display: flex;
    align-items: center;
    font-weight: 700;
}

.portal-rodape-esquerda {
    gap: 10px;
    justify-content: flex-start;
}

.portal-rodape-centro {
    flex-direction: column;
    gap: 2px;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
}

.portal-rodape-direita {
    justify-content: flex-end;
    text-align: right;
}

.portal-rodape strong,
.portal-rodape small {
    display: block;
}

.portal-rodape strong {
    color: var(--portal-verde-escuro);
    font-size: 0.9rem;
    line-height: 1.1;
}

.portal-rodape small {
    color: var(--portal-suave);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.25;
}

.portal-mini-bandeira {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.portal-faixa {
    display: block;
    width: 6px;
    height: 22px;
    border-radius: 999px;
}

.portal-faixa-verde {
    background: var(--portal-verde-escuro);
}

.portal-faixa-vermelha {
    background: var(--portal-vermelho);
}

.portal-faixa-amarela {
    background: var(--portal-amarelo);
}

.portal-rodape a {
    color: var(--portal-verde-escuro);
    font-weight: 800;
    text-decoration: none;
}

/* Animação */

@keyframes auth-aparecer {
    from {
        opacity: 0;
        transform: translateY(22px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsivo */

@media (max-width: 900px) {
    .logo-superior {
        right: 32px;
        width: 105px;
        height: 105px;
    }

    .portal-rodape {
        grid-template-columns: 1fr;
        justify-items: center;
        justify-content: center;
        gap: 5px;
        min-height: 72px;
        padding: 9px 16px;
        text-align: center;
    }

    .portal-rodape-esquerda,
    .portal-rodape-centro,
    .portal-rodape-direita {
        justify-content: center;
        text-align: center;
    }

    .portal-rodape-centro {
        white-space: normal;
    }

    .portal-faixa {
        width: 6px;
        height: 20px;
    }
}

@media (max-width: 600px) {
    .area-principal {
        min-height: auto;
        padding: 122px 16px 28px;
    }

    .imagem-fundo {
        background-image:
            linear-gradient(
                180deg,
                rgba(244, 246, 248, 0.82) 0%,
                rgba(244, 246, 248, 0.72) 100%
            ),
            url("/fundo-login.png");
    }

    .logo-superior {
        top: 20px;
        right: 50%;
        width: 90px;
        height: 90px;
        transform: translateX(50%);
    }

    .card-login {
        max-width: 100%;
        min-height: auto;
        padding: 30px 24px 16px;
        border-radius: 14px;
    }

    .cabecalho-login {
        margin-bottom: 28px;
    }

    .texto-sistema {
        font-size: 12px;
        letter-spacing: 3px;
    }

    .titulo {
        font-size: 42px;
    }

    .linha-decorativa {
        width: 150px;
    }

    .subtitulo-login {
        font-size: 12px;
        letter-spacing: 2px;
    }

    .campo input {
        height: 48px;
        border-radius: 8px;
        font-size: 15px;
    }

    .caixa-senha input {
        padding-right: 88px;
        border-radius: 8px;
    }

    .alternar-senha {
        right: 7px;
        height: 32px;
        padding: 0 10px;
        border-radius: 6px;
        font-size: 11px;
    }

    .botao-entrar,
    .formulario-recuperar-senha .botao-entrar {
        width: 100%;
        max-width: none;
        border-radius: 8px;
    }

    .portal-rodape {
        gap: 4px;
        min-height: auto;
        padding: 8px 12px;
    }

    .portal-rodape-esquerda {
        gap: 8px;
        font-size: 11px;
    }

    .portal-rodape-centro,
    .portal-rodape-direita {
        font-size: 10px;
    }

    .portal-rodape strong {
        font-size: 0.78rem;
    }

    .portal-rodape small {
        font-size: 0.66rem;
    }

    .portal-faixa {
        width: 6px;
        height: 17px;
    }
}