/* --- RESET E ESTILOS GLOBAIS --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    letter-spacing: 0;
}

html {
    height: 100%;
    overflow: hidden;
}

:root {
    --login-blue: #0057b8;
    --login-blue-strong: #004b93;
    --login-blue-bright: #0783ed;
    --login-text: #071739;
    --login-muted: #52637d;
    --login-border: #d8e4f2;
    --login-shadow: rgba(9, 42, 84, 0.16);
}

body {
    position: relative;
    isolation: isolate;
    height: 100dvh;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    overflow-x: hidden;
    color: var(--login-text);
    background: #edf7ff;
    font-family: 'Manrope', Arial, Helvetica, sans-serif;
}

body,
button,
input,
label,
.logo span,
.title h2,
.title p,
.form-group label,
.password-header label,
.password-header a,
.remember span,
.divider span,
.gov-btn,
.btn-login,
.security span,
.footer-left,
.footer-right a {
    font-family: 'Manrope', Arial, Helvetica, sans-serif !important;
}

body::before {
    content: "";
    position: fixed;
    inset: -18px;
    z-index: -2;
    background-image: url('../img/login-background.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(2px);
    transform: scale(1.02);
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(circle at 92% 0%, rgba(21, 132, 239, 0.22) 0 12%, transparent 30%),
        radial-gradient(circle at 7% 24%, rgba(23, 118, 216, 0.11) 0 11%, transparent 27%),
        linear-gradient(115deg, rgba(255, 255, 255, 0.86) 0%, rgba(255, 255, 255, 0.76) 50%, rgba(235, 247, 255, 0.66) 100%);
}

/* --- ESTRUTURA DO LAYOUT --- */
.container {
    position: relative;
    flex: 1;
    width: 100%;
    min-height: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: clamp(16px, 3.8vh, 34px) 22px clamp(14px, 3vh, 28px);
}

.container::before,
.container::after {
    content: "";
    position: absolute;
    z-index: -1;
    opacity: 0.46;
    pointer-events: none;
}

.container::before {
    width: 150px;
    height: 150px;
    top: 12%;
    left: 8%;
    border-radius: 34px;
    background:
        linear-gradient(rgba(11, 101, 177, 0.08), rgba(11, 101, 177, 0.08)) center / 44px 150px no-repeat,
        linear-gradient(rgba(11, 101, 177, 0.08), rgba(11, 101, 177, 0.08)) center / 150px 44px no-repeat;
}

.container::after {
    width: 118px;
    height: 118px;
    right: 7%;
    top: 27%;
    border-radius: 28px;
    background:
        linear-gradient(rgba(11, 101, 177, 0.07), rgba(11, 101, 177, 0.07)) center / 34px 118px no-repeat,
        linear-gradient(rgba(11, 101, 177, 0.07), rgba(11, 101, 177, 0.07)) center / 118px 34px no-repeat;
}

.login-wrapper {
    width: calc(100vw - 32px);
    max-width: 510px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: loginFadeIn 0.55s ease both;
}

@keyframes loginFadeIn {
    from {
        opacity: 1;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- ÁREA DA LOGO --- */
.logo {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    margin-bottom: clamp(10px, 2.2vh, 20px);
}

.logo img {
    height: clamp(50px, 8vh, 70px);
    width: auto;
    display: block;
    object-fit: contain;
}

.logo h1 {
    color: var(--login-blue-strong);
    font-size: 54px;
    font-weight: 700;
    line-height: 1;
}

.logo span {
    display: block;
    color: #08214a;
    font-size: clamp(18px, 2.8vh, 24px);
    font-weight: 800;
    line-height: 1;
}

.logo strong {
    color: #12a9ea;
}

.logo p {
    margin-top: 10px;
    color: var(--login-muted);
    font-size: 16px;
}

/* --- CARD DO FORMULÁRIO --- */
.card {
    width: 100%;
    min-width: 0;
    position: relative;
    overflow: hidden;
    padding: clamp(26px, 4.2vh, 40px) clamp(28px, 4.6vw, 46px) clamp(24px, 3.9vh, 38px);
    border: 1px solid rgba(207, 222, 239, 0.78);
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.91);
    box-shadow:
        0 28px 80px var(--login-shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(18px);
}

.card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0));
}

