/* TABELAS DE RELATÓRIOS */
.report-table-container { margin-bottom: 2rem; background: white; border: 1px solid var(--border); border-radius: 8px; padding: 1rem; }
.report-table-container h4 { color: var(--primary); margin-bottom: 0.5rem; font-size: 1.1rem; border-left: 4px solid var(--secondary); padding-left: 10px; }
.report-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.report-table th { background: var(--primary); color: white; padding: 10px 8px; text-align: center; font-weight: 600; font-size: 0.85rem; }
.report-table td { padding: 8px; text-align: center; border-bottom: 1px solid var(--border); color: var(--text); }
.report-table td:first-child { text-align: left; font-weight: bold; color: var(--primary); padding-left: 12px; }

/* ✅ NOVO: Scroll horizontal para tabelas largas (Consolidado com 9 colunas) */
.report-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.report-table-scroll .report-table { min-width: 1000px; }

/* TABELA DE RESULTADOS */
.results-table { width: 100%; border-collapse: collapse; margin-top: 1rem; font-size: 0.95rem; }
.results-table th, .results-table td { padding: 0.75rem; text-align: center; border-bottom: 1px solid var(--border); }
.results-table th { background: var(--primary); color: white; font-weight: 600; text-align: center; }
.results-table tr:hover { background: rgba(0,61,121,0.03); }
.results-table .winner { background: rgba(40,167,69,0.1); font-weight: 600; }
.results-table td:first-child { text-align: left; font-weight: bold; color: var(--primary); }

.total-row { background: rgba(255, 215, 0, 0.15); font-weight: bold; }
.total-row td { font-weight: bold; }

/* PERÍODO INFO */
.periodo-info { background: var(--header-bg); border: 2px solid var(--secondary); border-radius: 8px; padding: 1rem; margin-bottom: 1.5rem; text-align: center; }
.periodo-info strong { color: var(--primary); font-size: 1.1rem; }

/* ANO TABS */
.ano-tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; border-bottom: 2px solid var(--border); padding-bottom: 0.5rem; }
.ano-tab { padding: 0.5rem 1rem; background: var(--background); border: 1px solid var(--border); border-radius: 6px 6px 0 0; cursor: pointer; font-weight: 500; transition: all 0.2s; }
.ano-tab:hover { background: var(--primary-light); color: white; }
.ano-tab.active { background: var(--primary); color: white; border-color: var(--primary); font-weight: bold; }
.ano-content { display: none; }
.ano-content.active { display: block; animation: fadeIn 0.3s; }

/* CARGO GROUP */
.cargo-group { margin-bottom: 1.5rem; }
.cargo-group-title { background: var(--primary); color: white; padding: 0.5rem 1rem; border-radius: 6px; margin-bottom: 0.75rem; font-size: 1rem; font-weight: 600; }
.cargo-group-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.cargo-group-btn { padding: 0.5rem 1rem; background: var(--background); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; font-weight: 500; transition: all 0.2s; }
.cargo-group-btn:hover { background: var(--primary-light); color: white; }
.cargo-group-btn.active { background: var(--primary); color: white; border-color: var(--primary); font-weight: bold; }

