/* assets/style.css (VERSÃO FINAL, SINTAXE CORRIGIDA E REGRAS OTIMIZADAS) */

/* --- 1. CSS DO LAYOUT PRINCIPAL (Sidebar, Gráficos, Responsividade) --- */

:root {
    --cor-borda: #8D6FA3;
    --cor-fundo-grafico: rgba(0, 0, 0, 0);
    --cor-fonte-caption: #8D6FA3;
    --cor-fonte-markdown: #8D6FA3;
    --cor-fonte-subheader: #8D6FA3;
    --cor-fundo-pagina: #f0f4f8; 
    --cor-texto: #333;
    --cor-fundo-sidebar: #f9f9f9;
    --header-height: 56px; 
}

body, html {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    background-color: var(--cor-fundo-pagina);
    color: var(--cor-texto);
}

/* --- 1.1 Header (Barra Superior) --- */
.header .logo { height: 40px; }
.sidebar-toggle-button {
    background-color: var(--cor-borda);
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.9rem;
    cursor: pointer;
    margin-left: 15px;
}
.navbar-brand {
    padding-top: 0;
    padding-bottom: 0;
}

/* --- 1.2 Layout Principal (Sidebar + Conteúdo) --- */
#main-wrapper {
    display: flex; 
    position: relative; 
}

.sidebar {
    flex: 0 0 250px; 
    background-color: var(--cor-fundo-sidebar);
    border-right: 1px solid #ddd;
    height: calc(100vh - var(--header-height)); 
    position: sticky;
    top: var(--header-height); 
    overflow-y: auto; 
    transition: transform 0.3s ease-in-out;
    z-index: 99; 
}

.content {
    flex-grow: 1; 
    padding: 20px;
    overflow-y: auto; 
}

/* (NOVO) Classe para esconder a sidebar na home */
.sidebar.hidden {
    display: none;
}
/* (NOVO) Faz o conteúdo ocupar 100% se a sidebar estiver escondida */
.sidebar.hidden + .content {
    padding: 0; 
}


/* --- 1.3 Estilos da Sidebar (Acordeão de Filtros) --- */
.sidebar .accordion-item {
    background-color: transparent; 
    border: none;
    border-bottom: 1px solid #ddd; 
}
.sidebar .accordion-button {
    background-color: #f1f1f1; 
    font-weight: bold;
    font-size: 1.1rem; 
    color: var(--cor-texto);
    padding: 15px 20px; 
    border-radius: 0 !important;
}
.sidebar .accordion-button:not(.collapsed) {
    background-color: var(--cor-borda);
    color: white;
}
.sidebar .accordion-button:focus { 
    box-shadow: none; 
    border-color: transparent;
}
.sidebar .accordion-button::after {
    display: none;
}
.sidebar .accordion-body {
    padding: 20px;
    background-color: white;
}
.sidebar h4 {
    color: var(--cor-texto);
    margin-top: 10px; 
    margin-bottom: 10px;
}
.filter-group {
    border: 1px solid #ccc;
    padding: 10px;
    background-color: white;
    max-height: 200px;
    overflow-y: auto;
}
.filter-group-scroll {
    max-height: 350px;
}

/* --- 1.4 Estilos das PÁGINAS DE GRÁFICO (GRÁFICO E ALINHAMENTO) --- */

/* Wrapper que Centraliza e Define a Largura de 70% */
.chart-footer-wrapper {
    max-width: 70%; 
    margin-left: auto; /* Centraliza o bloco */
    margin-right: auto;
    padding-bottom: 40px; /* Margem de separação entre blocos */
    padding-top: 20px; /* Garante que o bloco não grude no topo */
}

/* 1. Alinhamento do Título da Página (h3) */
.text-center-h3 {
    text-align: left; 
    padding-bottom: 20px;
}
.text-center-h3 h3 {
    text-align: left;
    margin: 0;
    color: var(--cor-fonte-subheader);
    font-size: 2rem; 
}

/* 2. O Contêiner do Gráfico */
.chart-container {
    border: 1px solid var(--cor-borda);
    border-radius: 20px;
    padding: 10px; 
    background-color: var(--cor-fundo-grafico);
    margin: 0; /* O wrapper cuida da centralização */
}

/* 3. Alinhamento da Fonte (Texto) */
.chart-source, .chart-subtitle {
    text-align: left;
    margin-top: 5px; 
    margin-bottom: 5px;
    margin-right: 0 !important;
    
    /* COMPENSAÇÃO VISUAL PARA ALINHAR COM A BORDA DO CHART-CONTAINER (10px) */
    padding-left: 10px; 
    margin-left: 0; 
}

.chart-source {
    color: var(--cor-fonte-caption) !important; 
    font-size: 0.9rem;
}

.chart-subtitle {
    color: #555;
    font-size: 0.9rem;
}


/* --- 4. Alinhamento da Imagem de Rodapé --- */
.image-wrapper-bottom {
    display: flex; /* Permite centralizar o conteúdo flexível */
    justify-content: center; /* Centraliza a imagem horizontalmente */
    align-items: center; /* Centraliza a imagem verticalmente (se houver altura disponível) */
    width: 100%; /* Ocupa 100% da largura do seu pai (.chart-footer-wrapper) */
    padding-top: 20px; /* Adiciona um pouco de espaço acima da imagem */
    padding-bottom: 20px; /* Adiciona um pouco de espaço abaixo da imagem */
    overflow: hidden; /* Importante para cortar qualquer coisa que ultrapasse */ }


