/* ============================================
   DASHBOARD DARK MODE - CSS COMPLETO
   Tema escuro elegante com todas as funcionalidades
   ============================================ */

/* ============================================
   1. VARIÁVEIS DE CORES E TEMAS
   ============================================ */
:root {
  /* Cores base - Tema Escuro (default) */
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --bg-card: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --accent-primary: #3b82f6;
  --accent-secondary: #2563eb;
  --accent-tertiary: #1d4ed8;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --border-color: #475569;
  --shadow-color: rgba(0, 0, 0, 0.3);
  --shadow-light: rgba(0, 0, 0, 0.1);
  --shadow-dark: rgba(0, 0, 0, 0.5);

  /* Cores específicas para ícones */
  --icon-saude: #ef4444;
  --icon-educacao: #10b981;
  --icon-social: #3b82f6;
  --icon-seguranca: #8b5cf6;
  --icon-infra: #f59e0b;
  --icon-esporte: #ec4899;
  --icon-cultura: #06b6d4;
  --icon-agricultura: #84cc16;

  /* Cores para badges - Modo Escuro */
  --badge-emenda-bg: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.15) 0%,
    rgba(59, 130, 246, 0.1) 100%
  );
  --badge-emenda-text: #93c5fd;
  --badge-emenda-border: rgba(59, 130, 246, 0.3);

  --badge-votos-bg: linear-gradient(
    135deg,
    rgba(16, 185, 129, 0.15) 0%,
    rgba(16, 185, 129, 0.1) 100%
  );
  --badge-votos-text: #6ee7b7;
  --badge-votos-border: rgba(16, 185, 129, 0.3);

  --badge-custo-bg: linear-gradient(
    135deg,
    rgba(245, 158, 11, 0.15) 0%,
    rgba(245, 158, 11, 0.1) 100%
  );
  --badge-custo-text: #fcd34d;
  --badge-custo-border: rgba(245, 158, 11, 0.3);

  /* Cores para gráficos */
  --chart-scatter-bg: rgba(
    100,
    149,
    237,
    0.8
  ); /* Cornflower blue mais claro para dark mode */
  --chart-scatter-border: #6495ed;

  /* Gradientes */
  --gradient-primary: linear-gradient(
    135deg,
    var(--accent-tertiary) 0%,
    var(--accent-primary) 100%
  );
  --gradient-secondary: linear-gradient(
    135deg,
    var(--bg-tertiary) 0%,
    var(--bg-secondary) 100%
  );
  --gradient-card: linear-gradient(
    135deg,
    var(--bg-card) 0%,
    rgba(30, 41, 59, 0.9) 100%
  );

  /* Sombras */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md:
    0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg:
    0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl:
    0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

  /* Bordas */
  --border-radius-sm: 0.375rem;
  --border-radius-md: 0.5rem;
  --border-radius-lg: 0.75rem;
  --border-radius-xl: 1rem;

  /* Transições */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Tema Claro - Sobrescreve quando [data-theme="light"] */
[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --bg-card: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --accent-primary: #1e40af;
  --accent-secondary: #1e3a8a;
  --accent-tertiary: #1e3a8a;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --border-color: #e2e8f0;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --shadow-light: rgba(0, 0, 0, 0.05);
  --shadow-dark: rgba(0, 0, 0, 0.2);

  /* Cores para badges - Modo Claro */
  --badge-emenda-bg: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
  --badge-emenda-text: #0369a1;
  --badge-emenda-border: #7dd3fc;

  --badge-votos-bg: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  --badge-votos-text: #065f46;
  --badge-votos-border: #6ee7b7;

  --badge-custo-bg: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  --badge-custo-text: #92400e;
  --badge-custo-border: #fcd34d;

  /* Cores para gráficos - Modo Claro */
  --chart-scatter-bg: rgba(30, 60, 114, 0.6);
  --chart-scatter-border: #1e3c72;

  --gradient-primary: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
  --gradient-secondary: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  --gradient-card: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}

/* ============================================
   2. ESTILOS GERAIS E RESET
   ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    "Segoe UI",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  background: var(--gradient-secondary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  transition:
    background-color var(--transition-normal),
    color var(--transition-normal);
}

/* ============================================
   3. ESTILOS DO MAPA INTERATIVO
   ============================================ */
.map-container {
  position: relative;
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

#map {
  height: 600px;
  width: 100%;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  z-index: 1;
  background: var(--bg-secondary);
  transition: all var(--transition-normal);
}

