/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  color: #3d3d3a;
  background: transparent;
  padding: 8px 0 16px;
  /* overflow-y: auto permite scroll vertical quando o conteúdo passa da
   * altura da tela. overflow-x: hidden mantém a regra original (sem scroll
   * horizontal — a tabela já tem #tabela-container com overflow-x:auto
   * próprio). */
  overflow-x: hidden;
  overflow-y: auto;
}

#app { max-width: 780px; margin: 0 auto; }

/* ── Fonte Lato ──────────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;700&display=swap');

/* ── Barra de filtros ────────────────────────────────────────────────────────── */
#filtro-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 0;
  flex-wrap: nowrap;
}

#filtro-geo { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 0; }

.pill-row { display: flex; flex-wrap: wrap; gap: 5px; }

.pill {
  display: inline-flex; align-items: center;
  padding: 3px 11px; border-radius: 20px;
  font-size: 10.5px; font-weight: 700;
  cursor: pointer;
  border: 1.5px solid rgba(4,42,101,0.25);
  background: rgba(255,255,255,0.85);
  color: #042A65;
  letter-spacing: 0.02em;
  transition: background .13s, color .13s, border-color .13s, box-shadow .13s;
  white-space: nowrap; user-select: none;
  box-shadow: 0 1px 3px rgba(4,42,101,0.10);
}
.pill:hover { background: #fff; border-color: #042A65; }
.pill.pill-active {
  background: #042A65; color: #fff; border-color: #042A65;
  box-shadow: 0 2px 6px rgba(4,42,101,0.25);
}
.pill.pill-active:hover { background: #0a3a8a; }

.pill-estado { padding: 3px 9px; font-size: 10.5px; border-radius: 5px; min-width: 34px; justify-content: center; }
.pill-nacional { font-weight: 600; background: rgba(255,255,255,0.60); border-color: rgba(4,42,101,0.18); color: #5a7a9a; }
.pill-nacional:hover { background: rgba(255,255,255,0.92); color: #042A65; }

/* Lado direito */
#filtro-direita { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }

#filtro-busca {
  height: 32px; padding: 0 12px;
  border: 1.5px solid rgba(4,42,101,0.22);
  border-radius: 20px; font-size: 12.5px; font-family: inherit;
  color: #3d3d3a; background: rgba(255,255,255,0.85);
  outline: none; width: 140px;
  transition: border-color .14s, box-shadow .14s;
}
#filtro-busca:focus {
  border-color: #042A65;
  box-shadow: 0 0 0 2px rgba(4,42,101,.12);
  background: #fff;
}
#filtro-busca::placeholder { color: #8a9aaa; }

.rem-toggle-grupo { display: flex; align-items: center; gap: 6px; }
.rem-toggle-label { font-size: 11.5px; font-weight: 600; color: #5a7a9a; white-space: nowrap; user-select: none; }

.rem-toggle {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1.5px solid rgba(4,42,101,0.25);
  background: rgba(255,255,255,0.85); color: #042A65;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background .13s, color .13s, border-color .13s;
  box-shadow: 0 1px 3px rgba(4,42,101,0.10);
}
.rem-toggle svg { width: 16px; height: 16px; }
.rem-toggle:hover { background: #fff; border-color: #042A65; }
.rem-toggle.rem-toggle-ativo { background: #042A65; color: #fff; border-color: #042A65; }

/* ── Painel salário ──────────────────────────────────────────────────────────── */
#filtro-rem-painel { width: 100%; margin-top: 6px; margin-bottom: 2px; }
#filtro-rem-painel.hidden { display: none; }

.rem-painel-inner {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,0.85);
  border: 1.5px solid rgba(4,42,101,0.18);
  border-radius: 20px; padding: 6px 16px; flex-wrap: wrap;
}
.rem-label { font-size: 11px; color: #5a7a9a; font-weight: 600; white-space: nowrap; }
#slider-rem { flex: 1; min-width: 120px; max-width: 300px; accent-color: #042A65; cursor: pointer; height: 4px; }
.rem-valor { font-size: 12px; font-weight: 700; color: #042A65; white-space: nowrap; min-width: 80px; }
.rem-limpar { background: none; border: none; cursor: pointer; color: #8a9aaa; font-size: 13px; padding: 0 2px; transition: color .13s; }
.rem-limpar:hover { color: #c0392b; }

/* ── Contador ────────────────────────────────────────────────────────────────── */
#tabela-info { display: flex; justify-content: flex-end; margin: 6px 0 4px; }
#contador-resultados { font-size: 11.5px; color: #7a8fa8; font-style: italic; }

/* ── Wrapper principal da tabela ─────────────────────────────────────────────── */
#tabela-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ── ts-wrap: container externo ──────────────────────────────────────────────── */
.ts-wrap {
  font-family: 'Lato', sans-serif;
  font-size: 15px; color: #3d3d3a;
  max-width: 780px;
}

/* ── Cabeçalho collapsível ───────────────────────────────────────────────────── */
.ts-title-bar {
  display: flex; align-items: center; gap: 12px;
  padding: .95rem 1.2rem;
  background: #042A65;
  border-radius: 12px;
  cursor: pointer; user-select: none;
  transition: background .15s;
  margin-bottom: 0;
}
.ts-wrap.open .ts-title-bar { border-radius: 12px 12px 0 0; }
.ts-title-bar:hover { background: #0a3a8a; }
.ts-title-text { flex: 1; font-size: 15px; font-weight: 700; color: #fff; }
.ts-title-arrow { font-size: 13px; color: #fff; opacity: .75; transition: transform .22s; display: inline-block; }
.ts-wrap.open .ts-title-arrow { transform: rotate(180deg); opacity: 1; }

/* ── Corpo da tabela ─────────────────────────────────────────────────────────── */
.ts-body {
  display: none;
  border: 0.5px solid rgba(4,42,101,0.18);
  border-top: none;
  border-radius: 0 0 12px 12px;
  overflow: hidden;
}
.ts-wrap.open .ts-body { display: block; }

/* ── Tabela interna ──────────────────────────────────────────────────────────── */
.ts-table { width: 100%; border-collapse: collapse; }

.ts-thead th {
  background: #D5E1EB; color: #042A65;
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
  padding: .7rem .9rem; text-align: center;
  border-bottom: 1px solid rgba(4,42,101,0.15);
  white-space: nowrap; user-select: none; cursor: pointer;
  transition: background .13s;
}
.ts-thead th:hover { background: #c4d5e5; }
.ts-thead th.col-concurso { text-align: left; }
.ts-thead th .sort-icon { margin-left: 3px; font-size: 9px; opacity: .6; }
.ts-thead th.ativo .sort-icon { opacity: 1; }

/* ── Linhas ──────────────────────────────────────────────────────────────────── */
.ts-row {
  cursor: pointer;
  transition: background .13s;
  border-bottom: 0.5px solid rgba(0,0,0,0.07);
}
.ts-row:last-of-type { border-bottom: none; }
.ts-row:hover { background: #f0f5f9; }
.ts-row.open { background: #f0f5f9; }

.ts-row td {
  padding: .75rem .9rem;
  font-size: 14px; color: #3d3d3a;
  line-height: 1.45; vertical-align: middle;
  text-align: center;
}

/* Coluna instituição
 * width 18% e max-width fixo evitam que nomes longos (ex.: "Prefeitura de
 * Santo Antônio de Pádua - RJ") empurrem a coluna PROVA para fora da tabela.
 * Trocamos `white-space: nowrap` por `normal` + `word-break: break-word` —
 * nomes longos quebram em 2 linhas dentro do limite, sem cortar texto. */
.ts-thead th.col-concurso,
.ts-row td.col-concurso {
  width: 18%;
  max-width: 180px;
}
.ts-row td.col-concurso {
  font-weight: 700; color: #042A65;
  white-space: normal;
  word-break: break-word;
  line-height: 1.3;
  font-size: 14px;
  text-align: left;
}

/* Coluna cargos */
.ts-row td.col-cargos { font-size: 13px; line-height: 1.55; }

.cargo-item { display: inline; }
.cargo-item + .cargo-item::before { content: '; '; color: #9aabb8; }
.cargo-vazio { color: #aab8c4; }

/* Coluna salário */
.ts-salary {
  display: inline-flex; align-items: center; gap: 5px;
  background: #eaf3de; color: #3b6d11;
  font-weight: 700; font-size: 13px;
  padding: 4px 11px; border-radius: 20px; white-space: nowrap;
}
.ts-salary-icon { font-size: 11px; color: #3b6d11; opacity: .7; transition: transform .2s; }
.ts-row.open .ts-salary-icon { transform: rotate(180deg); opacity: 1; }

/* Colunas datas/banca */
.ts-row td.col-inscricoes,
.ts-row td.col-prova { white-space: nowrap; font-size: 13px; }

/* Recebe os 4% emprestados de .col-concurso para evitar corte da última coluna
 * "DATA DA PROVA" após o display passar a sempre incluir UF (commit cf83941). */
.ts-thead th.col-prova,
.ts-row td.col-prova {
  width: 16%;
  min-width: 100px;
}
.ts-row td.col-banca { font-size: 13px; white-space: nowrap; }
.ts-row td.col-banca .col-banca-tipo {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
  font-weight: 400;
  white-space: nowrap;
}

/* Banca como link */
.banca-link {
  color: #042A65; font-weight: 600; text-decoration: none;
  border-bottom: 1px dashed rgba(4,42,101,0.35);
  transition: color .13s, border-color .13s;
}
.banca-link:hover { color: #0a3a8a; border-bottom-color: #0a3a8a; }

/* ── Linha de detalhe (expansível) ───────────────────────────────────────────── */
.ts-detail-row { display: none; border-bottom: 0.5px solid rgba(0,0,0,0.07); }
.ts-detail-row.open { display: table-row; }
.ts-detail-row td { padding: 0; }
.ts-detail-inner {
  padding: .85rem 1rem .85rem 1.1rem;
  background: #D5E1EB;
  border-left: 3px solid #042A65;
  font-size: 14px; color: #3d3d3a;
  line-height: 1.6;
}
.ts-detail-inner strong { color: #042A65; font-weight: 700; }
.ts-detail-grid {
  display: flex; flex-wrap: wrap; gap: 16px;
}
.ts-detail-item { display: flex; flex-direction: column; gap: 2px; min-width: 140px; }
.ts-detail-label {
  font-size: 11px; font-weight: 700; color: #042A65;
  text-transform: uppercase; letter-spacing: .05em;
}
.ts-detail-value { font-size: 13px; color: #3d3d3a; }

/* ── Mobile label (hidden desktop) ──────────────────────────────────────────── */
.ts-mobile-label { display: none; font-size: 11px; font-weight: 700; color: #888780; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 3px; }

/* ── Sem resultados ──────────────────────────────────────────────────────────── */
#sem-resultados {
  padding: 32px 20px; text-align: center;
  color: #6a7a8a; font-size: 14px;
  background: #D5E1EB; border-radius: 0 0 12px 12px;
}

/* ── Responsivo ──────────────────────────────────────────────────────────────── */
@media (max-width: 580px) {
  body { padding: 6px 0; }
  #filtro-bar { flex-direction: column; }
  #filtro-direita { width: 100%; justify-content: space-between; }
  #filtro-busca { flex: 1; width: auto; }
  .ts-thead th:nth-child(3),
  .ts-thead th:nth-child(4) { display: none; }
  .ts-row td:nth-child(3),
  .ts-row td:nth-child(4) { display: none; }
  .ts-mobile-label { display: block; }
  .ts-title-text { font-size: 14px; }
  .ts-row td { padding: .65rem .75rem; font-size: 13px; }
  .ts-salary { font-size: 12px; padding: 3px 9px; }
}