.card > * {
    position: relative;
}

/* Oculta visualmente a aba antiga sem remover o componente do template. */
.tab {
    display: none;
}

.title {
    max-width: 420px;
    margin: 0 auto clamp(16px, 2.4vh, 22px);
    text-align: center;
}

.title::after {
    content: "";
    display: block;
    width: 172px;
    height: 1px;
    margin: clamp(14px, 2.2vh, 22px) auto 0;
    background: linear-gradient(90deg, transparent, #dce7f3, transparent);
}

.title h2 {
    color: #071b46;
    font-size: clamp(24px, 3.3vh, 30px);
    font-weight: 800;
    line-height: 1.16;
    margin-bottom: 10px;
    overflow-wrap: break-word;
}

.title p {
    color: #365074;
    font-size: clamp(14px, 1.9vh, 16px);
    font-weight: 600;
    line-height: 1.55;
    overflow-wrap: break-word;
}

/* --- CAMPOS DE ENTRADA --- */
.form-group {
    margin-top: clamp(13px, 2vh, 18px);
}

.form-group label,
.password-header label {
    display: block;
    margin-bottom: clamp(7px, 1.1vh, 9px);
    color: #071b46;
    font-size: 15px;
    font-weight: 800;
}

.input-box {
    position: relative;
}

.input-box i {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: #7287a2;
    font-size: 18px;
    transition: color 0.22s ease;
}

.input-box input {
    width: 100%;
    height: clamp(48px, 6vh, 54px);
    border: 1px solid var(--login-border);
    border-radius: 13px;
    padding: 0 18px 0 54px;
    color: #12223c;
    background: rgba(255, 255, 255, 0.88);
    box-shadow:
        inset 0 1px 2px rgba(8, 33, 74, 0.04),
        0 8px 22px rgba(6, 42, 89, 0.04);
    font-size: 16px;
    font-weight: 600;
    outline: none;
    transition: border-color 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
    min-width: 0;
}

.input-box input::placeholder {
    color: #7d90aa;
}

.input-box input:focus {
    border-color: var(--login-blue-bright);
    background: #fff;
    box-shadow:
        0 0 0 4px rgba(7, 131, 237, 0.13),
        inset 0 1px 2px rgba(8, 33, 74, 0.04);
}

.input-box:focus-within i {
    color: var(--login-blue);
}

.password-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: clamp(7px, 1.1vh, 9px);
}

.password-header a {
    color: #0076f3;
    text-decoration: none;
    font-size: 15px;
    font-weight: 700;
    transition: color 0.22s ease;
}

.password-header a:hover {
    color: var(--login-blue-strong);
}

.remember {
    margin: clamp(11px, 1.8vh, 16px) 0 clamp(12px, 2vh, 18px);
    display: flex;
    align-items: center;
    gap: 10px;
    color: #51627d;
    font-size: 15px;
    font-weight: 700;
}

.remember input {
    width: 18px;
    height: 18px;
    accent-color: var(--login-blue);
    cursor: pointer;
}

/* --- BOTÕES E DIVISORES --- */
.btn-login {
    width: 100%;
    height: clamp(48px, 6vh, 54px);
    border: none;
    border-radius: 13px;
    background: linear-gradient(135deg, #004b93 0%, #006ed8 100%);
    color: #fff;
    box-shadow: 0 16px 30px rgba(0, 87, 184, 0.28);
    font-size: 20px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    white-space: normal;
}

.btn-login:hover {
    transform: translateY(-1px);
    filter: brightness(1.03);
    box-shadow: 0 20px 36px rgba(0, 87, 184, 0.34);
}

.btn-login:active {
    transform: translateY(1px);
    box-shadow: 0 10px 22px rgba(0, 87, 184, 0.25);
}

.btn-login i {
    margin-left: 6px;
}

.divider {
    display: flex;
    align-items: center;
    gap: 18px;
    margin: clamp(12px, 2.1vh, 21px) 0;
    color: #7a8da7;
    font-size: 14px;
    font-weight: 800;
}

.divider::before,
.divider::after {
    content: "";
    flex: 1;}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(8, 20, 42, 0.68);
    padding: 16px;
}

.modal-card {
    width: min(520px, 100%);
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.26);
    border: 1px solid rgba(26, 52, 83, 0.08);
    padding: 32px;
    text-align: center;
}