/* A Imagem dentro do Container */
.image-wrapper-bottom img {
    max-width: 100%; /* Garante que a imagem nunca exceda a largura do seu contêiner */
    height: auto; /* Mantém a proporção da imagem */
    display: block; /* Remove espaços extras abaixo da imagem que browsers podem adicionar */
}

/* --- 5. Estilos de Múltiplos Gráficos --- */
.chart-row {
    display: flex;
    flex-direction: row; /* <--- GARANTE ALINHAMENTO HORIZONTAL NO DESKTOP */
    gap: 20px; 
    width: 100%;
}

.chart-column { flex-basis: 50%; min-width: 0; }
.chart-column-3 { flex-basis: 33.33%; min-width: 0; }


/* --- 6. CSS DA PÁGINA INICIAL (Menus) --- */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 2rem;
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}
.content .container {
    max-width: none;
    margin: 0;
    padding: 0;
    background-color: transparent;
    border-radius: 0;
    box-shadow: none;
}
.portal-header {
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 1.5rem;
}
.header-content {
    display: flex;
    align-items: center; 
    justify-content:center; 
    gap: 20px; 
    flex-wrap: wrap; 
}
.header-title h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #005f73;
}
.logo img {
    max-height: 175px; 
}
.intro {
    text-align: left; 
    margin-bottom: 2.5rem;
}
.intro h2 {
    font-size: 1.8rem;
    font-weight: 600;
    color: #005f73; 
    margin-bottom: 0.5rem;
}
.intro p {
    font-size: 1rem;
    color: #555;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
}
.grupo-principal, .subgrupo {
    list-style: none;
    padding-left: 0;
}
.topico-titulo {
    font-size: 1.6em;
    font-weight: 700;
    color: #0a9396; 
    margin-top: 35px;
    padding-bottom: 5px;
    border-bottom: 2px solid #0a9396;
}
.topico-subtitulo, .topico-subtitulo-menor {
    font-size: 1.25em;
    font-weight: 600;
    color: #005f73; 
    margin-top: 25px;
    padding-left: 15px;
    border-left: 4px solid #ffcc00; 
}
.topico-subtitulo-menor {
    font-size: 1.1em;
    font-weight: 500;
    color: #333;
    margin-top: 15px;
    border-left: none; 
}
.botoes-container {
    display: flex;
    flex-wrap: wrap; 
    gap: 10px; 
    margin-top: 15px;
    padding-left: 15px; 
}
.topico-botao {
    background-color: #f0f4f8; 
    color: #005f73;
    padding: 10px 15px;
    border: 1px solid #d4d8e0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 500;
    flex: 1 1 280px; 
    text-align: left;
    transition: background-color 0.2s ease, transform 0.2s ease;
    display: block; 
    text-decoration: none; 
}
.topico-botao:hover {
    background-color: #e6f0ff; 
    border-color: #0a9396;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    color: #005f73; 
    text-decoration: none;
}
.portal-footer {
    text-align: center;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e0e0e0;
    font-size: 0.9rem;
    color: #888;
}
.container-centralizado {
    text-align: center;
}

/* --- 6. RESPONSIVIDADE (Mobile) --- */
@media (max-width: 991px) { 
    .content {
        width: 100%;
        margin-left: 0;
        padding: 10px; 
    }
    .sidebar {
        position: fixed; 
        left: 0;
        top: var(--header-height);
        width: 280px; 
        max-width: 80%;
        z-index: 200;
        transform: translateX(-100%); 
        border-right: 2px solid var(--cor-borda);
    }
    .sidebar.sidebar-open-mobile {
        transform: translateX(0%);
    }
    
    /* Regra para empilhar no mobile */
    .content .chart-row {
        flex-direction: column; 
    }
    
    .content .chart-container {
        max-width: 95%;
    }
    .sidebar.hidden {
        transform: translateX(-100%) !important;
    }
    .container {
        margin: 1rem 0;
        padding: 1rem;
        width: 100%;
        box-shadow: none;
        border-radius: 0;
    }
    .intro h2 {
        font-size: 1.5rem;
    }
    .topico-botao {
        flex: 1 1 100%; 
        padding: 12px; 
    }
    .botoes-container {
        padding-left: 0;
        gap: 8px; 
    }
    .topico-titulo {
        font-size: 1.4em;
    }
    .topico-subtitulo, .topico-subtitulo-menor {
        font-size: 1.1em;
        padding-left: 0; 
    }
}

/* --- 7. BOTÃO VOLTAR MODERNO --- */
.btn-back-container {
    max-width: 70%;
    margin: 20px auto 0 auto;
    display: flex;
    justify-content: flex-start;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background-color: white;
    color: var(--cor-borda);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 50px;
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.btn-back:hover {
    background-color: var(--cor-borda);
    color: white;
    transform: translateX(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
    text-decoration: none;
}

.btn-back span {
    font-size: 1.1rem;
}

@media (max-width: 991px) {
    .btn-back-container {
        max-width: 95%;
        margin-top: 10px;
    }
    .btn-back {
        padding: 8px 15px;
        font-size: 0.85rem;
    }
}