/* === Grupo Addvalora – Estilos globais === */

:root {
  --orange: #F07E00;
  --orange-dark: #d96e00;
  --orange-light: #fff3e0;
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f3f4f6; }
::-webkit-scrollbar-thumb { background: #f0a050; border-radius: 3px; }

/* ---- TABS ---- */
.tab-btn {
  padding: 8px 18px;
  border-radius: 50px; /* Pills */
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #64748b;
  transition: all .2s;
  white-space: nowrap;
}
.tab-btn:hover { border-color: var(--orange); color: var(--orange); background: #fffaf0; }
.tab-btn.active {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
  box-shadow: 0 4px 12px rgba(240,126,0,.2);
}

/* ---- TABLE ---- */
#main-table thead th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  letter-spacing: .04em;
  font-size: 0.72rem;
  background: var(--orange);
  color: #fff;
  white-space: nowrap;
}

#main-table tbody tr {
  cursor: pointer;
  transition: background .12s;
}
#main-table tbody tr:hover { background: #fff7ed; }

#main-table tbody td {
  padding: 12px 16px;
  vertical-align: middle;
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.85rem;
  color: #374151;
  border-bottom: 1px solid #f3f4f6;
}

/* Badges Sim/Não */
.badge-sim {
  background-color: #dcfce7;
  color: #166534;
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.75rem;
  display: inline-block;
}

.badge-nao {
  background-color: #fee2e2;
  color: #991b1b;
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.75rem;
  display: inline-block;
}

/* Travas de Segurança */
body {
  user-select: none; /* Impede seleção de texto */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.selectable {
  user-select: text !important;
  -webkit-user-select: text !important;
}

@media print {
  body { display: none !important; } /* Impede impressão */
}

/* Destaque seguradora */
#main-table tbody td:first-child {
  font-weight: 600;
  color: var(--orange-dark);
}

/* ---- Highlight buscado ---- */
.highlight {
  background: #ffe066;
  border-radius: 2px;
  padding: 0 1px;
}

/* ---- Modal detalhe (Visual Moderno) ---- */
.detalhe-item {
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 8px;
  border-left: 4px solid var(--orange);
  transition: transform 0.2s;
}

.detalhe-item:nth-child(odd) {
  background-color: #f8fafc; /* Azul acinzentado bem clarinho */
  border-left-color: #3b82f6; /* Azul */
}

.detalhe-item:nth-child(even) {
  background-color: #fff7ed; /* Laranja bem clarinho */
  border-left-color: var(--orange); /* Laranja */
}

.detalhe-item:hover {
  transform: translateX(4px);
}

.detalhe-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .05em;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.detalhe-valor {
  margin-top: 0;
  font-size: 0.9rem;
  color: #1e293b;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Campos de notas longas preservam formatação */
.detalhe-valor-notes {
  white-space: pre-line;
  background: #f8fafc;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

/* ---- Footer ---- */
footer img {
  filter: none;
}

/* ---- Badge admin ---- */
.badge-admin {
  background: #fff3e0;
  color: var(--orange);
  border: 1px solid #fdd5a0;
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 600;
}

/* ---- CARDS LAYOUT (Novo) ---- */
.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--orange);
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 20px;
  border-bottom: 2px solid #fef3c7;
  padding-bottom: 10px;
}

.section-count {
  font-weight: 400;
  color: #94a3b8;
  font-size: 0.9rem;
}

/* ---- Animação de Sincronização ---- */
@keyframes spin-sync {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.syncing::before {
  content: "\f2f1";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  display: inline-block;
  margin-right: 5px;
  animation: spin-sync 2s linear infinite;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 24px;
}

.card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
  border: 1px solid #f1f5f9;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 25px rgba(240,126,0,0.12);
}

.card-header {
  background: var(--orange);
  padding: 16px 20px;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-title {
  font-weight: 700;
  font-size: 1rem;
  margin: 0;
  letter-spacing: -0.01em;
}

.card-subtitle {
  font-size: 0.75rem;
  opacity: 0.9;
  font-weight: 500;
  margin-top: 2px;
}

.card-body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card-field-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.card-field-value {
  font-size: 0.85rem;
  color: #334155;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3; /* Mostrar até 3 linhas */
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 1.2em;
}

.card-footer {
  padding: 12px 20px;
  border-top: 1px solid #f1f5f9;
  background: #fafafa;
}

.card-more-link {
  color: var(--orange);
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s;
}

.card-more-link:hover {
  color: var(--orange-dark);
}

/* ---- Responsivo ---- */
@media (max-width: 640px) {
  .cards-grid {
    grid-template-columns: 1fr;
  }
  .card-title { font-size: 0.95rem; }
  .card-field-value { font-size: 0.8rem; }
}

/* ---- Indicador de Última Atualização ---- */
#last-update-indicator {
  transition: color 0.3s ease;
  font-weight: 500;
}

#last-update-indicator.text-green-600 {
  color: #16a34a;
}

#last-update-indicator.text-orange-500 {
  color: #f97316;
}

#last-update-indicator.text-red-500 {
  color: #ef4444;
}

/* ---- Animação de sincronização ---- */
@keyframes pulse-sync {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.syncing {
  animation: pulse-sync 1.5s ease-in-out infinite;
}