/* Estilos personalizados para marcadores do mapa */
.map-marker {
  width: 24px;
  height: 24px;
  background: var(--gradient-primary);
  border: 3px solid var(--bg-card);
  border-radius: 50%;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.map-marker::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.map-marker:hover {
  transform: scale(1.2);
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}

/* Ícones personalizados para marcadores */
.custom-pointer-icon {
  background: transparent;
  border: none;
  transition: all var(--transition-fast);
}

.custom-pointer-icon i {
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  transition: transform var(--transition-fast);
}

.custom-pointer-icon:hover i {
  transform: scale(1.3);
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.6));
}

/* Controles do mapa */
.map-controls {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 1000;
  background: var(--bg-card);
  padding: 20px;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-xl);
  width: 320px;
  border: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
  animation: slideInRight 0.3s ease-out;
}

.map-controls h5 {
  color: var(--accent-primary);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 15px;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 10px;
  display: flex;
  align-items: center;
}

.map-controls h5 i {
  margin-right: 10px;
}

.control-group {
  margin-bottom: 20px;
}

.control-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* Legendas do mapa */
.legend {
  background: var(--bg-card);
  padding: 20px;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-xl);
  position: absolute;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  width: 280px;
  border: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
  animation: slideInUp 0.3s ease-out;
}

.legend-item {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  padding: 8px;
  border-radius: var(--border-radius-sm);
  transition: background-color var(--transition-fast);
}

.legend-item:hover {
  background-color: var(--bg-tertiary);
}

.legend-color {
  width: 24px;
  height: 24px;
  border-radius: var(--border-radius-sm);
  margin-right: 12px;
  border: 1px solid var(--border-color);
}

.legend-label {
  font-size: 0.875rem;
  color: var(--text-primary);
  font-weight: 500;
}

/* Estilos para o Leaflet */
.leaflet-tooltip {
  font-family: inherit;
  font-size: 0.875rem;
  padding: 12px 16px;
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  backdrop-filter: blur(5px);
}

.leaflet-tooltip-top:before {
  border-top-color: var(--border-color);
}

.leaflet-popup-content-wrapper {
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  backdrop-filter: blur(10px);
}

.leaflet-popup-content {
  font-family: inherit;
  color: var(--text-primary);
  min-width: 280px;
}

.leaflet-popup-content h6 {
  color: var(--accent-primary);
  margin-bottom: 12px;
  font-size: 1.125rem;
  font-weight: 600;
}

.leaflet-popup-content .btn {
  font-size: 0.875rem;
  padding: 8px 16px;
  margin-top: 8px;
  width: 100%;
}

/* ============================================
   4. ESTILOS DA TABELA DE DADOS
   ============================================ */
.table-container {
  background: var(--bg-card);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  margin-bottom: 2rem;
  animation: fadeIn 0.5s ease-out;
}

.table-responsive {
  overflow-x: auto;
  position: relative;
}

.table {
  width: 100%;
  margin-bottom: 0;
  color: var(--text-primary);
  border-collapse: separate;
  border-spacing: 0;
}

/* Cabeçalho da tabela com contraste garantido */
.table thead {
  background: var(--gradient-primary) !important;
  color: white !important;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 4px var(--shadow-color);
}

.table th {
  border: none !important;
  font-weight: 600;
  padding: 1rem 0.75rem;
  font-size: 0.875rem;
  white-space: nowrap;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  color: white !important;
  background: transparent !important;
}

.table td {
  padding: 0.875rem 0.75rem;
  vertical-align: middle;
  border-color: var(--border-color);
  font-size: 0.9375rem;
  background: var(--bg-card);
  transition: all var(--transition-fast);
  color: var(--text-primary) !important;
}

.table tbody tr {
  border-bottom: 1px solid var(--border-color);
  transition: all var(--transition-normal);
  position: relative;
}

.table tbody tr:hover {
  background-color: var(--bg-tertiary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--shadow-color);
  cursor: pointer;
  z-index: 2;
}

.table tbody tr:hover td {
  border-color: var(--accent-primary);
}

/* Colunas específicas */
.table td:first-child {
  min-width: 180px;
  font-weight: 600;
  position: sticky;
  left: 0;
  background: inherit;
  z-index: 1;
}

.table td:first-child strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.9375rem;
  color: var(--text-primary);
}