/* TURNO SELECTOR */
.turno-selector { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.turno-btn { padding: 0.75rem 1.5rem; background: var(--background); border: 2px solid var(--border); border-radius: 8px; cursor: pointer; font-weight: 600; transition: all 0.2s; font-size: 1rem; }
.turno-btn:hover { background: var(--primary-light); color: white; border-color: var(--primary-light); }
.turno-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* CONSOLIDADO */
.consolidado-tabs { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; border-bottom: 2px solid var(--border); padding-bottom: 0.5rem; }
.consolidado-tab { padding: 0.75rem 1.5rem; background: var(--background); border: 1px solid var(--border); border-bottom: none; border-radius: 6px 6px 0 0; cursor: pointer; font-weight: 600; transition: all 0.2s; }
.consolidado-tab:hover { background: var(--primary-light); color: white; }
.consolidado-tab.active { background: var(--primary); color: white; border-color: var(--primary); }
.consolidado-content { display: none; }
.consolidado-content.active { display: block; animation: fadeIn 0.3s; }

/* AUDITORIA */
.auditoria-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.auditoria-stat { background: var(--card); border: 2px solid var(--border); border-radius: 8px; padding: 1.5rem; text-align: center; }
.auditoria-stat.ok { border-color: var(--success); background: rgba(40,167,69,0.05); }
.auditoria-stat.error { border-color: var(--danger); background: rgba(220,53,69,0.05); }
.auditoria-stat.warning { border-color: var(--warning); background: rgba(255,193,7,0.05); }
.auditoria-stat-value { font-size: 2rem; font-weight: 700; margin-bottom: 0.5rem; }
.auditoria-stat-label { font-size: 0.9rem; color: var(--muted); }
.auditoria-table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.9rem; }
.auditoria-table th { background: var(--primary); color: white; padding: 0.75rem; text-align: left; }
.auditoria-table td { padding: 0.75rem; border-bottom: 1px solid var(--border); }
.status-badge { padding: 0.25rem 0.75rem; border-radius: 12px; font-size: 0.85rem; font-weight: 600; }
.status-ok { background: var(--success); color: white; }
.status-error { background: var(--danger); color: white; }
.status-warning { background: var(--warning); color: black; }
.btn-export { background: var(--success); color: white; border: none; padding: 0.75rem 1.5rem; border-radius: 6px; font-weight: 600; cursor: pointer; margin-top: 1rem; }
.btn-export:hover { background: #218838; }

/* SRAG */
.srag-container { background: var(--card); border-radius: 8px; padding: 1.5rem; margin-bottom: 1.5rem; border: 1px solid var(--border); }
.srag-header { background: var(--primary); color: white; padding: 1rem; border-radius: 6px; margin-bottom: 1rem; display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.srag-header:hover { background: var(--primary-light); }
.srag-header h4 { margin: 0; font-size: 1.1rem; }
.srag-subheader { background: var(--secondary); color: black; padding: 0.75rem; border-radius: 6px; margin: 1rem 0 0.5rem; font-weight: 600; cursor: pointer; }
.srag-subheader:hover { background: #e6c200; }
.srag-content { display: none; padding: 1rem; background: var(--background); border-radius: 6px; margin-bottom: 1rem; }
.srag-content.active { display: block; }
.srag-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin-top: 0.5rem; }
.srag-table th { background: var(--primary); color: white; padding: 0.5rem; text-align: center; font-size: 0.8rem; }
.srag-table td { padding: 0.5rem; text-align: center; border-bottom: 1px solid var(--border); }
.srag-table td:first-child { text-align: left; font-weight: 600; }
.srag-table tr:hover { background: rgba(0,61,121,0.03); }
.srag-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin: 1rem 0; }
.srag-stat-box { background: var(--card); border: 1px solid var(--border); border-radius: 6px; padding: 1rem; text-align: center; }
.srag-stat-box .value { font-size: 1.5rem; font-weight: 700; color: var(--primary); }
.srag-stat-box .label { font-size: 0.8rem; color: var(--muted); margin-top: 0.25rem; }
.srag-stat-box.casos .value { color: var(--primary); }
.srag-stat-box.obitos .value { color: var(--danger); }
.srag-stat-box.letalidade .value { color: var(--warning); }
.srag-stat-box.curas .value { color: var(--success); }
.srag-tabs { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; border-bottom: 2px solid var(--border); padding-bottom: 0.5rem; }
.srag-tab { padding: 0.75rem 1.5rem; background: var(--background); border: 1px solid var(--border); border-bottom: none; border-radius: 6px 6px 0 0; cursor: pointer; font-weight: 600; transition: all 0.2s; }
.srag-tab:hover { background: var(--primary-light); color: white; }
.srag-tab.active { background: var(--primary); color: white; border-color: var(--primary); }
.srag-tab-content { display: none; }
.srag-tab-content.active { display: block; animation: fadeIn 0.3s; }
.srag-subitem { background: var(--background); padding: 0.75rem; border-radius: 6px; margin: 0.5rem 0; cursor: pointer; display: flex; justify-content: space-between; align-items: center; border-left: 4px solid var(--primary); transition: all 0.2s; }
.srag-subitem:hover { background: #e9ecef; border-left-color: var(--primary-light); }
.srag-subitem-title { font-weight: 600; color: var(--primary); }
.srag-subitem-arrow { color: var(--muted); transition: transform 0.3s; }
.srag-subitem.active .srag-subitem-arrow { transform: rotate(180deg); }
.srag-subitem-content { display: none; padding: 1rem; background: white; border-radius: 6px; margin-top: 0.5rem; border: 1px solid var(--border); }
.srag-subitem-content.active { display: block; }
/* ============================================
   FORMATAÇÃO DE DESTAQUE (faltante no modular)
   ============================================ */

/* Banner do município (azul escuro) */
.municipio-info {
  margin: 2rem 0;
  padding: 1.5rem;
  background: var(--primary);
  border-radius: 8px;
  color: white;
}

.municipio-info h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: white;
  border: none;
}

.municipio-info p {
  color: rgba(255,255,255,0.9);
  margin-bottom: 0.5rem;
}

.municipio-info strong {
  color: var(--secondary);
}

/* Card cinza com códigos */
.municipio-info + .product-banner {
  margin-top: 1rem;
}

/* Título das seções (ELEIÇÃO FEDERAL, etc.) */
.election-group {
  margin-bottom: 2rem;
}

.election-title {
  background: var(--primary);
  color: white;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Linhas de relatório com separadores */
.report-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
}

.report-item:hover {
  background: #f1f5f9;
}

.report-item:last-child {
  border-bottom: none;
}

.report-item span {
  font-weight: 500;
  color: var(--text);
}

/* Botão "Baixar Relatório" estilizado */
.btn-download {
  background: var(--primary);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-download:hover {
  background: var(--primary-light);
  color: white;
}

/* Banner de produto (amarelo claro) */
.product-banner {
  background: var(--header-bg);
  border: 1px solid var(--secondary);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  text-align: center;
}

.product-banner p {
  margin: 0.5rem 0;
  color: var(--text);
  font-size: 1rem;
}

.product-banner strong {
  color: var(--primary);
  font-weight: 800;
}

.product-banner a {
  color: var(--primary-light);
  font-weight: bold;
  text-decoration: underline;
}

/* ============================================
   RESPONSIVO PARA DESTAQUE
   ============================================ */
@media (max-width: 768px) {
  .report-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .btn-download {
    width: 100%;
    justify-content: center;
  }
  
  .election-title {
    font-size: 1rem;
    padding: 0.6rem 0.8rem;
  }
  
  .municipio-info {
    padding: 1rem;
  }
  
  .municipio-info h2 {
    font-size: 1.2rem;
  }
}
/* =========================================================
   AJUSTES FINOS: PERFIL ELEITOR
   ========================================================= */

/* 1. Botões de Gênero padronizados com os de Ano */
.genero-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0.5rem;
}

.genero-btn {
  padding: 0.5rem 1rem;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
  color: var(--text);
}

.genero-btn:hover {
  background: var(--primary-light);
  color: white;
}

.genero-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  font-weight: bold;
}