.modal-card h3 {
    margin-bottom: 14px;
    color: #08214a;
    font-size: 26px;
    font-weight: 800;
}

.modal-card p {
    color: #47596f;
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 18px;
}

.fake-code {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 0.35em;
    color: #004b93;
    margin: 0 auto 20px;
    padding: 12px 18px;
    background: #eaf3ff;
    border-radius: 14px;
    width: max-content;
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 10px;
}

.modal-form label {
    text-align: left;
    color: #28354f;
    font-weight: 800;
    font-size: 14px;
}

.modal-form input {
    width: 100%;
    height: 52px;
    border-radius: 12px;
    border: 1px solid rgba(112, 135, 166, 0.22);
    padding: 0 16px;
    font-size: 18px;
    font-weight: 700;
}

.modal-error {
    background: rgba(255, 213, 213, 0.85);
    color: #8c1e24;
    border-radius: 14px;
    padding: 12px 16px;
    margin-bottom: 12px;
}

.modal-note {
    margin-top: 16px;
    color: #62738b;
    font-size: 14px;
}
    height: 1px;
    background: linear-gradient(90deg, transparent, #d9e4f1);
}

.divider::after {
    background: linear-gradient(90deg, #d9e4f1, transparent);
}

.divider span {
    padding: 0;
}

.gov-btn {
    width: 100%;
    height: clamp(48px, 5.8vh, 52px);
    border: 1.5px solid #0875e7;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.82);
    color: #071b46;
    box-shadow: 0 10px 22px rgba(6, 42, 89, 0.05);
    cursor: pointer;
    font-size: 18px;
    font-weight: 800;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    white-space: normal;
}

.gov-btn:hover {
    transform: translateY(-1px);
    border-color: var(--login-blue-strong);
    background: #fff;
    box-shadow: 0 14px 28px rgba(6, 42, 89, 0.09);
}

.gov-btn:active {
    transform: translateY(1px);
}

.register {
    text-align: center;
    margin-top: 25px;
    color: var(--login-muted);
}

.register a {
    color: var(--login-blue);
    text-decoration: none;
    font-weight: 700;
}

.security {
    margin-top: clamp(12px, 2.2vh, 22px);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
    color: #697d99;
    font-size: 15px;
    font-weight: 800;
}

.security span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 22px;
}

.security span + span {
    border-left: 1px solid rgba(105, 125, 153, 0.35);
}

.security i {
    color: #667b96;
}