.table td:first-child .small {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.table td:nth-last-child(2) {
  max-width: 150px;
  word-wrap: break-word;
  font-size: 0.875rem;
  line-height: 1.4;
}

.table td:last-child {
  min-width: 180px;
}

/* Badges na tabela - Usando variáveis CSS */
.badge-emenda {
  display: inline-flex;
  align-items: center;
  background: var(--badge-emenda-bg);
  color: var(--badge-emenda-text);
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8125rem;
  border: 1px solid var(--badge-emenda-border);
  white-space: nowrap;
  min-width: 100px;
  justify-content: center;
  transition: all var(--transition-fast);
}

.badge-emenda:hover {
  filter: brightness(1.1);
  transform: scale(1.05);
}

.badge-votos {
  display: inline-flex;
  align-items: center;
  background: var(--badge-votos-bg);
  color: var(--badge-votos-text);
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8125rem;
  border: 1px solid var(--badge-votos-border);
  white-space: nowrap;
  min-width: 100px;
  justify-content: center;
  transition: all var(--transition-fast);
}

.badge-votos:hover {
  filter: brightness(1.1);
  transform: scale(1.05);
}

.badge-custo {
  display: inline-flex;
  align-items: center;
  background: var(--badge-custo-bg);
  color: var(--badge-custo-text);
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8125rem;
  border: 1px solid var(--badge-custo-border);
  white-space: nowrap;
  min-width: 100px;
  justify-content: center;
  transition: all var(--transition-fast);
}

.badge-custo:hover {
  filter: brightness(1.1);
  transform: scale(1.05);
}

/* Badges para áreas */
.table td:last-child .badge {
  display: inline-block;
  margin: 3px 5px 3px 0;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.table td:last-child .badge:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.badge-extra {
  background: var(--accent-primary) !important;
  color: white !important;
  border: none !important;
  font-size: 0.7rem !important;
  padding: 3px 8px !important;
  cursor: help;
}

/* Estados da tabela */
.table-empty {
  text-align: center;
  padding: 3rem !important;
  color: var(--text-muted);
  font-style: italic;
  background: var(--bg-tertiary);
}

.table-empty i {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* Ordenação da tabela */
.table th.sortable {
  cursor: pointer;
  position: relative;
  padding-right: 30px;
  user-select: none;
  transition: background-color var(--transition-fast);
}

.table th.sortable:hover {
  background: rgba(255, 255, 255, 0.1);
}

.table th.sortable::after {
  content: "↕";
  position: absolute;
  right: 12px;
  font-size: 0.75rem;
  opacity: 0.5;
  transition: opacity var(--transition-fast);
}

.table th.sortable.asc::after {
  content: "↑";
  opacity: 1;
}

.table th.sortable.desc::after {
  content: "↓";
  opacity: 1;
}

/* ============================================
   5. ESTILOS DOS CARDS DE ESTATÍSTICAS
   ============================================ */
.stats-card {
  background: var(--gradient-card);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  height: 100%;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.stats-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.stats-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-xl);
  border-color: var(--accent-primary);
}

.stats-card:hover::before {
  opacity: 1;
}

.stats-card .icon {
  width: 56px;
  height: 56px;
  border-radius: var(--border-radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  transition: all var(--transition-normal);
}

.stats-card:hover .icon {
  transform: scale(1.1) rotate(5deg);
}

.stats-card .icon.saude {
  background: rgba(239, 68, 68, 0.1);
  border: 2px solid rgba(239, 68, 68, 0.2);
  color: var(--icon-saude);
}

.stats-card .icon.educacao {
  background: rgba(16, 185, 129, 0.1);
  border: 2px solid rgba(16, 185, 129, 0.2);
  color: var(--icon-educacao);
}

.stats-card .icon.social {
  background: rgba(59, 130, 246, 0.1);
  border: 2px solid rgba(59, 130, 246, 0.2);
  color: var(--icon-social);
}

.stats-card .icon.seguranca {
  background: rgba(139, 92, 246, 0.1);
  border: 2px solid rgba(139, 92, 246, 0.2);
  color: var(--icon-seguranca);
}

.stats-card .icon.infra {
  background: rgba(245, 158, 11, 0.1);
  border: 2px solid rgba(245, 158, 11, 0.2);
  color: var(--icon-infra);
}

.stats-card .icon.esporte {
  background: rgba(236, 72, 153, 0.1);
  border: 2px solid rgba(236, 72, 153, 0.2);
  color: var(--icon-esporte);
}

.stats-card h3 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  color: var(--text-primary);
  line-height: 1.2;
}

.stats-card p {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin: 0 0 1rem 0;
}

.stats-card .trend {
  font-size: 0.8125rem;
  font-weight: 600;
  display: flex;
  align-items: center;
}

.stats-card .trend i {
  margin-right: 6px;
  font-size: 0.75rem;
}

.stats-card .trend.up {
  color: var(--success);
}

.stats-card .trend.down {
  color: var(--danger);
}

/* ============================================
   6. ESTILOS DOS GRÁFICOS
   ============================================ */
.chart-container {
  background: var(--gradient-card);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  height: 100%;
  transition: all var(--transition-normal);
}

.chart-container:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-primary);
}

