/* ===== CRITICAL CSS TO PREVENT SIDEBAR FLASH ===== */
@media (max-width: 992px) {
    .portal-sidebar {
        display: none !important;
    }
    .portal-sidebar.loaded {
        display: block !important;
        transform: translateX(-100%) !important;
    }
    .portal-sidebar.loaded:not(.collapsed) {
        transform: translateX(0) !important;
    }
}

/* ===== ESTILOS GLOBAIS ===== */

@media (min-width: 768px) {
    html {
        font-size: 16px !important;
    }
}

html {
    position: relative;
    min-height: 100%;
    overflow-x: hidden;
}

body {
    background-color: #f2f2f2;
    overflow-x: hidden;
}

.link-primary,
.link-primary:visited,
.link-primary:active {
    color: #00a1a1 !important;
    text-decoration-color: #00a1a1 !important;
}

.link-primary:hover {
    color: #007878 !important;
    text-decoration-color: #007878 !important;
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.form-floating>.form-control-plaintext::placeholder,
.form-floating>.form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating>.form-control-plaintext:focus::placeholder,
.form-floating>.form-control:focus::placeholder {
    text-align: start;
}

.input-validation-error {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(.375em + .1875rem) center;
    background-size: calc(.75em + .375rem) calc(.75em + .375rem);
    color: var(--bs-form-invalid-border-color);
}

input[type="text"].input-validation-error,
input[type="password"].input-validation-error,
label[for='arquivo'].input-validation-error {
    padding-right: calc(1.5em + .75rem);
    border: 1px solid red !important;
    border-color: var(--bs-form-invalid-border-color);
}

@keyframes lastStep {
    10%,
    90% {
        color: #80ff80;
    }

    50% {
        color: #cccccc;
    }
}

.logo {
    width: 200px;
    height: auto;
}

.titulo-com-borda {
    position: relative;
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.8rem;
}

.titulo-com-borda::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 75%;
    border-bottom: 1px solid #d9d9d9;
}

.conteudo {
    background-color: #e8e8e8;
    border: 1px solid transparent;
}

.protocolo {
    background-color: #fff;
    border-top: 1px dashed #808080;
    border-bottom: 1px dashed #808080;
    border-radius: 1rem;
}

.btnCarregar {
    background-color: #00a2ff !important;
    color: white !important;
}

.btnCarregar:hover {
    background-color: #008cdd !important;
    color: white !important;
}

.form-control:focus,
.form-select:focus,
.form-label:focus {
    box-shadow: 0 0 1px 2px rgb(255, 255, 255, 0.5) !important;
    outline: none !important;
}

@media (max-width: 340px) {
    .fonteEsqueciSenhaEPrimeiroAcesso {
        font-size: 10px;
    }
}

@media (min-width: 341px) and (max-width: 360px) {
    .fonteEsqueciSenhaEPrimeiroAcesso {
        font-size: 12px;
    }
}

/*Overlay de carregamento*/
#loading-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(0, 0, 0, 0.7) !important;
    display: none;
    justify-content: center !important;
    align-items: center !important;
    z-index: 2147483647 !important;
    pointer-events: auto !important;
}