/* 2. Abas de Dimensões em 2 linhas */
.perfil-dimensao-tabs-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0.5rem;
}

.dimensao-tab {
  padding: 0.5rem 1rem;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
  color: var(--text);
}

.dimensao-tab:hover {
  background: var(--primary-light);
  color: white;
}

.dimensao-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  font-weight: bold;
}

/* 3. Card de Idade Média em Azul Padrão */
.idade-media-card {
  background: transparent;
  padding: 1rem;
  margin-bottom: 1.5rem;
  text-align: center;
  border: 2px solid var(--primary);
  border-radius: 8px;
}

.idade-media-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.25rem;
  letter-spacing: 0.5px;
}

.idade-media-valor {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

/* 4. Tabela com Cabeçalho e Coluna Fixos (Sticky) */
.results-table-container {
  overflow-x: auto;
  max-height: 600px; /* Permite rolagem vertical */
  position: relative;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
}

.results-table {
  width: 100%;
  border-collapse: separate; /* Necessário para sticky funcionar corretamente */
  border-spacing: 0;
  font-size: 0.9rem;
}

/* Cabeçalho fixo no topo */
.results-table th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--primary);
  color: white;
  padding: 10px 8px;
  text-align: center;
  font-weight: 600;
  font-size: 0.85rem;
  border-bottom: 2px solid var(--primary);
}

