/* --- PADRÃO GERAL & DESKTOP --- */
/* Aplicamos o fundo no html e body para garantir cobertura total */
html,
body {
    font-family: Instrument Sans, ui-sans-serif, system-ui, sans-serif;
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100%;
    min-height: -webkit-fill-available;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background-color: #f1f5f9;
}

/* Removida a opacity: 0 e o background redundante que causava o fundo branco no mobile */
#auth-content-wrapper {
    width: 100%;
    height: 100%;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
    transition: opacity 0.5s ease;
}

.main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 50px;
    background-color: rgba(128, 0, 32, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 0 15px;
    box-sizing: border-box;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-icon {
    height: 35px;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.header-title-desktop,
.header-title-mobile {
    font-weight: 800;
    font-size: 1.1em;
    line-height: 1.2;
    letter-spacing: -0.5px;
}

.text-white {
    color: #ffffff;
}

.text-red {
    color: #ff4d4d;
}

.header-title-desktop {
    display: none;
}

.header-title-mobile {
    display: block;
}

.v3-footer-minimal {
    position: fixed !important;
    bottom: 20px;
    right: 30px;
    text-align: right;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.7em;
    z-index: 5;
    pointer-events: none;
}

.v3-footer-minimal strong {
    color: #ffffff;
    display: block;
    letter-spacing: 1px;
}

/* Loader */
#app-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.loader-logo {
    width: 80px;
    height: auto;
    margin-bottom: 20px;
    filter: drop-shadow(0 5px 15px rgba(128, 0, 32, 0.2));
    animation: pulse 2s infinite ease-in-out;
}

.loader-title {
    font-size: 3em;
    font-weight: 900;
    color: #800020;
    margin: 0;
    letter-spacing: -2px;
}

.loader-subtitle {
    color: #64748b;
    font-size: 0.9em;
    margin-top: 5px;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(0.95);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@media (min-width: 768px) {
    .header-title-desktop {
        display: block;
        font-size: 1.25em;
    }

    .header-title-mobile {
        display: none;
    }
}

/* Card Box */
.card-box {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    width: 400px;
    min-width: 400px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    animation: slideUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    flex-shrink: 0;
    box-sizing: border-box;
    max-height: 90vh;
    overflow-y: auto;
}

.card-box::-webkit-scrollbar {
    width: 6px;
}

.card-box::-webkit-scrollbar-thumb {
    background: rgba(128, 0, 32, 0.2);
    border-radius: 10px;
}

.main-wrapper {
    display: flex;
    flex-direction: column; /* OBRIGATÓRIO: Empilha verticalmente */
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    box-sizing: border-box;
}

/* Container que abriga a logo e o nome fora do card */
.header-login-container {
    width: 100%;
    max-width: 400px;
    margin-bottom: 25px;
    text-align: center;
    /* Força a fonte Inter em todo o cabeçalho */
    font-family: 'Inter', sans-serif;
}

.header-login-container h2 {
    margin: 5px 0 0 0;
    font-size: 2.2em;
    font-weight: 900;
    letter-spacing: -1px;
    /* Cor preta conforme solicitado */
    color: #1e293b !important; 
}

.header-login-container p {
    margin: 0;
    font-weight: 500;
    font-size: 0.95em;
    /* Cor cinza escuro para manter o contraste e legibilidade */
    color: #475569 !important; 
}

.logo-img {
    width: 90px;
    height: auto;
    margin-bottom: 20px;
    filter: drop-shadow(0 5px 15px rgba(128, 0, 32, 0.2));
}

.card-title {
    color: #1e293b;
    margin-bottom: 8px;
    font-size: 1.6em;
    font-weight: 800;
    letter-spacing: -1px;
}

.card-subtitle {
    color: #64748b;
    margin-bottom: 30px;
    font-size: 0.95em;
    font-weight: 500;
}

.input-group {
    text-align: left;
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: #475569;
    font-weight: 700;
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 14px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1em;
    box-sizing: border-box;
    transition: all 0.3s ease;
    background: #f8fafc;
    color: #1e293b;
    font-weight: 500;
}

.input-group input:focus,
.input-group select:focus {
    border-color: #800020;
    outline: none;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(128, 0, 32, 0.1);
}

.btn-login {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #800020 0%, #a00030 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.95em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 5px;
    letter-spacing: 0.5px;
}

.login-options-row {
    margin: 15px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
}

.login-remember {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #475569;
    font-size: 0.9em;
    cursor: pointer;
    margin: 0;
}

.login-remember input {
    cursor: pointer;
    transform: scale(1.1);
    margin: 0;
}

.login-forgot-link {
    color: #800020;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.login-forgot-link:hover {
    text-decoration: underline;
    color: #600018;
}

.btn-google {
    width: 100%;
    height: 45px;
    padding: 0 15px;
    background-color: #ffffff;
    color: #475569;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s;
}

.btn-google img {
    width: 18px;
    height: 18px;
}

.separator {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 15px 0;
    color: #94a3b8;
    font-size: 0.75em;
    font-weight: 700;
    text-transform: uppercase;
}

.separator::before,
.separator::after {
    content: '';
    flex: 1;
    border-bottom: 2px solid #f1f5f9;
}

.separator:not(:empty)::before {
    margin-right: 1.5em;
}

.separator:not(:empty)::after {
    margin-left: 1.5em;
}

#register-card {
    display: none;
    border-top: 5px solid #2c7399;
}

#register-card h2 {
    color: #2c7399;
    font-weight: 900;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- CORREÇÃO MOBILE DEFINITIVA --- */
@media (max-width: 767px) {
    html,
    body {
        position: relative;
        overflow-x: hidden;
        overflow-y: auto;
        min-height: 100%;
        min-height: -webkit-fill-available;
        width: 100%;
    }

    #auth-content-wrapper {
        background: transparent !important;
        min-height: 100%;
        width: 100%;
    }

    .main-wrapper {
        padding: 20px !important;
        padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)) !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        min-height: 100%;
        width: 100%;
        box-sizing: border-box;
    }

    .header-login-container {
        /* Aumenta a distância entre o título SIGMA e o topo do card */
        margin-bottom: 35px !important; 
        /* Puxa o conjunto levemente para cima para um equilíbrio visual mais agradável aos olhos */
        margin-top: -8vh !important; 
    }

    .card-box {
        width: 100% !important;
        max-width: 380px !important;
        /* Remove a trava de 70vh, permitindo que o card cresça naturalmente */
        max-height: 85vh !important; 
        overflow-y: auto !important;
        /* Mais espaço interno (padding) para os campos de CPF e Senha não ficarem sufocados */
        padding: 40px 25px !important; 
        border-radius: 24px !important; /* Bordas um pouco mais arredondadas para sofisticação */
        margin: 0 !important;
        flex-shrink: 1 !important;
    }

    .logo-img {
        /* Logo levemente maior para preencher melhor a tela do celular */
        width: 85px !important; 
    }

    .card-title {
        font-size: 1.5em !important;
    }

    /* Caso o rodapé ainda esteja no HTML, isso garante que ele suma no mobile */
    .v3-footer-minimal {
        display: none !important;
    }
}