/* =========================================================
   TABELA-PRECOS.CSS — Tabelas filtráveis interativas
   Padrão visual: clean, fundo branco, filtros compactos
   ========================================================= */

/* ───── Toolbar (sticky, fundo branco, 2 linhas compactas) ───── */
.tp-toolbar {
  background: #ffffff;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 14px 16px;
  margin: 0 0 24px;
  box-shadow: 0 2px 10px rgba(0, 60, 113, 0.06);
  position: sticky;
  top: 73px;
  z-index: 20;
}

.tp-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px;
}

.tp-toolbar-row + .tp-toolbar-row {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #EEF2F7;
  align-items: center;
}

.tp-filter {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 140px;
  min-width: 130px;
}

.tp-filter--search {
  flex: 2 1 220px;
}

.tp-filter label {
  font-size: 0.62rem;
  font-weight: 700;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.tp-filter select,
.tp-filter input[type="search"] {
  background: #fff;
  color: #1E293B;
  border: 1px solid #CBD5E1;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: inherit;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.tp-filter select {
  appearance: none;
  cursor: pointer;
  padding-right: 28px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.tp-filter input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  height: 14px;
  width: 14px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><line x1='18' y1='6' x2='6' y2='18'/><line x1='6' y1='6' x2='18' y2='18'/></svg>");
  cursor: pointer;
}

.tp-filter select:focus,
.tp-filter input:focus {
  outline: none;
  border-color: #003C71;
  box-shadow: 0 0 0 2px rgba(0, 60, 113, 0.12);
}

.tp-toolbar-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: #475569;
  flex: 1;
}

.tp-toolbar-meta strong { color: #003C71; }

.tp-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #EEF4FF;
  color: #003C71;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}
.tp-badge i { width: 13px; height: 13px; }

.tp-badge--complete {
  background: #ECFDF5;
  color: #047857;
}
.tp-badge--partial {
  background: #FFFBEB;
  color: #92400E;
}

.tp-toolbar-actions {
  display: flex;
  gap: 10px;
  margin-left: auto;
  align-items: center;
  flex-wrap: wrap;
}

/* Toggle "cobertura completa" */
.tp-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
  user-select: none;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.tp-toggle:hover {
  background: #F8FAFC;
  border-color: #E2E8F0;
  color: #003C71;
}
.tp-toggle input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.tp-toggle-slider {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 18px;
  background: #CBD5E1;
  border-radius: 999px;
  transition: background 0.18s;
  flex-shrink: 0;
}
.tp-toggle-slider::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
  transition: transform 0.18s;
}
.tp-toggle input:checked + .tp-toggle-slider {
  background: #047857;
}
.tp-toggle input:checked + .tp-toggle-slider::before {
  transform: translateX(14px);
}
.tp-toggle input:focus-visible + .tp-toggle-slider {
  box-shadow: 0 0 0 3px rgba(4, 120, 87, 0.25);
}
.tp-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.tp-toggle-label i {
  width: 14px;
  height: 14px;
  color: #047857;
}
.tp-toggle input:checked ~ .tp-toggle-label,
.tp-toggle:has(input:checked) {
  color: #047857;
}
.tp-toggle-hint {
  font-weight: 500;
  color: #94A3B8;
  font-size: 0.72rem;
}