/* Células normais */
.results-table td {
  padding: 8px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  background: white; /* Necessário para cobrir o conteúdo ao rolar */
}

/* Primeira coluna (Categoria) fixa à esquerda */
.results-table th:first-child,
.results-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 5;
  background: white;
  text-align: left;
  font-weight: bold;
  color: var(--primary);
  padding-left: 12px;
  border-right: 2px solid var(--border); /* Separador visual */
  min-width: 180px;
}

/* Canto superior esquerdo (interseção de header e coluna fixa) precisa do z-index mais alto */
.results-table th:first-child {
  z-index: 15;
  background: var(--primary);
  color: white;
}

/* Efeito hover nas linhas */
.results-table tbody tr:hover td {
  background: rgba(0, 61, 121, 0.03);
}

/* Manter o fundo da coluna fixa ao fazer hover */
.results-table tbody tr:hover td:first-child {
  background: rgba(0, 61, 121, 0.03);
}

/* Linha de Subtotal (Total) */
.total-row {
  background: rgba(255, 215, 0, 0.15) !important;
  font-weight: bold;
}

.total-row td {
  font-weight: bold;
  border-top: 2px solid var(--primary);
}
/* ============================================
   TABELA DO CONSOLIDADO COM SCROLL E HEADER FIXO
   ============================================ */

.report-table-container {
  margin-bottom: 2rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  max-height: 600px;  /* ✅ Altura máxima com scroll */
  overflow-y: auto;   /* ✅ Scroll vertical */
  overflow-x: auto;   /* ✅ Scroll horizontal (já existia) */
  position: relative;
}

.report-table-container h4 {
  color: var(--primary);
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
  border-left: 4px solid var(--secondary);
  padding-left: 10px;
  position: sticky;
  top: 0;
  background: white;
  z-index: 20;
}

.report-table {
  width: 100%;
  border-collapse: separate; /* Necessário para sticky funcionar */
  border-spacing: 0;
  font-size: 0.9rem;
  min-width: 1000px;
}

/* ✅ CABEÇALHO FIXO NO TOPO */
.report-table thead th {
  position: sticky;
  top: 0;
  background: var(--primary);
  color: white;
  padding: 10px 8px;
  text-align: center;
  font-weight: 600;
  font-size: 0.85rem;
  z-index: 15;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Primeira coluna (DS_CARGO ou PARTIDO) fixa à esquerda */
.report-table tbody td:first-child,
.report-table thead th:first-child {
  position: sticky;
  left: 0;
  background: white;
  z-index: 10;
  font-weight: bold;
  color: var(--primary);
  text-align: left;
  padding-left: 12px;
  min-width: 180px;
  border-right: 2px solid var(--border);
}

.report-table thead th:first-child {
  background: var(--primary);
  color: white;
  z-index: 20; /* Mais alto que outros headers */
}

/* Células normais */
.report-table tbody td {
  padding: 8px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  background: white;
}

/* Efeito hover */
.report-table tbody tr:hover td {
  background: rgba(0, 61, 121, 0.03);
}

/* Manter fundo da primeira coluna no hover */
.report-table tbody tr:hover td:first-child {
  background: rgba(0, 61, 121, 0.03);
}
/* ============================================
   VISÃO COMPORTAMENTAL - SEU MUNICÍPIO (3 MUNICÍPIOS)
   ============================================ */
#vcsChartsArea .chart-container {
  position: relative;
  width: 100%;
}

