/* ─────────────────────────────────────────────
   PeçaRadar — Modal de Comparação de Preços
   Keyframes: definidos em base.css (slideUp)
───────────────────────────────────────────── */

#compareModal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(14, 15, 19, 0.92);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

#compareModal.show { display: flex; }

.compare-box {
  background: var(--surface);
  /* Borda usa accent com opacidade — consistênte com o tema azul do projeto */
  border: 1px solid rgba(0, 97, 255, 0.2);
  border-radius: var(--r-2xl, 16px);
  width: 700px;
  max-width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  /* keyframe slideUp definido em base.css */
  animation: slideUp 0.25s ease;
}

/* ── Cabeçalho ── */

.compare-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-shrink: 0;
}

.compare-title {
  font-family: 'Syne', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  flex: 1;
}

.compare-close {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-md, 8px);
  width: 32px;
  height: 32px;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--t, 0.15s ease);
}

.compare-close:hover { color: var(--text); border-color: var(--border-h); }

/* ── Abas ── */

.compare-tabs {
  display: flex;
  gap: 4px;
  padding: 12px 24px 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.compare-tab {
  padding: 8px 16px;
  border-radius: var(--r-md, 8px) var(--r-md, 8px) 0 0;
  font-size: 13px;
  font-family: inherit;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  cursor: pointer;
  transition: all var(--t, 0.15s ease);
  position: relative;
  bottom: -1px;
}

.compare-tab:hover { color: var(--text); }

.compare-tab.active {
  color: var(--accent);
  background: var(--surface);
  border-color: var(--border);
  border-bottom-color: var(--surface);
}

/* ── Conteúdo ── */

.compare-content { padding: 20px 24px; flex: 1; }

/* ── Tabela de preços ── */

.price-table { width: 100%; border-collapse: collapse; }

.price-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  padding: 0 12px 10px;
  text-align: left;
  font-weight: 500;
}

.price-table td {
  padding: 10px 12px;
  font-size: 13.5px;
  border-top: 1px solid var(--border);
}

.price-row:hover td { background: var(--surface2); }
/* Menor preço: destaque usado pela IA para indicar a melhor opção */
.price-row.best td  { background: rgba(0, 97, 255, 0.05); }

.store-name { color: var(--text); font-weight: 500; }

.store-price {
  font-family: 'Syne', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.price-row.best .store-price { color: var(--accent); }

.price-badge {
  display: inline-block;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
}

.badge-best    { background: var(--tag-bg);  color: var(--accent); }
.badge-stock   { background: var(--ok-bg);   color: var(--ok-text); }
.badge-nostock { background: var(--surface2); color: var(--muted); }
/* Novo: badge de erro para itens indisponíveis */
.badge-error   { background: var(--error-bg); color: var(--error-text); }

.store-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-md, 8px);
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
  transition: all var(--t, 0.15s ease);
}

.store-link:hover { border-color: var(--accent); color: var(--accent); }

/* ── Seções de análise da IA ── */

.ai-section { margin-bottom: 20px; }

.ai-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-section-body {
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.7;
  background: var(--surface2);
  /* border-radius apenas nos lados sem borda */
  border-radius: 0 var(--r-lg, 10px) var(--r-lg, 10px) 0;
  padding: 12px 14px;
  border-left: 2px solid var(--accent);
}

/* ── Carregamento da IA ── */

.ai-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px;
  color: var(--muted);
  font-size: 13px;
}

/* ── Resumo rápido ── */

.compare-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.summary-card {
  background: var(--surface2);
  border-radius: var(--r-lg, 10px);
  padding: 12px;
  text-align: center;
}

.summary-label { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.summary-value { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 700; color: var(--accent); }
.summary-sub   { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ── Responsividade ── */

@media (max-width: 600px) {
  .compare-summary { grid-template-columns: 1fr 1fr; }
  .compare-content { padding: 16px; }
  .compare-header  { padding: 16px 16px 12px; }

  /* Tabela vira lista em telas pequenas */
  .price-table thead { display: none; }
  .price-table td {
    display: block;
    padding: 6px 12px;
    border-top: none;
  }
  .price-row { border-top: 1px solid var(--border); }
  .price-row td:first-child { padding-top: 12px; }
  .price-row td:last-child  { padding-bottom: 12px; }
}