/* Nota explicativa de transparência */
.tp-nota {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  border-left: 4px solid #2563EB;
  border-radius: 8px;
  padding: 12px 16px;
  margin: 0 0 18px;
  color: #1E293B;
  font-size: 0.86rem;
  line-height: 1.55;
}
.tp-nota > i {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: #2563EB;
  margin-top: 1px;
}
.tp-nota strong { color: #1E40AF; display: block; margin-bottom: 4px; font-size: 0.92rem; }
.tp-nota p { margin: 0; color: #334155; }
.tp-nota a { color: #2563EB; font-weight: 600; }
.tp-nota a:hover { text-decoration: underline; }

.tp-btn {
  background: #fff;
  border: 1px solid #CBD5E1;
  color: #475569;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
}
.tp-btn:hover {
  border-color: #003C71;
  color: #003C71;
}
.tp-btn--clear:hover {
  border-color: #FCA5A5;
  background: #FEF2F2;
  color: #DC2626;
}
.tp-btn i { width: 13px; height: 13px; }

/* ───── Sort dropdown (substitui headers ordenáveis) ───── */
.tp-sort {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: #475569;
}
.tp-sort label {
  font-weight: 600;
  white-space: nowrap;
}
.tp-sort select {
  padding: 5px 26px 5px 9px;
  border-radius: 6px;
  border: 1px solid #CBD5E1;
  background: #fff;
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 6px center;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.tp-sort select:focus {
  outline: none;
  border-color: #003C71;
  box-shadow: 0 0 0 2px rgba(0, 60, 113, 0.12);
}

/* ───── Resultados: grid de cards responsivo ───── */
.tp-empty {
  text-align: center;
  padding: 60px 24px;
  color: #64748B;
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
}
.tp-empty i {
  width: 56px;
  height: 56px;
  color: #CBD5E1;
  margin-bottom: 12px;
}
.tp-empty h3 {
  color: #1E293B;
  font-size: 1.15rem;
  margin-bottom: 6px;
}

.tp-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

/* ───── Card individual ───── */
.tp-card {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  position: relative;
  overflow: hidden;
}
.tp-card:hover {
  border-color: #003C71;
  box-shadow: 0 6px 18px rgba(0, 60, 113, 0.10);
  transform: translateY(-2px);
}
.tp-card--featured {
  border-color: #FFB81C;
  background: linear-gradient(180deg, #FFFEF5 0%, #fff 50%);
}

.tp-card--incomplete {
  border-color: #FCD34D;
  background: linear-gradient(180deg, #FFFBEB 0%, #fff 35%);
}
.tp-card--incomplete:hover {
  border-color: #F59E0B;
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.14);
}

/* Badge cobertura (X/10 faixas) dentro do meta */
.tp-cov {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: auto;
  white-space: nowrap;
  cursor: help;
}
.tp-cov i { width: 12px; height: 12px; }
.tp-cov--full {
  background: #ECFDF5;
  color: #047857;
}
.tp-cov--partial {
  background: #FFFBEB;
  color: #92400E;
  border: 1px solid #FDE68A;
}

/* Header do card: nome + linha */
.tp-card-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-bottom: 1px solid #F1F5F9;
  padding-bottom: 10px;
}
.tp-card-name {
  font-size: 1.02rem;
  font-weight: 800;
  color: #003C71;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.tp-card-linha {
  font-size: 0.74rem;
  color: #64748B;
  line-height: 1.35;
}

/* Meta: cidade + vidas */
.tp-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 0.78rem;
  color: #475569;
}
.tp-card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.tp-card-meta i {
  width: 13px;
  height: 13px;
  color: #003C71;
  flex-shrink: 0;
}

/* Pills */
.tp-card-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tp-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.tp-pill--pme         { background: #DBEAFE; color: #1E40AF; }
.tp-pill--empresarial { background: #E0E7FF; color: #3730A3; }
.tp-pill--hospitalar  { background: #FEE2E2; color: #B91C1C; }
.tp-pill--adesao      { background: #FEF3C7; color: #92400E; }
.tp-pill--quarto      { background: #ECFDF5; color: #047857; }
.tp-pill--enfermaria  { background: #F3E8FF; color: #6D28D9; }
.tp-pill--copart      { background: #FFF7ED; color: #C2410C; }
.tp-pill--sem         { background: #F1F5F9; color: #475569; }
.tp-pill--nacional    { background: #EDE9FE; color: #5B21B6; }
.tp-pill--regional    { background: #FFEDD5; color: #9A3412; }

/* Grid de preços (5 colunas × 2 linhas) */
.tp-card-prices {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  background: #F8FAFC;
  border-radius: 8px;
  padding: 8px;
}
.tp-price-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 4px;
  background: #fff;
  border-radius: 6px;
  text-align: center;
  border: 1px solid transparent;
  transition: border-color 0.1s, transform 0.1s;
  min-width: 0;
}
.tp-price-cell:hover {
  border-color: #003C71;
  transform: scale(1.03);
}
.tp-price-faixa {
  font-size: 0.62rem;
  font-weight: 700;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.tp-price-valor {
  font-size: 0.78rem;
  font-weight: 700;
  color: #1E293B;
  font-feature-settings: 'tnum';
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
  line-height: 1.1;
}
.tp-price-cell--min .tp-price-valor { color: #047857; }
.tp-price-cell--min { background: #ECFDF5; }
.tp-price-cell--max .tp-price-valor { color: #B91C1C; }
.tp-price-cell--max { background: #FEF2F2; }
.tp-price-cell--null {
  background: #FFFBEB;
  border-color: #FDE68A;
  cursor: help;
}
.tp-price-cell--null .tp-price-faixa { color: #92400E; }
.tp-price-cell--null .tp-price-valor {
  color: #B45309;
  font-style: italic;
  font-weight: 600;
  font-size: 0.62rem;
  letter-spacing: 0;
}

/* Resumo min/max acima do grid */
.tp-card-range {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.74rem;
  color: #64748B;
  padding: 4px 2px 0;
}
.tp-card-range strong {
  font-size: 0.92rem;
  color: #003C71;
  font-feature-settings: 'tnum';
  font-variant-numeric: tabular-nums;
}

/* Footer: cotar */
.tp-cta-mini {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #C0392B;
  color: #fff;
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s, transform 0.15s;
  white-space: nowrap;
  margin-top: auto;
}
.tp-cta-mini:hover {
  background: #A93226;
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
}
.tp-cta-mini i { width: 14px; height: 14px; }

/* ───── Footer (paginação) ───── */
.tp-table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: #475569;
}

.tp-pagination {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.tp-page-btn {
  background: #fff;
  border: 1px solid #CBD5E1;
  color: #475569;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.tp-page-btn:hover:not(:disabled) {
  border-color: #003C71;
  color: #003C71;
}
.tp-page-btn--active {
  background: #003C71;
  color: #fff;
  border-color: #003C71;
}
.tp-page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.tp-page-size {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tp-page-size select {
  padding: 4px 22px 4px 8px;
  border-radius: 6px;
  border: 1px solid #CBD5E1;
  background: #fff;
  font-size: 0.78rem;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 6px center;
}

/* ───── Aviso (LGPD/disclaimer) ───── */
.tp-disclaimer {
  margin-top: 18px;
  padding: 14px 18px;
  background: #FFF8E1;
  border-left: 4px solid #FFB81C;
  border-radius: 6px;
  font-size: 0.85rem;
  color: #5B4A00;
  line-height: 1.55;
}

/* ───── Responsivo ───── */
@media (max-width: 1100px) {
  .tp-cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
}

@media (max-width: 900px) {
  .tp-toolbar { position: relative; top: 0; padding: 12px; }
  .tp-filter { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .tp-filter--search { flex: 1 1 100%; }
  .tp-toolbar-meta { font-size: 0.78rem; width: 100%; }
  .tp-toolbar-actions { margin-left: 0; width: 100%; justify-content: space-between; }
  .tp-cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
  }
  .tp-cov { margin-left: 0; }
  .tp-card-meta { flex-wrap: wrap; }
}

@media (max-width: 560px) {
  .tp-filter { flex: 1 1 100%; }
  .tp-cards-grid { grid-template-columns: 1fr; }
  .tp-card { padding: 14px; }
  .tp-card-prices { padding: 6px; gap: 3px; }
  .tp-price-cell { padding: 5px 2px; }
  .tp-price-faixa { font-size: 0.58rem; }
  .tp-price-valor { font-size: 0.72rem; }
  .tp-price-cell--null .tp-price-valor { font-size: 0.56rem; }
  .tp-toolbar-actions { flex-direction: column; align-items: stretch; gap: 8px; }
  .tp-toggle { justify-content: flex-start; }
  .tp-toggle-hint { display: none; }
  .tp-nota { font-size: 0.8rem; padding: 10px 12px; gap: 8px; }
  .tp-nota strong { font-size: 0.86rem; }
  .tp-table-footer {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    gap: 8px;
  }
  .tp-pagination { justify-content: center; }
  .tp-page-size { justify-content: center; }
}

@media (max-width: 380px) {
  .tp-card-prices { grid-template-columns: repeat(3, 1fr); }
}