/* Destaque visual para as colunas de gênero na tabela */
#vcsTabelaDetalhada th:nth-child(4),
#vcsTabelaDetalhada th:nth-child(6) {
  background-color: rgba(0, 61, 121, 0.1) !important;
  color: var(--primary) !important;
}

#vcsTabelaDetalhada th:nth-child(5),
#vcsTabelaDetalhada th:nth-child(7) {
  background-color: rgba(233, 30, 99, 0.1) !important;
  color: #C2185B !important;
}

/* Responsividade para os 3 seletores */
@media (max-width: 768px) {
  #visaoComportamentalSeuMunicipioContent div[style*="grid-template-columns: repeat(auto-fit, minmax(200px, 1fr))"] {
    grid-template-columns: 1fr !important;
  }
}
/* ============================================
   VISÃO COMPORTAMENTAL - SEU MUNICÍPIO (3 MUNICÍPIOS)
   ============================================ */
#vcsChartsArea .chart-container {
  position: relative;
  width: 100%;
}

/* ============================================
   TABELA DETALHADA - LARGURAS DAS COLUNAS
   ============================================ */
#vcsTabelaDetalhada {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

#vcsTabelaDetalhada th:nth-child(1),
#vcsTabelaDetalhada td:nth-child(1) { min-width: 80px; max-width: 100px; }

#vcsTabelaDetalhada th:nth-child(2),
#vcsTabelaDetalhada td:nth-child(2) { min-width: 150px; max-width: 200px; }

#vcsTabelaDetalhada th:nth-child(3),
#vcsTabelaDetalhada td:nth-child(3) { min-width: 100px; }

#vcsTabelaDetalhada th:nth-child(4),
#vcsTabelaDetalhada td:nth-child(4) { min-width: 110px; }

#vcsTabelaDetalhada th:nth-child(5),
#vcsTabelaDetalhada td:nth-child(5) { min-width: 110px; }

#vcsTabelaDetalhada th:nth-child(6),
#vcsTabelaDetalhada td:nth-child(6) { min-width: 130px; }

#vcsTabelaDetalhada th:nth-child(7),
#vcsTabelaDetalhada td:nth-child(7) { min-width: 130px; }

/* ============================================
   DESTAQUE VISUAL - COLUNAS MASCULINAS (AZUL)
   ============================================ */
#vcsTabelaDetalhada th:nth-child(4),
#vcsTabelaDetalhada th:nth-child(6) {
  background-color: rgba(0, 61, 121, 0.1) !important;
  color: var(--primary) !important;
}

/* ============================================
   DESTAQUE VISUAL - COLUNAS FEMININAS (ROSA)
   ============================================ */
#vcsTabelaDetalhada th:nth-child(5),
#vcsTabelaDetalhada th:nth-child(7) {
  background-color: rgba(233, 30, 99, 0.1) !important;
  color: #C2185B !important;
}

/* ============================================
   RESPONSIVIDADE
   ============================================ */
@media (max-width: 768px) {
  #visaoComportamentalSeuMunicipioContent 
  div[style*="grid-template-columns: repeat(auto-fit, minmax(200px, 1fr))"] {
    grid-template-columns: 1fr !important;
  }
  
  #vcsTabelaDetalhada {
    font-size: 0.75rem;
  }
}