/* ========================= */
/* RESET GLOBAL */
/* ========================= */

html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;           /* quem vai rolar é só .main-content */
    background-color: #0b2b57;  /* mesma cor da barra, esconde qualquer 1px de gap */
}

/* conteúdo principal do Dash */
#_dash-app-content {
    height: 100%;
    overflow: hidden;
}

/* ========================= */
/* VARIÁVEIS GERAIS */
/* ========================= */

:root {
    --sidebar-width: 280px; /* largura da barra azul */
}

/* ========================= */
/* LAYOUT PRINCIPAL */
/* ========================= */

.app-root {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.app-container {
    display: flex;
    width: 100%;
    height: 100vh; /* menu + conteúdo ocupam a viewport inteira */
    overflow: hidden; /* impede rolagem no container geral */
}

/* ========================= */
/* SIDEBAR */
/* ========================= */

.sidebar {
    width: var(--sidebar-width);
    height: 100vh;        /* ocupa sempre toda a altura da tela */
    padding: 24px 20px;
    background-color: #0b2b57;
    color: white;
    overflow: hidden;     /* sem rolagem no menu */
    box-sizing: border-box;
    flex-shrink: 0;
}

.sidebar-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
}

.sidebar-logo {
    width: 100%;
    max-width: 250px;
    height: auto;
    margin-bottom: 12px;
}

.sidebar-title {
    color: white;
    font-size: 18px;
    font-weight: 600;
    margin: 5px 0;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-button {
    display: block;
    width: 100%;
    padding: 14px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
    text-decoration: none;
    font-size: 15px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    transition: all 0.2s ease-in-out;
    box-sizing: border-box;
}

.sidebar-button:hover {
    background: #ffffff;
    color: #0b2b57;
    border-color: #ffffff;
    transform: translateY(-1px);
}

.sidebar-button-active {
    background: #ffffff;
    color: #0b2b57 !important;
    border-color: #ffffff;
    font-weight: 600;
}

/* ========================= */
/* CONTEÚDO PRINCIPAL */
/* ========================= */

.main-content {
    flex: 1;
    height: 100%;
    padding: 0;                /* nenhum espaço entre barra azul e imagem */
    background-color: #ffffff;
    overflow-y: auto;          /* rolagem só aqui (segunda coluna) */
    overflow-x: hidden;        /* evita rolagem horizontal */
    box-sizing: border-box;
}

/* Wrapper interno do Dash Pages */
.page-wrapper {
    min-height: 100%;
}

/* ========================= */
/* BARRA DE FILTROS STICKY */
/* ========================= */

.filtros-sticky {
    position: sticky; /* fixa dentro da área branca */
    top: 0;
    z-index: 10;
    background-color: #ffffff;
    padding: 4px 0 8px 0; /* sem padding lateral, ocupa toda largura da main-content */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ========================= */
/* HOME */
/* ========================= */

/* HOME – imagem ocupando somente a área ao lado da sidebar */
.home-container {
    background-image: url("/assets/Painel DCC.png");
    background-repeat: no-repeat;
    background-position: left top;   /* começa colada na sidebar */
    background-size: cover;          /* cobre toda a área disponível */

    width: calc(100vw - var(--sidebar-width));  /* largura total menos a barra azul */
    height: 100vh;                               /* altura da viewport */

    margin: 0;
    padding: 0;

    position: relative;
    overflow: hidden;
}

/* sobreposição azul leve */
.home-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 43, 87, 0.027);
}

/* ========================= */
/* COMPONENTES PADRÃO */
/* ========================= */

.cards-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.card {
    background-color: white;
    padding: 10px 15px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    flex: 1;
}

.card-title {
    font-size: 14px;
    color: #555;
    text-align: center;
}

.card-value {
    font-size: 22px;
    font-weight: bold;
    color: #b30000;
    text-align: center;
}

.charts-row {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
}

/* ========================= */
/* LIMPEZA FINAL DE OVERFLOW */
/* ========================= */

.dash-table-container {
    overflow: visible !important;
}

.js-plotly-plot {
    overflow: visible !important;
}

/* ========================= */
/* MOBILE */
/* ========================= */

@media (max-width: 768px) {

    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 0 0 10px 0;
        /* continua com overflow-y: auto; herdado */
    }

    .sidebar-menu {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }

    .sidebar-button {
        font-size: 13px;
        padding: 10px;
    }

    .cards-container {
        flex-direction: column;
    }

    .charts-row {
        flex-direction: column;
    }

    .charts-row > div {
        width: 100% !important;
    }

    .filtros-sticky {
        position: static;
        box-shadow: none;
        padding: 6px 0 8px 0;
    }

    .card-value {
        font-size: 18px;
    }

    .card-title {
        font-size: 13px;
    }
}

/* ========================= */
/* Contratos - Accordion */
/* ========================= */

.contratos-container {
    width: 100%;
    margin-bottom: 12px;
}

.contratos-toggle {
    display: block;
    width: 100%;
    padding: 14px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
    text-decoration: none;
    font-size: 15px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    transition: all 0.2s ease-in-out;
    box-sizing: border-box;
    cursor: pointer;
}

.contratos-toggle:hover {
    background: #ffffff;
    color: #0b2b57;
    border-color: #ffffff;
    transform: translateY(-1px);
}

