:root {
  --bg: #0a0e1a;
  --surface: #111827;
  --surface2: #1a2235;
  --border: #1e2d45;
  --accent: #e8a020;
  --accent2: #f0c060;
  --text: #e8edf5;
  --text-muted: #6b7fa0;
  --highlight: #2a4a7f;
  --header-h: 88px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Barlow', sans-serif;
  height: 100vh;
  overflow: hidden;
}

/* ── Header ── */
header {
  height: var(--header-h);
  background: linear-gradient(135deg, #0a0e1a 0%, #111827 100%);
  border-bottom: 2px solid var(--accent);
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
header::before {
  content: '';
  position: absolute; top: -40px; right: -40px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(232,160,32,0.12) 0%, transparent 70%);
  pointer-events: none;
}
.header-left h1 {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900;
  font-size: 2rem;
  letter-spacing: 0.04em;
  color: var(--accent);
  text-transform: uppercase;
  line-height: 1;
}
.header-left p {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 300;
  margin-top: 3px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.header-stats { display: flex; gap: 36px; align-items: center; }
.stat-box { text-align: center; }
.stat-box .num {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 2.2rem; font-weight: 900;
  color: var(--accent); line-height: 1;
}
.stat-box .lbl {
  font-size: 0.68rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.1em;
}

/* ── Layout 3 colunas ── */
.main {
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  grid-template-rows: 1fr;
  height: calc(100vh - var(--header-h));
}

/* ── Coluna esquerda: Ranking ── */
.ranking-panel {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 16px 0;
  overflow: hidden;
}
.ranking-panel .section-title {
  flex-shrink: 0;
  margin-bottom: 12px;
}
.ranking-bars {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-bottom: 16px;
  min-height: 0;
}
.ranking-bars::-webkit-scrollbar { width: 3px; }
.ranking-bars::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Coluna central: Mapa ── */
.map-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}
#map-container {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
}
#brazil-map {
  display: block;
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  max-width: 100%;
  max-height: 100%;
}

/* ── Coluna direita: Detalhes ── */
.detail-panel {
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.detail-section {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
}
.detail-section::-webkit-scrollbar { width: 4px; }
.detail-section::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Loading spinner ── */
.map-loading {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column;
  align-items: center; gap: 12px;
  color: var(--text-muted); font-size: 0.78rem;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Estado paths ── */
.state-path { transition: fill 0.2s, filter 0.2s; }

/* ── Tooltip ── */
#tooltip {
  position: fixed;
  background: rgba(10,14,26,0.96);
  border: 1px solid var(--accent);
  border-radius: 6px; padding: 8px 14px;
  pointer-events: none; z-index: 9999; display: none;
  font-family: 'Barlow Condensed', sans-serif;
  min-width: 140px;
}
#tooltip .tt-uf   { font-size: 1.1rem; font-weight: 900; color: var(--accent); }
#tooltip .tt-name { font-size: 0.72rem; color: var(--text-muted); }
#tooltip .tt-count{ font-size: 0.8rem; color: var(--text); margin-top: 2px; }

/* ── Legenda e hint ── */
.legend {
  position: absolute; bottom: 14px; left: 18px;
  display: flex; align-items: center; gap: 6px;
}
.legend-label { font-size: 0.62rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; }
.legend-bar { display: flex; height: 7px; border-radius: 4px; overflow: hidden; width: 90px; }
.legend-bar span { flex: 1; }
.lg1{background:#132a50}.lg2{background:#1a3a6a}.lg3{background:#204880}
.lg4{background:#285898}.lg5{background:#3068b0}.lg6{background:#3a78c8}.lg7{background:#4888e0}
.map-hint {
  position: absolute; bottom: 14px; right: 18px;
  font-size: 0.65rem; color: var(--text-muted);
  letter-spacing: 0.07em; text-transform: uppercase;
}

/* ── Componentes comuns ── */
.section-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.72rem; font-weight: 700;
  color: var(--accent); text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* ── Rank items ── */
.rank-item {
  display: flex; align-items: center; gap: 7px;
  cursor: pointer; padding: 4px 6px;
  border-radius: 4px; transition: background 0.15s;
  flex-shrink: 0;
}
.rank-item:hover  { background: var(--surface2); }
.rank-item.active { background: rgba(232,160,32,0.1); }
.rank-uf {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700; font-size: 0.85rem;
  color: var(--text-muted); width: 26px; flex-shrink: 0;
}
.rank-bar-wrap { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.rank-bar {
  height: 100%;
  background: linear-gradient(90deg,#285898,#4888e0);
  border-radius: 3px; transition: width 0.5s ease;
}
.rank-item.active .rank-bar { background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.rank-count {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700; font-size: 0.85rem;
  color: var(--text); width: 22px; text-align: right; flex-shrink: 0;
}

/* ── Detail placeholder ── */
.detail-placeholder {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%; gap: 12px;
  color: var(--text-muted); text-align: center; padding: 24px;
}
.detail-placeholder .icon { font-size: 2.4rem; opacity: 0.2; }
.detail-placeholder p {
  font-size: 0.78rem; letter-spacing: 0.06em;
  text-transform: uppercase; line-height: 1.7;
}

/* ── Cabeçalho do estado selecionado ── */
.state-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.state-name-big {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 2rem; font-weight: 900;
  color: var(--accent); text-transform: uppercase;
  letter-spacing: 0.04em; line-height: 1;
}
.state-fullname {
  font-size: 0.72rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em; margin-top: 3px;
}
.state-count-badge {
  background: var(--accent); color: #0a0e1a;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900; font-size: 1.6rem;
  border-radius: 8px; width: 52px; height: 52px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; line-height: 1;
}
.state-count-badge .badge-label {
  font-size: 0.44rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.65;
}

/* ── Lista de associados ── */
.associates-list { display: flex; flex-direction: column; gap: 5px; }
.associate-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--highlight);
  border-radius: 0 5px 5px 0;
  padding: 7px 10px;
  transition: border-left-color 0.2s;
  animation: slideIn 0.25s ease forwards;
  opacity: 0;
}
.associate-item:hover { border-left-color: var(--accent); background: #1e2a40; }
@keyframes slideIn { from{opacity:0;transform:translateX(-5px)} to{opacity:1;transform:translateX(0)} }
.assoc-num  { font-family:'Barlow Condensed',sans-serif; font-size:0.62rem; font-weight:600; color:var(--text-muted); letter-spacing:0.08em; }
.assoc-name { font-weight:500; font-size:0.84rem; color:var(--text); margin:2px 0; }
.assoc-city { font-size:0.71rem; color:var(--text-muted); }