.chart-container h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--accent-primary);
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.75rem;
  display: flex;
  align-items: center;
}

.chart-container h3 i {
  margin-right: 10px;
  font-size: 1.1rem;
}

.chart-container canvas {
  max-width: 100%;
  height: auto !important;
}

/* Tooltips dos gráficos */
.chartjs-tooltip {
  background: rgba(30, 41, 59, 0.95) !important;
  color: var(--text-primary) !important;
  border-radius: var(--border-radius-md) !important;
  padding: 12px !important;
  font-family: inherit !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: var(--shadow-lg) !important;
  backdrop-filter: blur(5px) !important;
}

/* Cores específicas para gráfico de dispersão */
.chart-scatter-bubble {
  background-color: var(--chart-scatter-bg) !important;
  border-color: var(--chart-scatter-border) !important;
}

/* ============================================
   7. ESTILOS DOS FORMULÁRIOS E CONTROLES
   ============================================ */
.form-select,
.form-control,
.form-range {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--border-radius-md);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  transition: all var(--transition-fast);
}

.form-select:focus,
.form-control:focus,
.form-range:focus {
  background: var(--bg-tertiary);
  border-color: var(--accent-primary);
  color: var(--text-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
  outline: none;
}

.form-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* Slider personalizado */
.form-range::-webkit-slider-thumb {
  background: var(--accent-primary);
  border: 2px solid var(--bg-card);
  box-shadow: var(--shadow-md);
  transition: all var(--transition-fast);
}

.form-range::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

.form-range::-moz-range-thumb {
  background: var(--accent-primary);
  border: 2px solid var(--bg-card);
  box-shadow: var(--shadow-md);
}

.form-range::-webkit-slider-track {
  background: var(--bg-tertiary);
  border-radius: 10px;
}

.slider-value {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent-primary);
  margin-top: 8px;
  display: inline-block;
  padding: 4px 10px;
  background: var(--bg-tertiary);
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
}

/* Botões */
.btn {
  font-weight: 500;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  border-radius: var(--border-radius-md);
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  cursor: pointer;
}

.btn-primary {
  background: var(--gradient-primary);
  border: none;
  color: white;
}