.contratos-toggle.active {
    background: #ffffff;
    color: #0b2b57;
    border-color: #ffffff;
    font-weight: 600;
}

.contratos-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease-out;
}

.contratos-content.expanded {
    max-height: 200px;
}

.contratos-subbutton {
    display: block;
    width: 100%;
    padding: 10px 14px 10px 28px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 0 0 6px 6px;
    color: #ffffff;
    text-decoration: none;
    font-size: 14px;
    border-top: 1px solid rgba(255,255,255,0.15);
    box-sizing: border-box;
}

.contratos-subbutton:hover {
    background: #ffffff;
    color: #0b2b57;
}

.contratos-subbutton-active {
    background: #ffffff;
    color: #b30000;
    font-weight: 600;
}

/* ========================= */
/* Processos - Accordion */
/* ========================= */

.processos-container {
    width: 100%;
    margin-bottom: 12px;
}

/* Botão principal da caixa */
.processos-toggle {
    display: block;
    width: 100%;
    padding: 14px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
    text-decoration: none;
    font-size: 15px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    transition: all 0.2s ease-in-out;
    box-sizing: border-box;
    cursor: pointer;
}

.processos-toggle:hover {
    background: #ffffff;
    color: #0b2b57;
    border-color: #ffffff;
    transform: translateY(-1px);
}

/* Estado ativo (quando expandido) */
.processos-toggle.active {
    background: #ffffff;
    color: #0b2b57;
    border-color: #ffffff;
    font-weight: 600;
}

/* Conteúdo interno (links de processos) */
.processos-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease-out;
}

/* Quando expandido */
.processos-content.expanded {
    max-height: 200px; /* ajuste se precisar */
}

/* Estilo base dos sub-links */
.processos-subbutton {
    display: block;
    width: 100%;
    padding: 10px 14px 10px 28px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 0 0 6px 6px;
    color: #ffffff;
    text-decoration: none;
    font-size: 14px;
    border-top: 1px solid rgba(255,255,255,0.15);
    box-sizing: border-box;
}

.processos-subbutton:hover {
    background: #ffffff;
    color: #0b2b57;
}

/* Estado ativo dos sublinks de processos */
.processos-subbutton-active {
    background: #ffffff;
    color: #b30000; /* texto vermelho quando selecionado */
    font-weight: 600;
}

/* ========================= */
/* Fracionamento - Accordion */
/* ========================= */

.fracionamento-container {
    width: 100%;
    margin-bottom: 12px;
}

/* Botão principal da caixa */
.fracionamento-toggle {
    display: block;
    width: 100%;
    padding: 14px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
    text-decoration: none;
    font-size: 15px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    transition: all 0.2s ease-in-out;
    box-sizing: border-box;
    cursor: pointer;
}

.fracionamento-toggle:hover {
    background: #ffffff;
    color: #0b2b57;
    border-color: #ffffff;
    transform: translateY(-1px);
}

/* Estado ativo (quando expandido) */
.fracionamento-toggle.active {
    background: #ffffff;
    color: #0b2b57;
    border-color: #ffffff;
    font-weight: 600;
}

/* Conteúdo interno (links PDM e CATSER) */
.fracionamento-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease-out;
}

/* Quando expandido */
.fracionamento-content.expanded {
    max-height: 250px; /* ajuste se precisar */
}

/* Estilo base dos sub-links */
.fracionamento-subbutton {
    display: block;
    width: 100%;
    padding: 10px 14px 10px 28px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 0 0 6px 6px;
    color: #ffffff;
    text-decoration: none;
    font-size: 14px;
    border-top: 1px solid rgba(255,255,255,0.15);
    box-sizing: border-box;
}

.fracionamento-subbutton:hover {
    background: #ffffff;
    color: #0b2b57;
}

/* Estado ativo dos sublinks de fracionamento */
.fracionamento-subbutton-active {
    background: #ffffff;
    color: #b30000; /* vermelho do texto quando selecionado */
    font-weight: 600;
}

/* ========================= */
/* Portarias - Accordion */
/* ========================= */

.portarias-container {
    width: 100%;
    margin-bottom: 12px;
}

.portarias-toggle {
    display: block;
    width: 100%;
    padding: 14px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
    text-decoration: none;
    font-size: 15px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    transition: all 0.2s ease-in-out;
    box-sizing: border-box;
    cursor: pointer;
}

.portarias-toggle:hover {
    background: #ffffff;
    color: #0b2b57;
    border-color: #ffffff;
    transform: translateY(-1px);
}

.portarias-toggle.active {
    background: #ffffff;
    color: #0b2b57;
    border-color: #ffffff;
    font-weight: 600;
}

.portarias-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease-out;
}

.portarias-content.expanded {
    max-height: 200px;
}

/* usa o mesmo estilo de sublink e ativo do fracionamento */
.portarias-subbutton {
    display: block;
    width: 100%;
    padding: 10px 14px 10px 28px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 0 0 6px 6px;
    color: #ffffff;
    text-decoration: none;
    font-size: 14px;
    border-top: 1px solid rgba(255,255,255,0.15);
    box-sizing: border-box;
}

.portarias-subbutton:hover {
    background: #ffffff;
    color: #0b2b57;
}

/* ativo: texto vermelho e fundo branco reaproveitando a ideia anterior */
.portarias-subbutton-active {
    background: #ffffff;
    color: #b30000;
    font-weight: 600;
}