/* --- RODAPÉ DA PÁGINA --- */
.footer {
    position: relative;
    z-index: 1;
    border-top: 1px solid rgba(216, 228, 242, 0.7);
    background: rgba(255, 255, 255, 0.42);
    backdrop-filter: blur(10px);
    padding: clamp(9px, 1.7vh, 16px) 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.footer-left {
    color: #5b6c85;
    font-size: 14px;
    font-weight: 600;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.footer-right {
    display: flex;
    gap: 25px;
    max-width: 100%;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-right a {
    color: #5b6c85;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    transition: color 0.22s ease;
}

.footer-right a:hover {
    color: var(--login-blue);
}

/* --- BOTÃO FLUTUANTE DE VOLTAR --- */
.btn-voltar {
    position: fixed;
    top: 22px;
    left: 22px;
    width: 46px;
    height: 46px;
    border: 1px solid rgba(255, 255, 255, 0.58);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.78);
    color: var(--login-blue-strong);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.24s ease, box-shadow 0.24s ease, background 0.24s ease;
    z-index: 1000;
    box-shadow: 0 12px 28px rgba(7, 49, 104, 0.13);
    backdrop-filter: blur(10px);
}

.btn-voltar:hover {
    background: #fff;
    transform: translateX(-3px);
    box-shadow: 0 16px 34px rgba(7, 49, 104, 0.18);
}

.btn-voltar:active {
    transform: translateX(-1px);
}

@media (max-width: 900px) {
    .container {
        min-height: 0;
        padding: 30px 18px 24px;
    }

    .login-wrapper {
        max-width: 520px;
    }

    .container::before {
        left: -34px;
        top: 7%;
    }

    .container::after {
        right: -22px;
        top: 20%;
    }
}

@media (max-width: 600px) {
    .container {
        align-items: center;
        min-height: 0;
        padding: clamp(8px, 2vh, 20px) 16px clamp(6px, 1.6vh, 16px);
    }

    .logo {
        margin-bottom: 12px;
    }

    .logo img {
        height: 58px;
    }

    .logo span {
        font-size: 20px;
    }

    .card {
        padding: 28px 22px 24px;
        border-radius: 24px;
    }

    .title {
        margin-bottom: 18px;
    }

    .title h2 {
        font-size: 27px;
    }

    .title p {
        font-size: 15px;
    }

    .title::after {
        margin-top: 16px;
    }

    .form-group {
        margin-top: 16px;
    }

    .input-box input,
    .btn-login,
    .gov-btn {
        height: 52px;
    }

    .password-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 2px;
    }

    .security {
        margin-top: 14px;
        row-gap: 10px;
    }

    .remember {
        margin: 14px 0 16px;
    }

    .divider {
        margin: 18px 0;
    }

    .security span {
        padding: 0 14px;
    }

    .footer {
        flex-direction: column;
        justify-content: center;
        text-align: center;
        padding: 14px 18px 18px;
    }

    .footer-right {
        gap: 18px;
    }

    .btn-voltar {
        top: 14px;
        left: 14px;
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}

@media (max-width: 390px) {
    .login-wrapper {
        width: calc(100vw - 24px);
    }

    .container {
        padding-left: 12px;
        padding-right: 12px;
    }

    .card {
        padding: 30px 18px 26px;
    }

    .title h2 {
        font-size: 25px;
    }

    .security {
        font-size: 13px;
    }

    .security span {
        padding: 0 8px;
        white-space: nowrap;
    }
}

@media (max-height: 740px) {
    .container {
        padding-top: 12px;
        padding-bottom: 10px;
    }

    .logo {
        margin-bottom: 12px;
    }

    .logo img {
        height: 58px;
    }

    .security {
        display: none;
    }

    .footer {
        padding-top: 7px;
        padding-bottom: 7px;
    }
}

@media (max-height: 680px) {
    .container {
        padding-top: 12px;
        padding-bottom: 10px;
    }

    .logo {
        margin-bottom: 10px;
    }

    .logo img {
        height: 50px;
    }

    .logo span {
        font-size: 19px;
    }

    .card {
        padding-top: 24px;
        padding-bottom: 22px;
    }

    .title {
        margin-bottom: 16px;
    }

    .title::after {
        margin-top: 12px;
    }

    .form-group {
        margin-top: 13px;
    }

    .input-box input,
    .btn-login,
    .gov-btn {
        height: 46px;
    }

    .remember,
    .divider {
        margin-top: 11px;
        margin-bottom: 11px;
    }

    .security {
        margin-top: 9px;
        font-size: 13px;
    }

    .footer {
        padding-top: 7px;
        padding-bottom: 7px;
    }

    .footer-left,
    .footer-right a {
        font-size: 13px;
    }
}

@media (max-height: 600px) {
    .title p,
    .title::after,
    .security {
        display: none;
    }

    .logo {
        flex-direction: row;
    }

    .logo img {
        height: 38px;
    }

    .card {
        padding-top: 18px;
        padding-bottom: 16px;
    }

    .title h2 {
        margin-bottom: 0;
        font-size: 23px;
    }

    .form-group label,
    .password-header label,
    .password-header a,
    .remember {
        font-size: 12px;
    }

    .input-box input,
    .btn-login,
    .gov-btn {
        height: 42px;
        font-size: 14px;
    }

    .footer {
        gap: 5px;
        padding: 4px 12px;
    }
}

@media (max-height: 520px) {
    .logo {
        display: none;
    }

    .card {
        padding: 14px 18px;
        border-radius: 18px;
    }

    .title {
        margin-bottom: 8px;
    }

    .title h2 {
        font-size: 20px;
    }

    .form-group {
        margin-top: 7px;
    }

    .input-box input,
    .btn-login,
    .gov-btn {
        height: 37px;
    }

    .input-box input {
        padding-left: 42px;
    }

    .input-box i {
        left: 14px;
        font-size: 15px;
    }

    .remember,
    .divider {
        margin-top: 6px;
        margin-bottom: 6px;
    }
}
