/* --- Variáveis de Tema --- */
:root {
  --primary-color: #0ea5e9; /* Azul mais moderno/claro */
  --primary-hover: #0284c7;
  --primary-light: #f0f9ff;
  --bg-color: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #334155;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --radius: 12px;
  --transition-speed: 0.3s;
}

/* --- Reset e Tipografia --- */
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { background-color: var(--bg-color); color: var(--text-main); line-height: 1.6; padding: 2rem 1rem; }
.container { max-width: 1000px; margin: 0 auto; }

/* --- Utilitários --- */
.hidden { display: none !important; }

/* --- Mensagem: Nenhuma Ocorrência Encontrada --- */
.no-results {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.5rem;
  max-width: 560px;
  margin: 2rem auto 0;
  padding: 2rem 1.5rem;
  background-color: var(--card-bg);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 1.15rem;
  font-weight: 600;
}
.no-results::before {
  content: "\26A0"; /* ⚠ */
  font-size: 1.3rem;
  color: var(--primary-color);
}

/* --- Cabeçalho Global --- */
.page-header { margin-bottom: 2rem; text-align: center; }
.page-header h1 { font-size: 1.75rem; font-weight: 700; color: #0f172a; }
.page-header h2 { font-size: 1.1rem; color: var(--primary-color); font-weight: 500; margin-top: 0.25rem; }

/* --- Cards e Estruturas --- */
.card {
  background-color: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  padding: 2rem;
  margin-bottom: 2rem;
  border: 1px solid var(--border-color);
}

/* --- Tela 1: Formulário de Busca --- */
.instruction-banner {
  background-color: var(--primary-light);
  color: var(--primary-hover);
  padding: 1rem;
  border-radius: 8px;
  font-weight: 500;
  margin-bottom: 2rem;
  text-align: center;
  border: 1px dashed #bae6fd;
}

.search-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.form-group label { display: block; font-weight: 600; margin-bottom: 0.5rem; font-size: 0.9rem; color: #475569; }
.form-group input {
  width: 100%; padding: 0.75rem 1rem; border: 1px solid var(--border-color);
  border-radius: 8px; font-size: 1rem; transition: all var(--transition-speed);
  background-color: #f8fafc;
}
.form-group input:focus {
  outline: none; border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
  background-color: #fff;
}

.form-actions { margin-top: 2rem; text-align: right; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.75rem 1.5rem; font-size: 1rem; font-weight: 600;
  border-radius: 8px; cursor: pointer; transition: all var(--transition-speed);
  border: none;
}
.btn-primary { background-color: var(--primary-color); color: white; }
.btn-primary:hover { background-color: var(--primary-hover); transform: translateY(-1px); }
.btn-secondary { background-color: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }
.btn-secondary:hover { background-color: #e2e8f0; }

/* --- Tela 2: Lista de Resultados --- */
.list-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 2px solid var(--border-color);
}
.list-header h3 { font-size: 1.25rem; color: #0f172a; }

.result-item {
  padding: 1.5rem; border: 1px solid var(--border-color);
  border-radius: 8px; margin-bottom: 1rem; cursor: pointer;
  transition: all var(--transition-speed);
  background-color: #fff;
}
.result-item:hover {
  border-color: var(--primary-color);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.1);
  transform: translateY(-2px);
}
.result-title { font-weight: 700; color: var(--primary-hover); font-size: 1.1rem; margin-bottom: 0.5rem; }
.result-meta { display: flex; justify-content: space-between; font-size: 0.9rem; color: var(--text-muted); }
.city-badge { background-color: #e2e8f0; color: #334155; padding: 0.25rem 0.75rem; border-radius: 99px; font-size: 0.8rem; font-weight: 600; }

/* --- Tela 3: Detalhes --- */
.details-header { background-color: var(--primary-light); padding: 1.5rem; border-radius: var(--radius) var(--radius) 0 0; border-bottom: 1px solid #bae6fd; }
.details-header h3 { color: var(--primary-hover); margin-bottom: 0.5rem; font-size: 1.2rem; }

.info-grid { padding: 2rem; display: grid; grid-template-columns: repeat(12, 1fr); gap: 1.5rem; }
.info-item { display: flex; flex-direction: column; }
.info-item.col-12 { grid-column: span 12; }
.info-item.col-6 { grid-column: span 6; }
.info-item.col-4 { grid-column: span 4; }

.info-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); font-weight: 700; margin-bottom: 0.25rem; }
.info-value { font-size: 1rem; font-weight: 500; color: #0f172a; }

/* Tabela */
.table-container { overflow-x: auto; padding: 0 2rem 2rem 2rem; }
.history-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; text-align: left; }
.history-table th { background-color: #f8fafc; color: #475569; font-weight: 600; padding: 1rem; border-bottom: 2px solid var(--border-color); }
.history-table td { padding: 1rem; border-bottom: 1px solid var(--border-color); }
.history-table tbody tr:hover { background-color: var(--primary-light); }
.history-table a { color: var(--primary-color); text-decoration: none; font-weight: 600; }
.history-table a:hover { text-decoration: underline; }

.status-badge { display: inline-block; padding: 0.35rem 0.75rem; border-radius: 6px; font-size: 0.85rem; font-weight: 600; }
.status-emitida { background-color: #dcfce7; color: #166534; }
.status-arquivada { background-color: #fee2e2; color: #991b1b; }
.status-atendida { background-color: #e0e7ff; color: #3730a3; }

/* Responsividade Grids */
@media (max-width: 768px) {
  .info-item.col-6, .info-item.col-4 { grid-column: span 12; }
  .result-meta { flex-direction: column; gap: 0.5rem; }
  .city-badge { align-self: flex-start; }
}

/* --- Cards --- */
.card {
  background-color: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border-color);
  margin-bottom: 2rem;
  overflow: hidden;
}

.card-header {
  background-color: var(--primary-light);
  padding: 1.25rem 2rem;
  border-bottom: 1px solid #bae6fd;
}

.card-header h3 { 
  color: var(--primary-hover); 
  font-size: 1.2rem; 
  margin-bottom: 0.25rem;
}

.card-header .company-name {
  font-size: 1.4rem;
  color: #0f172a;
  font-weight: 700;
}

/* --- Tabela de Infrações --- */
.table-section-header {
  padding: 1.25rem 2rem;
  background-color: #ffffff;
  border-bottom: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.table-section-header h3 {
  font-size: 1.1rem;
  color: #0f172a;
}

.table-container { overflow-x: auto; }

.custom-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; text-align: left; }
.custom-table th { background-color: #f8fafc; color: #475569; font-weight: 600; padding: 1rem 1.5rem; border-bottom: 1px solid var(--border-color); white-space: nowrap; }
.custom-table td { padding: 1rem 1.5rem; border-bottom: 1px solid var(--border-color); vertical-align: middle; }

/* Estilo da linha principal da tabela */
.main-row { transition: background-color 0.2s; }
.main-row:hover { background-color: #f1f5f9; }

/* Estilo do número do Auto (parecia um input/botão no original) */
.nro-auto-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  background-color: white;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-family: monospace;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary-hover);
}

/* --- Linha Expandida (Detalhes da Infração) --- */
.expanded-row td {
  padding: 0;
  border-bottom: 2px solid var(--border-color);
}

.expanded-content {
  background-color: #fafafa;
  padding: 1.5rem 2rem;
  border-left: 4px solid var(--danger-color); /* Linha vermelha para indicar penalidade */
  display: grid;
  gap: 1rem;
}

.detail-block {
  display: flex;
  flex-direction: column;
}

.detail-block strong {
  color: #334155;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.detail-block p {
  color: #475569;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* --- Badges de Status --- */
.status-badge { display: inline-block; padding: 0.25rem 0.6rem; border-radius: 6px; font-size: 0.8rem; font-weight: 600; text-transform: uppercase;}
.status-emitida { background-color: #dcfce7; color: #166534; }
.status-advertencia { background-color: #fef2f2; color: #991b1b; } /* Cor de advertência */