/* GERAL */

:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --bg-color: #f8f9fa;
    --sidebar-bg: #ffffff;
    --card-bg: #ffffff;
    --text-color: #212529;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
    --shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.05);
    --border-radius: 0.5rem;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg-color);
    margin: 0;
    color: var(--text-color);
    font-size: 16px;
}

/* PÁGINA DE LOGIN (sem alterações) */

.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #e0eafc, #cfdef3);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 2.5rem;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.login-header .logo {
    max-width: 150px;
    margin-bottom: 1rem;
}

.login-header h2 {
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.login-header p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.input-group {
    text-align: left;
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9em;
}

.input-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    box-sizing: border-box;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.25);
}

.btn-login {
    width: 100%;
    padding: 0.8rem;
    border: none;
    background-color: var(--primary-color);
    color: white;
    font-size: 1em;
    font-weight: 500;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-login:hover {
    background-color: #0b5ed7;
}

.btn-login:disabled {
    background-color: #a1c4fd;
    cursor: not-allowed;
}

.error-message {
    color: #dc3545;
    margin-top: 1rem;
    min-height: 1.2em;
}

/* DASHBOARD LAYOUT (sem alterações) */

.dashboard-container {
    display: flex;
}

.sidebar {
    width: 250px;
    background: var(--sidebar-bg);
    height: 100vh;
    position: fixed;
    border-right: 1px solid var(--border-color);
    padding: 1.5rem 0;
}

.sidebar-header {
    text-align: center;
    padding: 0 1.5rem;
    margin-bottom: 2rem;
}

.sidebar-header h3 {
    margin: 0;
    color: var(--primary-color);
}

/*=====PARA SABER QUAL DASHBOARD QUE ESTAMOS===========*/

.sidebar-nav .nav-item {
    display: block;
    padding: 0.8rem 1.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
}

.sidebar-nav .nav-item:hover {
    background-color: #e9ecef;
}

.sidebar-nav .nav-item.active {
    background-color: var(--primary-color);
    color: white;
}

/*=================FIM===============================*/

.main-content {
    margin-left: 250px;
    width: calc(100% - 250px);
    padding: 1.5rem;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.main-header h2 {
    margin: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info span {
    font-weight: 500;
}

.btn-logout {
    padding: 0.5rem 1rem;
    background-color: #f8d7da;
    color: #842029;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
}

/* FILTROS (sem alterações) */

.filters-section {
    display: flex;
    gap: 1.5rem;
    align-items: flex-end;
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.filter-group {
    display: flex;
    flex-direction: column;
}


.filter-group label {
    margin-bottom: 0.5rem;
    font-size: 0.9em;
    font-weight: 500;
}

.filter-group select,
.filter-group input {
    padding: 0.5rem;
    border-radius: 0.25rem;
    border: 1px solid var(--border-color);
}

.btn-primary {
    padding: 0.5rem 1.5rem;
    border: none;
    background-color: var(--primary-color);
    color: white;
    border-radius: 0.25rem;
    cursor: pointer;
    font-weight: 500;
}

/* KPIs (sem alterações) */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.kpi-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.kpi-card h4 {
    margin: 0 0 0.5rem 0;
    color: var(--text-muted);
    font-size: 1em;
}

.kpi-card p {
    margin: 0;
    font-size: 2em;
    font-weight: 700;
}

/* GRÁFICOS - CORREÇÃO REFORÇADA */

.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}


.chart-container {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    /* ESSAS DUAS LINHAS SÃO VITAIS */
    position: relative; /* Define o contexto para o canvas */
    height: 380px;      /* Define uma altura fixa e estável */
}


.chart-container.full-width {
    grid-column: 1 / -1;
}

/* TABELA (CORRIGIDO PARA AMBOS OS DASHBOARDS) */

.table-section {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.table-wrapper {
    overflow-x: auto;
}

/* Estilo base para AMBAS as tabelas */

#leadsTable,
#dataTable {
    width: 100%;
    border-collapse: collapse;
}

/* Células e cabeçalhos de AMBAS as tabelas */

#leadsTable th,
#leadsTable td,
#dataTable th,
#dataTable td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}


/* Apenas o cabeçalho de AMBAS as tabelas */

#leadsTable thead th,
#dataTable thead th {
    font-weight: 700;
}


/* ================================================= */

/* ESTILOS PARA OS NOVOS FILTROS AVANÇADOS           */

/* ================================================= */


/* Permite que a barra de filtros quebre a linha se ficar muito grande */

.filters-section {
    flex-wrap: wrap; 
}

/* Estilo para o novo filtro de destacar resultados */

.highlight-filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-top: 1.5rem; /* Alinha com os outros filtros */
}

/* Estilo para a linha destacada na tabela */
.highlighted-row {
    background-color: #e6ffed !important; /* Um verde bem clarinho */
    font-weight: 500;
}

/* --- Estilos para o Seletor de Colunas (Dropdown com Checkboxes) --- */

.dropdown-check-list {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.dropdown-check-list .dropdown-button {
    padding: 0.5rem;
    border-radius: 0.25rem;
    border: 1px solid var(--border-color);
    background-color: white;
    width: 180px; /* Largura do botão */
    text-align: left;
}

.dropdown-check-list .dropdown-options {
    display: none;
    position: absolute;
    background-color: white;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    padding: 0.5rem;
    z-index: 10;
    max-height: 250px;
    overflow-y: auto;
}

.dropdown-check-list.visible .dropdown-options {
    display: block;
}

.dropdown-check-list .dropdown-options label {
    display: block;
    padding: 0.4rem 0.8rem;
    white-space: nowrap;
}

.dropdown-check-list .dropdown-options label:hover {
    background-color: #f0f0f0;
    border-radius: 0.2rem;
}

.dropdown-check-list .dropdown-options input {
    margin-right: 0.5rem;
}

/* ================================================= */

/* ESTILOS PARA FILTROS AVANÇADOS E TABELA INTERATIVA */

/* ================================================= */

/* Botão secundário para limpar filtros */

.btn-secondary {
    padding: 0.5rem 1.5rem;
    border: 1px solid var(--secondary-color);
    background-color: transparent;
    color: var(--secondary-color);
    border-radius: 0.25rem;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
}

.btn-secondary:hover {
    background-color: var(--secondary-color);
    color: white;
}

/* Estilos para o cabeçalho da tabela ordenável (PARA AMBAS) */

#leadsTable thead th.sortable,
#dataTable thead th.sortable {
    cursor: pointer;
    position: relative;
    padding-right: 25px; /* Espaço para a seta */
}

#leadsTable thead th.sortable:hover,
#dataTable thead th.sortable:hover {
    background-color: #f0f0f0;
}

/* Setas de ordenação (indicadores visuais - PARA AMBAS) */

#leadsTable thead th.sortable::after,
#dataTable thead th.sortable::after {
    content: '';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.4;
    border: 4px solid transparent;
}

/* Seta para cima (Ascendente - PARA AMBAS) */

#leadsTable thead th.sortable[data-sort-dir="asc"]::after,
#dataTable thead th.sortable[data-sort-dir="asc"]::after {
    border-bottom-color: var(--text-color);
    opacity: 1;
}

/* Seta para baixo (Descendente - PARA AMBAS) */

#leadsTable thead th.sortable[data-sort-dir="desc"]::after,
#dataTable thead th.sortable[data-sort-dir="desc"]::after {
    border-top-color: var(--text-color);
    opacity: 1;
}