/* ─────────────────────────────────────────────
   Dashboard Pesquisadores — OEBP
   ───────────────────────────────────────────── */

.pesq-dashboard {
  font-family: 'Sora', 'Segoe UI', sans-serif;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

/* ── Carregando ── */
.pesq-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 80px 20px;
  color: #888;
  font-size: 14px;
}

.pesq-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #ece9fb;
  border-top-color: #5f54d8;
  border-radius: 50%;
  animation: pesq-spin 0.8s linear infinite;
}

@keyframes pesq-spin {
  to { transform: rotate(360deg); }
}

/* ── KPIs ── */
.pesq-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
  width: 100%;
}

.pesq-kpi-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  border-top: 4px solid #5f54d8;
  min-width: 0;
}

.pesq-kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: #888;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pesq-kpi-valor {
  font-size: 22px;
  font-weight: 700;
  color: #2c2c2c;
  line-height: 1;
  margin-bottom: 4px;
  word-break: break-word;
}

.pesq-kpi-sub {
  font-size: 10px;
  color: #aaa;
}

/* ── Layout principal ── */
.pesq-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 20px;
  margin-bottom: 24px;
  width: 100%;
  box-sizing: border-box;
}

/* ── Sidebar filtros ── */
.pesq-sidebar {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  height: fit-content;
  position: sticky;
  top: 20px;
  min-width: 0;
  box-sizing: border-box;
}

.pesq-sidebar-titulo {
  font-size: 14px;
  font-weight: 700;
  color: #5f54d8;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pesq-filtro-grupo { margin-bottom: 18px; }

.pesq-filtro-label {
  font-size: 11px;
  font-weight: 700;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
  display: block;
}

.pesq-filtro-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  color: #333;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

.pesq-filtro-input:focus { outline: none; border-color: #5f54d8; }

.pesq-filtro-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.pesq-btn-limpar {
  width: 100%;
  padding: 8px;
  background: #f5f0ff;
  color: #5f54d8;
  border: 1px solid #e0d8ff;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.2s;
  box-sizing: border-box;
}

.pesq-btn-limpar:hover { background: #ebe4ff; }

/* ── Conteúdo direito ── */
.pesq-conteudo {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  overflow: hidden;
}

/* ── Barra de ações ── */
.pesq-acoes {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.pesq-tabela-info { font-size: 13px; color: #888; }

.pesq-tabela-hint {
  font-size: 12px;
  color: #5f54d8;
  font-weight: 600;
}

.pesq-btn-exportar {
  padding: 9px 18px;
  background: #5f54d8;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.pesq-btn-exportar:hover { background: #4a41c0; }

/* ── Tabela ── */
.pesq-tabela-wrap {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  overflow-x: auto;
  overflow-y: auto;
  max-height: 420px;
  width: 100%;
  box-sizing: border-box;
}

.pesq-tabela {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: auto;
}

.pesq-th {
  padding: 12px 10px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: #fafafa;
  border-bottom: 2px solid #f0f0f0;
  cursor: pointer;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
  user-select: none;
}

.pesq-th:hover { background: #f0edff; color: #5f54d8; }
.pesq-th.ativo { color: #5f54d8; background: #f0edff; }

.pesq-tr { cursor: pointer; transition: background 0.1s; }
.pesq-tr:hover { background: #f8f6ff; }
.pesq-tr:nth-child(even) { background: #fafafa; }
.pesq-tr:nth-child(even):hover { background: #f0edff; }

.pesq-td {
  padding: 10px 10px;
  border-bottom: 1px solid #f0f0f0;
  white-space: nowrap;
  color: #444;
}

.pesq-td-mun { font-weight: 600; color: #333; }

.pesq-tr-icon { opacity: 0; font-size: 12px; transition: opacity 0.15s; }
.pesq-tr:hover .pesq-tr-icon { opacity: 0.7; }

/* ── Comparativo ── */
.pesq-comparativo {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.pesq-comparativo-titulo {
  font-size: 15px;
  font-weight: 700;
  color: #333;
  margin-bottom: 16px;
}

.pesq-comp-inputs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  align-items: flex-start;
}

.pesq-comp-input-wrap {
  position: relative;
  flex: 1;
  min-width: 140px;
  max-width: 100%;
}

.pesq-comp-input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #e0d8ff;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
}

.pesq-comp-input:focus { border-color: #5f54d8; }

.pesq-comp-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  list-style: none;
  margin: 0;
  padding: 0;
  z-index: 200;
  display: none;
  max-height: 180px;
  overflow-y: auto;
}

.pesq-comp-suggestions li {
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
  color: #333;
  border-bottom: 1px solid #f0f0f0;
}

.pesq-comp-suggestions li:hover { background: #f0edff; color: #5f54d8; }

.pesq-btn-comparar {
  padding: 10px 20px;
  background: #ef7f33;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
  align-self: flex-start;
  margin-top: 2px;
}

.pesq-btn-comparar:hover { background: #d46a20; }

.pesq-comp-tabela {
  overflow-x: auto;
  margin-bottom: 16px;
  width: 100%;
}

.pesq-comp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.pesq-comp-table th {
  padding: 10px 14px;
  background: #5f54d8;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
}

.pesq-comp-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #f0f0f0;
  color: #444;
}

.pesq-comp-ind { font-weight: 600; color: #333; background: #fafafa; }
.pesq-comp-table tr:hover td { background: #f8f6ff; }

.pesq-comp-chart-wrap {
  height: 260px;
  position: relative;
  width: 100%;
}

/* ── Modal série histórica ── */
#pesq-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.pesq-modal-box {
  background: #fff;
  border-radius: 16px;
  padding: 28px;
  width: 90%;
  max-width: 800px;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  box-sizing: border-box;
}

.pesq-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.pesq-modal-header h3 { margin: 0; font-size: 20px; font-weight: 700; color: #333; }

#pesq-modal-fechar {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #888;
  line-height: 1;
}

.pesq-modal-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.pesq-modal-chart-card { background: #fafafa; border-radius: 10px; padding: 14px; min-width: 0; }

.pesq-modal-chart-label {
  font-size: 11px;
  font-weight: 700;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.pesq-modal-chart-wrap { height: 150px; position: relative; }

/* ── Notas metodológicas ── */
.pesq-notas {
  background: #f8f6ff;
  border-radius: 12px;
  padding: 20px;
  border-left: 4px solid #5f54d8;
  margin-top: 8px;
  box-sizing: border-box;
}

.pesq-notas-titulo { font-size: 13px; font-weight: 700; color: #5f54d8; margin-bottom: 10px; }

.pesq-notas-lista {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pesq-notas-lista li {
  font-size: 12px;
  color: #666;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.pesq-notas-lista li::before { content: "•"; color: #5f54d8; font-weight: 700; flex-shrink: 0; }

/* ── Responsivo ── */
@media (max-width: 1024px) {
  .pesq-layout { grid-template-columns: 1fr; }
  .pesq-sidebar { position: static; }
  .pesq-kpi-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
}

@media (max-width: 768px) {
  .pesq-kpi-grid { grid-template-columns: 1fr 1fr; }
  .pesq-modal-charts { grid-template-columns: 1fr; }
  .pesq-comp-inputs { flex-direction: column; }
  .pesq-comp-input-wrap { min-width: 100%; }
}

@media (max-width: 480px) {
  .pesq-kpi-grid { grid-template-columns: 1fr; }
  .pesq-kpi-valor { font-size: 18px; }
}