.spinner {
    border: 16px solid #f3f3f3;
    border-top: 16px solid #0d2d67;
    border-radius: 50%;
    width: 120px;
    height: 120px;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ===== ESTILOS DE LOGIN (Login, Primeiro Acesso, Esqueceu Senha, Redefinir Senha) ===== */
.login-page {
    min-height: 100vh;
    background-color: #f2f2f2;
    display: flex;
    flex-direction: column;
    position: relative;
    padding-bottom: 60px;
}

.login-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.login-card {
    background-color: #0d2d67;
    border-radius: 30px;
    padding: 15px 40px 40px 40px;
    box-shadow: 0px 10px 0px #00a9e9;
    max-width: 500px;
    width: 100%;
    position: relative;
    box-sizing: content-box;
    overflow: hidden;
}

.login-header {
    text-align: center;
    margin-bottom: 20px;
}

.login-icon {
    width: 120px;
    height: 120px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: white;
    font-size: 24px;
}

.login-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.login-title {
    color: white;
    font-size: 18px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.login-subtitle {
    color: #f2aa36;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    margin: 5px 0 0 0;
    letter-spacing: 1px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.login-form .form-group {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.login-form .form-control {
    background-color: transparent;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 5px !important;
    color: white;
    padding: 12px 15px;
    font-size: 14px;
    width: 75% !important;
    box-sizing: border-box;
    margin: 0 auto;
}

/* Alerts inside login form */
.login-form .alert,
.login-form .alert-danger {
    width: 75%;
    margin: 0 auto 20px auto;
    text-align: center;
    font-weight: 500 !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
    padding: 10px 8px;
}

/* Field validation under inputs */
.login-form .field-error {
    color: #ff6b6b !important;
    font-size: 14px;
    margin-top: 5px;
    width: 75%;
    display: block;
    margin-left: auto;
    margin-right: auto;
    text-align: left;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Keep alert text default inside alert boxes */
.login-form .alert span.text-danger,
.login-form .alert span.text-info {
    width: auto;
    display: inline;
    margin: 0;
}

.login-form .form-control::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.login-form .form-control:focus {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: white;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
    color: white;
    outline: none;
}

.login-form .form-control:-webkit-autofill,
.login-form .form-control:-webkit-autofill:hover,
.login-form .form-control:-webkit-autofill:focus,
.login-form .form-control:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px transparent inset !important;
    -webkit-text-fill-color: white !important;
    background-color: transparent !important;
    transition: background-color 5000s ease-in-out 0s;
}

.login-btn {
    background-color: #00a9e9;
    border: none;
    border-radius: 5px !important;
    color: white;
    font-weight: bold;
    text-transform: uppercase;
    padding: 12px;
    width: 75%;
    font-size: 14px;
    transition: all 0.3s ease;
    cursor: pointer;
    margin: 0 auto;
    display: block;
}

    .login-btn:hover {
        background-color: #0184b5;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }

.login-links {
    text-align: center;
    margin-top: 20px;
}

.login-links {
    color: white;
    text-align: center;
    margin-top: 20px;
}

.login-links a {
    color: white;
    font-weight: 500;
    text-decoration: underline;
    font-size: 13px;
    display: inline;
    margin: 0 5px;
}

.login-links a:hover {
    text-decoration: underline;
}

.login-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #0d2d67;
    color: white;
    text-align: center;
    padding: 10px;
    font-size: 12px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

/* Responsividade Login Pages */
@media (max-width: 768px) {
    .login-page {
        padding-bottom: 80px !important;
    }

    .login-card {
        padding: 5px 10px 20px 10px !important;
    }

    .login-title {
        font-size: 16px !important;
    }

    .login-icon {
        width: 100px !important;
        height: 100px !important;
        font-size: 20px !important;
    }

    .login-form .form-control,
    .login-btn,
    .login-form .alert,
    .login-form .field-error {
        width: 90% !important;
    }
}

/* ===== ESTILOS PARA PRIMEIRO ACESSO ===== */
.form-label-white {
    color: white;
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 8px;
    display: block;
}

.form-control-white {
    background-color: transparent;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 5px !important;
    color: white;
    padding: 12px 15px;
    font-size: 14px;
    width: 75%;
    box-sizing: border-box;
    margin: 0 auto;
    display: block;
}

.form-control-white::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.form-control-white:focus {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: white;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
    color: white;
    outline: none;
}

.form-control-white:-webkit-autofill,
.form-control-white:-webkit-autofill:hover,
.form-control-white:-webkit-autofill:focus,
.form-control-white:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px transparent inset !important;
    -webkit-text-fill-color: white !important;
    background-color: transparent !important;
    transition: background-color 5000s ease-in-out 0s;
}

.login-btn-white {
    background-color: #00a9e9;
    border: none;
    color: white;
    font-weight: bold;
    text-transform: uppercase;
    padding: 12px;
    width: 75%;
    font-size: 14px;
    transition: all 0.3s ease;
    cursor: pointer;
    margin: 0 auto 15px auto;
    display: block;
    border-radius: 5px !important;
    text-decoration: none;
    text-align: center;
}

    .login-btn-white:hover {
        background-color: #0184b5;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
        color: white;
        text-decoration: none;
    }

.login-btn-white:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Remove espaçamento extra do último botão */
.login-btn-white:last-child {
    margin-bottom: 0;
}

/* Responsividade para Primeiro Acesso */
@media (max-width: 768px) {
    .form-control-white,
    .login-btn-white {
        width: 90% !important;
    }

    .forca-wrapper {
        width: 90% !important;
    }
}

/* ===== ESTILOS PARA FORÇA DA SENHA (Redefinir Senha) ===== */
.forca-wrapper {
    position: relative;
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.forca-barra {
    display: flex;
    width: 100%;
    height: 6px;
    border-radius: 4px;
    overflow: hidden;
    gap: 2px;
}

.forca-bloco {
    flex: 1;
    background-color: #ddd;
    transition: background-color 0.3s ease;
    border-radius: 2px;
}

.forca-texto {
    font-size: 0.75rem;
    font-weight: bold;
    text-align: left;
    color: #999;
}

.forca-texto-wrapper {
    /* Alinha o texto e o ícone lado a lado */
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px; /* Espaço entre o texto e o ícone */
}

.senha-info-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: #aaa; /* Cor do ícone */
    color: white;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: bold;
    font-style: italic;
    text-align: center;
    line-height: 18px;
    cursor: pointer;
    font-size: 14px;
    user-select: none; /* Impede de selecionar o 'i' */
}

    .senha-info-icon:hover {
        background-color: #00a9e9; /* Cor ao passar o mouse */
    }

.senha-info-popup {
    display: none; /* Começa escondido */
    position: absolute;
    /* Posiciona o popup acima do wrapper */
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    padding: 12px;
    background-color: #333; /* Fundo escuro */
    color: white;
    border: 1px solid #555;
    border-radius: 5px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 10;
    text-align: left;
    font-size: 13px;
    margin-top: 5px; /* Espaço do popup para o ícone */
}

    /* Estilos da lista dentro do popup */
    .senha-info-popup b {
        font-size: 14px;
    }

    .senha-info-popup ul {
        padding-left: 20px;
        margin-bottom: 0;
        margin-top: 8px;
    }

    .senha-info-popup li {
        margin-bottom: 3px;
    }

/* ===== PORTAL LAYOUT (Header / Sidebar / Content / Footer) ===== */
.portal-body {
    background-color: #ffffff;
}

.portal-header {
    position: sticky;
    top: 0;
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    padding: 0 16px;
    background-color: #0d2d67;
    color: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.portal-brand {
    text-decoration: none !important;
    color: inherit !important;
    transition: opacity 0.2s ease;
    cursor: pointer;
}

.portal-brand:hover {
    opacity: 0.85;
}

.portal-brand-text {
    font-weight: 700;
    letter-spacing: .3px;
}

.portal-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.sidebar-toggle {
    background: transparent;
    border: 0;
    padding: 8px;
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-toggle span {
    width: 22px;
    height: 2px;
    background: #fff;
    display: block;
}

.portal-shell {
    display: flex;
    min-height: calc(100vh - 60px);
    width: 100%;
    overflow-x: hidden;
}

.portal-sidebar {
    background-color: #0a2555;
    color: #fff;
    width: 260px;
    flex-shrink: 0;
    transition: transform .25s ease;
}

.portal-sidebar-inner {
    position: sticky;
    top: 10px;
    padding: 5px 20px;
    height: calc(100vh - 70px);
    overflow-y: auto;
}

.portal-user img {
    width: 90px;
    height: 90px;
    padding: 3px;
    object-fit: cover;
    border-radius: 50%;
    box-shadow: 0 0 0 2px #888;
}

.portal-user-name {
    font-weight: 600;
    margin: 10px 5px 25px 5px;
}

/* Hierarchy */
.portal-section-title {
    font-size: 15px;
    font-weight: 700;
    margin: 14px 0 6px 0;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
}

.portal-section-title i {
    color: #fff !important;
}

.portal-section-title i.bi::before {
    color: #fff !important;
}

.portal-group-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 8px 10px;
    color: #fff;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    margin-bottom: 3px;
}

.portal-group-title:hover {
    background: rgba(255, 255, 255, .12);
    text-decoration: none;
}

.portal-group-title.active {
    color: #00ceff !important;
    background: rgba(0, 206, 255, 0.1);
}

.portal-group-title.active i {
    color: #00ceff !important;
}

.portal-link {
    display: block;
    padding: 8px 10px;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 400;
}

.portal-link.active {
    color: #00ceff !important;
    background: rgba(0, 206, 255, 0.1);
}

.portal-child {
    padding-left: 12px;
    text-transform: uppercase;
}

.portal-grandchild {
    padding-left: 15px;
    margin: 5px 0px 5px 15px;
    font-size: 12.5px;
    font-weight: 400;
}

.portal-link:hover {
    background: rgba(255, 255, 255, .12);
    text-decoration: none;
}

.portal-arrow {
    font-size: 10px;
    transition: transform 0.2s ease;
}

.portal-content {
    padding: 24px;
    flex: 1;
    transition: margin-left .5s ease-in-out;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

/* When sidebar is collapsed, remove left margin */
.portal-sidebar.collapsed ~ .portal-content {
    margin-left: 0;
}

/* Welcome message styling */
.portal-welcome-message {
    text-align: center !important;
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    width: 100%;
}

.portal-welcome-title {
    color: #00a2ff !important;
    font-size: 22px !important;
    font-weight: 600 !important;
    margin-bottom: 30px !important;
    line-height: 1.3;
    text-align: center;
}

.portal-welcome-text {
    color: #0d2d67 !important;
    font-size: 18px !important;
    line-height: 1.6;
    margin: 0 !important;
    text-align: center;
    max-width: 600px;
}

.portal-footer {
    background-color: #0d2d67;
    color: #fff;
    padding: 10px;
    font-size: 12px;
    text-align: center;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

/* Desktop: padding-bottom no conteúdo para o footer fixo */
@media (min-width: 993px) {
    .portal-content {
        padding-bottom: 60px;
    }
}

/* Collapsed sidebar: overlay mode */
.portal-sidebar.collapsed {
    transform: translateX(-100%);
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
}

/* Hide sidebar inner content when collapsed */
.portal-sidebar.collapsed .portal-sidebar-inner {
    display: none !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
}

/* Mobile overlay - Sidebar starts closed by default */
@media (max-width: 992px) {
    /* Mobile: Estrutura flexbox para footer no final */
    .portal-body {
        display: flex !important;
        flex-direction: column !important;
        min-height: 100vh !important;
    }

    /* Header fixo no mobile */
    .portal-header {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 1050 !important;
        width: 100% !important;
        flex-shrink: 0 !important;
    }

    .portal-sidebar {
        position: fixed !important;
        width: 260px !important;
        top: 60px !important;
        height: calc(100vh - 60px) !important;
        transform: translateX(-100%) !important;
        z-index: 1040 !important;
        transition: transform .25s ease !important;
    }

    .portal-sidebar:not(.collapsed) {
        transform: translateX(0) !important;
    }

    .portal-sidebar-overlay {
        position: fixed !important;
        top: 60px !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        background: rgba(0, 0, 0, 0.5) !important;
        z-index: 1035 !important;
        display: none !important;
    }

    .portal-sidebar:not(.collapsed)+.portal-sidebar-overlay {
        display: block !important;
    }

    /* Mobile: Shell expansível para empurrar footer */
    .portal-shell {
        flex: 1 !important;
        min-height: auto !important;
        display: flex !important;
    }

    /* Mobile: Footer no final do conteúdo (não fixo) */
    .portal-footer {
        position: relative !important;
        margin-top: auto !important;
        flex-shrink: 0 !important;
        z-index: 1 !important;
    }

    /* Reset content margin on mobile */
    .portal-content.sidebar-collapsed {
        margin-left: 0 !important;
    }

    /* Mobile content adjustments */
    .portal-content {
        max-width: 100vw !important;
        padding: 16px !important;
        padding-top: 76px !important;
        padding-bottom: 16px !important;
        flex: 1 !important;
    }

    .portal-welcome-message {
        padding: 20px 16px !important;
        min-height: 40vh !important;
    }

    .portal-welcome-title {
        font-size: 18px !important;
        margin-bottom: 20px !important;
    }

    .portal-welcome-text {
        font-size: 14px !important;
        line-height: 1.5 !important;
    }

    /* Header com z-index alto quando sidebar aberto */
    body.sidebar-open .portal-header {
        z-index: 1050 !important;
    }
    
    /* Disable body scroll when sidebar is open - WITHOUT moving content */
    body.sidebar-open {
        overflow: hidden !important;
    }
    
    body.sidebar-open .portal-content {
        overflow: hidden !important;
        pointer-events: none !important;
    }
    
    /* Enable scroll only in sidebar content */
    body.sidebar-open .portal-sidebar {
        overflow-y: auto !important;
        height: calc(100vh - 60px) !important;
        top: 60px !important;
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    .portal-content {
        padding: 12px !important;
        padding-top: 72px !important;
        padding-bottom: 12px !important;
    }

    .portal-welcome-message {
        padding: 16px 12px !important;
        min-height: 35vh !important;
    }

    .portal-welcome-title {
        font-size: 16px !important;
        margin-bottom: 16px !important;
    }
}

/* ===== RECAPTCHA STYLES ===== */
.recaptcha-container {
    display: flex;
    justify-content: center;
    align-items: center;
    transform: scale(0.85);
    margin: 10px 0px 0px !important;
}

/* reCAPTCHA sempre acima do footer */
.grecaptcha-badge {
    z-index: 999999 !important;
    bottom: 50px !important;
}

div[id^="rc-"],
iframe[title*="recaptcha"],
iframe[src*="recaptcha"],
.g-recaptcha,
#recaptchaV2 {
    z-index: 999999 !important;
}

/* Container do reCAPTCHA V2 (quando visível) */
div[style*="z-index: 2000000000"] {
    z-index: 999999 !important;
}

/* ===== BUTTONS STYLES ===== */
.btn-primary {
    background-color: #0d2d67 !important;
    border-color: #0d2d67 !important;
    width: 100% !important;
}

.btn-primary:hover {
    background-color: #0d2859 !important;
    border-color: #0d2859 !important;
}

.btn-primary:focus {
    background-color: #0d2d67 !important;
    border-color: #0d2d67 !important;
    box-shadow: 0 0 0 0.2rem rgba(17, 51, 112, 0.25) !important;
}

.btn-block {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-weight: 500;
    box-sizing: border-box;
}

.btnCarregar {
    background-color: #00a2ff !important;
    border-color: #00a2ff !important;
    color: white !important;
}

.btnCarregar:hover {
    background-color: #008cdd !important;
    border-color: #008cdd !important;
    color: white !important;
}
