/* ═══════════════════════════════════════════════════════════════
   Pesquisa CNPJ — Estilos customizados
   ═══════════════════════════════════════════════════════════════ */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg-body: #f1f5f9;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
  --text-muted: #64748b;
  --section-title: #334155;
}

body {
  background: var(--bg-body);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Header ─────────────────────────────────────────────────── */
.app-header {
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
  color: #fff;
  padding: 1.25rem 0;
  margin-bottom: 1.5rem;
}
.app-header h1 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0;
}
.app-header .subtitle {
  font-size: 0.8rem;
  opacity: 0.8;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
}
.card-body {
  padding: 1.25rem;
}

/* ── Seções do formulário ───────────────────────────────────── */
.section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--section-title);
  border-bottom: 2px solid var(--primary);
  padding-bottom: 0.35rem;
  margin-bottom: 0.75rem;
  margin-top: 1rem;
}
.section-title:first-child {
  margin-top: 0;
}

/* ── Form controls ──────────────────────────────────────────── */
.form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 0.25rem;
}
.form-control, .form-select {
  font-size: 0.85rem;
  border-radius: 0.5rem;
  border-color: var(--border-color);
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.15);
}
.form-text {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ── Select2 overrides ──────────────────────────────────────── */
.select2-container--bootstrap-5 .select2-selection {
  border-radius: 0.5rem !important;
  border-color: var(--border-color) !important;
  min-height: 38px !important;
  font-size: 0.85rem !important;
}
.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__choice {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 0.3rem;
  background-color: #e0e7ff;
  border-color: #a5b4fc;
  color: #3730a3;
}
.select2-container--bootstrap-5 .select2-dropdown {
  font-size: 0.85rem;
  border-radius: 0.5rem;
}
.select2-container {
  width: 100% !important;
}

/* ── Debug box ──────────────────────────────────────────────── */
.debug-box {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 0.5rem;
  padding: 0.75rem;
  max-height: 320px;
  overflow: auto;
  font-size: 0.72rem;
  line-height: 1.3;
  font-family: 'Cascadia Code', 'Fira Code', monospace;
}

/* ── Tabela de resultados ───────────────────────────────────── */
.table thead th {
  background: #f8fafc;
  font-size: 0.78rem;
  font-weight: 700;
  color: #334155;
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}
.table tbody td {
  font-size: 0.82rem;
  vertical-align: middle;
}
.table-hover tbody tr:hover {
  background-color: #eff6ff;
}

/* ── Botões ─────────────────────────────────────────────────── */
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  font-weight: 600;
}
.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-action-group .btn {
  font-size: 0.8rem;
}

/* ── Badges ─────────────────────────────────────────────────── */
.badge-status {
  font-size: 0.75rem;
  padding: 0.35em 0.7em;
}

/* ── Export panel ───────────────────────────────────────────── */
.export-panel {
  background: #fefce8;
  border: 1px solid #fde68a;
  border-radius: 0.5rem;
  padding: 1rem;
}
.export-panel .progress {
  height: 1.25rem;
  border-radius: 0.5rem;
}

/* ── Accordion-like collapsible sections ────────────────────── */
.filter-section {
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  margin-bottom: 0.75rem;
  overflow: hidden;
}
.filter-section-header {
  background: #f8fafc;
  padding: 0.6rem 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--section-title);
  user-select: none;
  transition: background 0.2s;
}
.filter-section-header:hover {
  background: #f1f5f9;
}
.filter-section-header .chevron {
  transition: transform 0.2s;
  font-size: 0.7rem;
}
.filter-section.collapsed .filter-section-body {
  display: none;
}
.filter-section.collapsed .chevron {
  transform: rotate(-90deg);
}
.filter-section-body {
  padding: 0.75rem 1rem;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .app-header h1 { font-size: 1.1rem; }
  .card-body { padding: 0.75rem; }
}

/* ── Misc ───────────────────────────────────────────────────── */
code { user-select: all; }
.separator-line {
  border-top: 1px solid var(--border-color);
  margin: 1rem 0;
}