.btn-primary:hover {
  background: linear-gradient(
    135deg,
    var(--accent-secondary) 0%,
    var(--accent-tertiary) 100%
  );
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-outline-primary {
  background: transparent;
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.btn-outline-primary:hover {
  background: var(--accent-primary);
  color: white;
}

.btn-light,
.btn-outline-light {
  background: var(--bg-tertiary);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-light:hover,
.btn-outline-light:hover {
  background: var(--bg-secondary);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.btn-outline-secondary {
  border-color: var(--border-color);
  color: var(--text-secondary);
}

.btn-outline-secondary:hover {
  background: var(--bg-tertiary);
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

/* Botão de alternar tema */
.theme-toggle {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  margin-left: 10px;
}

.theme-toggle:hover {
  background: var(--accent-primary);
  color: white;
  transform: rotate(15deg);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.theme-toggle i {
  font-size: 1.2rem;
}

/* ============================================
   8. ESTILOS DO CHATBOT
   ============================================ */
.chatbot-toggle {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: white;
  border: none;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all var(--transition-normal);
}

.chatbot-toggle:hover {
  transform: scale(1.1) rotate(10deg);
  box-shadow: 0 6px 25px rgba(59, 130, 246, 0.6);
}

.chatbot-container {
  position: fixed;
  bottom: 100px;
  right: 30px;
  width: 380px;
  height: 520px;
  background: var(--bg-card);
  border-radius: var(--border-radius-xl);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  display: none;
  flex-direction: column;
  z-index: 1001;
  overflow: hidden;
  animation: slideInUp 0.3s ease-out;
}

.chatbot-header {
  background: var(--gradient-primary);
  color: white;
  padding: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chatbot-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chatbot-title i {
  font-size: 1.3rem;
}

.chatbot-title h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.chatbot-close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chatbot-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.chatbot-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-secondary);
}

.chatbot-message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 0.9375rem;
  line-height: 1.4;
  word-wrap: break-word;
  animation: fadeIn 0.2s ease-out;
  position: relative;
}

.chatbot-message.user {
  background: var(--gradient-primary);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 5px;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.chatbot-message.bot {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  align-self: flex-start;
  border-bottom-left-radius: 5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chatbot-suggestions {
  padding: 15px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-card);
}

.chatbot-suggestion {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.chatbot-suggestion:hover {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
  transform: translateY(-1px);
}

.chatbot-input {
  display: flex;
  padding: 15px;
  gap: 12px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-card);
}

.chatbot-input input {
  flex: 1;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 25px;
  padding: 12px 18px;
  color: var(--text-primary);
  font-size: 0.9375rem;
  transition: all var(--transition-fast);
}

.chatbot-input input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.chatbot-input button {
  background: var(--gradient-primary);
  color: white;
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.chatbot-input button:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* ============================================
   9. ESTILOS DOS MODAIS
   ============================================ */
.modal-content {
  background: var(--bg-card);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-xl);
}

.modal-header {
  background: var(--gradient-primary);
  color: white;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1.25rem 1.5rem;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-body {
  background: var(--bg-secondary);
  padding: 1.5rem;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  padding: 1rem 1.5rem;
}

.modal-body .card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  overflow: hidden;
  margin-bottom: 1rem;
  transition: all var(--transition-fast);
}

.modal-body .card:hover {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-md);
}

.modal-body .card-body {
  padding: 1rem;
}

.modal-body .card-title {
  color: var(--accent-primary);
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

/* ============================================
   10. ANIMAÇÕES
   ============================================ */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes highlight {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
  }
  70% {
    transform: scale(1.05);
    box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
  }
}

.stats-card,
.chart-container,
.table-container {
  animation: fadeIn 0.5s ease-out;
}

.highlight {
  animation: highlight 0.5s ease;
}

.loading-spinner {
  animation: spin 1s linear infinite;
}

/* ============================================
   11. SCROLLBAR PERSONALIZADA
   ============================================ */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border-radius: 6px;
}

::-webkit-scrollbar-thumb {
  background: var(--accent-primary);
  border-radius: 6px;
  border: 2px solid var(--bg-tertiary);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-secondary);
}

::-webkit-scrollbar-corner {
  background: var(--bg-tertiary);
}

/* Scrollbar para elementos específicos */
.chatbot-messages::-webkit-scrollbar,
.modal-body::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar {
  width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track,
.table-responsive::-webkit-scrollbar-track {
  background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb,
.table-responsive::-webkit-scrollbar-thumb {
  background: var(--border-color);
}

/* ============================================
   12. RESPONSIVIDADE
   ============================================ */
@media (max-width: 1200px) {
  .table-responsive {
    font-size: 0.875rem;
  }

  .table th,
  .table td {
    padding: 0.75rem;
  }

  .badge-emenda,
  .badge-votos,
  .badge-custo {
    min-width: 90px;
    font-size: 0.75rem;
    padding: 5px 10px;
  }

  .map-controls,
  .legend {
    width: 280px;
  }
}

@media (max-width: 992px) {
  .chart-container {
    margin-bottom: 1.5rem;
  }

  #map {
    height: 500px;
  }

  .stats-card h3 {
    font-size: 1.5rem;
  }
}

@media (max-width: 768px) {
  .header h1 {
    font-size: 1.4rem;
  }

  .map-controls,
  .legend {
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    width: 100%;
    margin: 0 0 1.5rem 0;
    animation: none;
  }

  #map {
    height: 400px;
    margin-bottom: 1rem;
  }

  .chatbot-container {
    width: calc(100% - 40px);
    height: 450px;
    right: 20px;
    left: 20px;
    bottom: 80px;
  }

  .chatbot-toggle {
    right: 20px;
    bottom: 20px;
  }

  .table th,
  .table td {
    padding: 0.625rem;
    font-size: 0.8125rem;
  }

  .table td:first-child {
    min-width: 140px;
  }

  .badge-emenda,
  .badge-votos,
  .badge-custo {
    min-width: 80px;
    font-size: 0.6875rem;
    padding: 4px 8px;
  }

  .table td:last-child .badge {
    font-size: 0.6875rem;
    padding: 3px 8px;
    margin: 2px 3px 2px 0;
  }
}

@media (max-width: 576px) {
  .header h1 {
    font-size: 1.2rem;
  }

  .stats-card {
    padding: 1.25rem;
  }

  .stats-card h3 {
    font-size: 1.375rem;
  }

  .stats-card .icon {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
  }

  .chart-container {
    padding: 1.25rem;
  }

  .chart-container h3 {
    font-size: 1.125rem;
  }

  .btn {
    padding: 0.4375rem 0.875rem;
    font-size: 0.8125rem;
  }

  .custom-pointer-icon {
    transform: scale(0.9);
  }
}

/* ============================================
   13. ESTILOS DE IMPRESSÃO
   ============================================ */
@media print {
  body {
    background: white !important;
    color: black !important;
  }

  .container {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
  }

  .header {
    background: white !important;
    color: black !important;
    box-shadow: none !important;
    border-bottom: 2px solid #000 !important;
  }

  .stats-card,
  .chart-container,
  .table-container {
    border: 1px solid #000 !important;
    box-shadow: none !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  #map {
    height: 400px;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  .table {
    border: 1px solid #000 !important;
  }

  .table thead {
    background: #f0f0f0 !important;
    color: black !important;
    border: 1px solid #000 !important;
  }

  .table td {
    border: 1px solid #000 !important;
  }

  .badge-emenda,
  .badge-votos,
  .badge-custo {
    background: #f0f0f0 !important;
    color: black !important;
    border: 1px solid #000 !important;
  }

  a {
    color: black !important;
    text-decoration: underline !important;
  }

  .btn,
  .map-controls,
  .legend,
  .chatbot-toggle,
  .chatbot-container,
  .theme-toggle {
    display: none !important;
  }
}

/* ============================================
   14. ACESSIBILIDADE
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  .stats-card,
  .chart-container,
  .table-container,
  .map-marker,
  .custom-pointer-icon i,
  .btn,
  .chatbot-message,
  .theme-toggle,
  .chatbot-suggestion {
    animation: none !important;
    transition: none !important;
  }
}

@media (prefers-contrast: high) {
  .stats-card,
  .chart-container,
  .table-container,
  .map-controls,
  .legend,
  .chatbot-container,
  .modal-content {
    border: 2px solid currentColor !important;
  }

  .table thead {
    background: #000 !important;
    color: #fff !important;
  }

  .btn-primary {
    background: #000 !important;
    color: #fff !important;
  }
}

/* ============================================
   15. UTILITÁRIOS
   ============================================ */
.filter-active {
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.2) 0%,
    rgba(59, 130, 246, 0.1) 100%
  ) !important;
  border-color: var(--accent-primary) !important;
  color: var(--accent-primary) !important;
  font-weight: 600;
}

.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cursor-pointer {
  cursor: pointer;
}

.user-select-none {
  user-select: none;
}

/* ============================================
   16. LOADING STATES
   ============================================ */
.loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(5px);
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid var(--bg-tertiary);
  border-top: 4px solid var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* ============================================
   17. ESTILOS PARA CORES DOS ASSESSORES
   ============================================ */
.assessor-names {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.assessor-names span {
  display: block;
  margin-bottom: 2px;
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--bg-tertiary);
  transition: all var(--transition-fast);
}

.assessor-names span:hover {
  background: var(--accent-primary);
  color: white;
}

/* ============================================
   18. ESTILOS PARA ÁREAS NA TABELA
   ============================================ */
.areas-container {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.areas-container .badge {
  transition: all var(--transition-fast);
}

.areas-container .badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ============================================
   19. ANIMAÇÕES PARA ATUALIZAÇÃO DE TEMA
   ============================================ */
.theme-transition * {
  transition:
    background-color var(--transition-normal),
    color var(--transition-normal),
    border-color var(--transition-normal),
    box-shadow var(--transition-normal) !important;
}

/* ============================================
   20. ESTILOS PARA MENSAGENS DE ERRO/VAZIO
   ============================================ */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state h4 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.empty-state p {
  font-size: 0.875rem;
  max-width: 400px;
  margin: 0 auto;
}

/* ============================================
   FIM DO DASHBOARD.CSS
   ============================================ */
