/* Dashboard Estatico — estilo minimo */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f5f5f5;
  color: #333;
}

header {
  background: #1a5276;
  color: #fff;
  padding: 0.8rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}

header h1 {
  font-size: 1.3rem;
  font-weight: 600;
}

/* Layout: dois mapas lado a lado */
main {
  padding: 0.5rem;
}

.mapas-container {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}

.mapa-painel {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
}

.painel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.6rem;
  background: #fff;
  border-radius: 6px 6px 0 0;
  border: 1px solid #ddd;
  border-bottom: none;
}

.painel-header h2 {
  font-size: 1rem;
  font-weight: 600;
  color: #1a5276;
}

.btn-csv {
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  background: #1a5276;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.btn-csv:hover {
  background: #154360;
}

.mapa {
  width: 100%;
  height: 420px;
  border: 1px solid #ddd;
}

/* Legenda */
.legenda {
  background: rgba(255,255,255,0.95);
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-top: none;
  font-size: 0.8rem;
  min-height: 30px;
}

.nota-dados {
  margin: 0.6rem 0;
  color: #444;
  font-size: 0.85rem;
}

.legenda h4 {
  margin-bottom: 4px;
  font-size: 0.82rem;
}

.legenda-item {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.legenda-cor {
  width: 18px;
  height: 12px;
  border: 1px solid #999;
  flex-shrink: 0;
}

.legenda-items {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}

/* Ranking tables */
.ranking-container {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.ranking-card {
  flex: 1;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 0.5rem;
  overflow-x: auto;
}

.ranking-card h3 {
  font-size: 0.85rem;
  margin-bottom: 0.3rem;
  color: #1a5276;
}

.ranking-card table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.ranking-card th,
.ranking-card td {
  text-align: left;
  padding: 3px 6px;
  border-bottom: 1px solid #eee;
}

.ranking-card th {
  font-weight: 600;
  background: #f8f9fa;
}

.ranking-card td.num {
  text-align: right;
}

/* Voltar ao Brasil button */
.btn-voltar {
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  background: #c0392b;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin-left: 0.5rem;
}

.btn-voltar:hover {
  background: #a93226;
}

/* Tooltip */
.info-tooltip {
  background: rgba(255,255,255,0.95);
  padding: 6px 10px;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  font-size: 0.85rem;
  line-height: 1.4;
}

/* ── Tab navigation ──────────────────────────────────────────────────── */
#tab-nav {
  display: flex;
  gap: 0.3rem;
  margin-left: auto;
}

.tab-btn {
  padding: 0.4rem 1rem;
  font-size: 0.9rem;
  background: transparent;
  color: rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 4px 4px 0 0;
  cursor: pointer;
  font-weight: 500;
}

.tab-btn.active {
  background: #f5f5f5;
  color: #1a5276;
  border-bottom-color: #f5f5f5;
  font-weight: 600;
}

.tab-btn:hover:not(.active) {
  background: rgba(255,255,255,0.15);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ── Series controls ─────────────────────────────────────────────────── */
#series-controles {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.9rem;
  flex-wrap: wrap;
  padding: 0.6rem 0.8rem;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  margin-bottom: 0.5rem;
}

#series-controles select {
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  border: 1px solid #ccc;
  font-size: 0.9rem;
}

#series-controles .hint {
  font-size: 0.75rem;
  color: #888;
  display: block;
}

#tab-series {
  padding: 0.5rem;
}

#series-chart {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 0.5rem;
}

.caption {
  font-size: 0.8rem;
  color: #666;
  margin-top: 0.3rem;
}

/* Decomposicao sazonal */
#decomp-section {
  margin-top: 1.5rem;
  border-top: 1px solid #ddd;
  padding-top: 1rem;
}

.decomp-titulo {
  font-size: 1rem;
  margin: 0 0 0.5rem 0;
  color: #333;
}

#decomp-controles {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  flex-wrap: wrap;
  padding: 0.6rem 0.8rem;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  margin-bottom: 0.5rem;
}

#decomp-controles select {
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  border: 1px solid #ccc;
  font-size: 0.9rem;
}

#decomp-chart {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 0.5rem;
}

/* Map controls — inside tab-mapa */
#controles {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  flex-wrap: wrap;
  padding: 0.4rem 0.6rem;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  margin-bottom: 0.5rem;
}

#controles select {
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  border: 1px solid #ccc;
  font-size: 0.9rem;
}

/* Responsive: empilhar em telas estreitas */
@media (max-width: 900px) {
  .mapas-container {
    flex-direction: column;
  }
  #tab-nav {
    margin-left: 0;
    margin-top: 0.4rem;
  }
}
