/* ════════════════════════════════════════════════════════════════
   Pesquisa de Preços — Hardware
   style.css
   ════════════════════════════════════════════════════════════════ */

/* ── Reset & Base ──────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: #f3f4f6;
  color: #1e293b;
  min-height: 100vh;
}

/* ── Header ────────────────────────────────────────────────────── */
header {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  color: #fff;
  border-bottom: 3px solid #1e3a8a;
}

header .header-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.1;
  pointer-events: none;
  user-select: none;
}

header .header-content {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 18px 32px;
  display: flex;
  align-items: center;
  gap: 16px;
}

header .header-icon { font-size: 28px; }

header h1 {
  font-size: 1.25rem;
  font-weight: 700;
}

header p {
  font-size: 0.78rem;
  color: #bfdbfe;
  margin-top: 2px;
}

header .header-badge {
  margin-left: auto;
  font-size: 0.72rem;
  color: #bfdbfe;
  font-family: 'Courier New', monospace;
  display: flex;
  align-items: center;
  gap: 6px;
}

header .header-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ── Layout Principal ──────────────────────────────────────────── */
main {
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Toast / Banner ────────────────────────────────────────────── */
.toast {
  display: none;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  align-items: center;
  gap: 8px;
}

.toast-success {
  background: #f0fdf4;
  border: 1px solid #86efac;
  color: #15803d;
}

.toast-edit {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #b45309;
}

.toast.show { display: flex; }

/* ── Card / Seção ──────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.card-table {
  padding: 0;
  overflow: hidden;
}

.section-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #1d4ed8;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
}

/* ── Grids de campos ───────────────────────────────────────────── */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

@media (max-width: 640px) {
  .grid-2,
  .grid-3 { grid-template-columns: 1fr; }

  header .header-badge { display: none; }
  header .header-content { padding: 14px 16px; }
}

/* ── Campo de formulário ───────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
}

.field label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #1e40af;
  margin-bottom: 5px;
}

.field label .req {
  color: #ef4444;
  margin-left: 2px;
}

.field input,
.field select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.875rem;
  color: #1e293b;
  background: #fff;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field input:focus,
.field select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.field input.error,
.field select.error {
  border-color: #f87171;
}

.field input::placeholder { color: #9ca3af; }

/* Prefixo R$ */
.input-prefix { position: relative; }

.input-prefix .prefix-text {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.78rem;
  font-weight: 600;
  color: #6b7280;
  pointer-events: none;
}

.input-prefix input { padding-left: 32px; }

/* Mensagem de erro */
.field-error {
  display: none;
  font-size: 0.7rem;
  color: #ef4444;
  margin-top: 4px;
  align-items: center;
  gap: 4px;
}

.field-error.show { display: flex; }

/* ── Botões principais ─────────────────────────────────────────── */
.btn-row {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.2s, opacity 0.2s;
}

.btn-secondary {
  background: #fff;
  color: #374151;
  border: 1px solid #d1d5db;
}

.btn-secondary:hover { background: #f9fafb; }

.btn-primary {
  background: #2563eb;
  color: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.btn-primary:hover { background: #1d4ed8; }

/* ── Tabela de Registros ───────────────────────────────────────── */
#tabela-section { display: none; }

.tabela-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid #e2e8f0;
}

.tabela-header h2 {
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  display: flex;
  align-items: center;
  gap: 8px;
}

.count-badge {
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
}

.tabela-hint {
  font-size: 0.72rem;
  color: #9ca3af;
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

thead tr { background: #f8fafc; }

thead th {
  padding: 10px 12px;
  text-align: left;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6b7280;
  white-space: nowrap;
}

tbody tr {
  border-top: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background 0.15s;
}

tbody tr:hover   { background: #eff6ff; }
tbody tr.editing { background: #fffbeb; border-left: 3px solid #f59e0b; }

tbody td {
  padding: 10px 12px;
  color: #374151;
}

tbody td.mono {
  font-family: 'Courier New', monospace;
  color: #9ca3af;
}

.badge-tipo {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
}

.badge-laptop  { background: #dbeafe; color: #1d4ed8; }
.badge-desktop { background: #ede9fe; color: #7c3aed; }

.td-sub   { font-size: 0.72rem; color: #9ca3af; }
.td-price { text-align: right; font-weight: 700; color: #15803d; white-space: nowrap; }
.td-trunc { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.align-right  { text-align: right; }
.align-center { text-align: center; }

.btn-del {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 5px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #dc2626;
  border: 1px solid #fca5a5;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-del:hover {
  background: #fef2f2;
  border-color: #ef4444;
}

/* ── Modal de Confirmação ──────────────────────────────────────── */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.overlay.show { display: flex; }

.modal {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  max-width: 380px;
  width: 92%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  animation: popIn 0.18s ease;
}

@keyframes popIn {
  from { transform: scale(0.93); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.modal-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fee2e2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 12px;
}

.modal h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.modal .modal-sub {
  font-size: 0.78rem;
  color: #6b7280;
  margin-bottom: 12px;
}

.modal p {
  font-size: 0.875rem;
  color: #4b5563;
  margin-bottom: 20px;
}

.modal-btns {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.btn-cancel {
  padding: 8px 16px;
  border-radius: 7px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
}

.btn-confirm-del {
  padding: 8px 16px;
  border-radius: 7px;
  background: #dc2626;
  color: #fff;
  border: none;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-confirm-del:hover { background: #b91c1c; }

/* ── Bloco de Código PHP ───────────────────────────────────────── */
.php-block { position: relative; }

.btn-copy {
  position: absolute;
  top: 18px;
  right: 24px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  background: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #93c5fd;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-copy:hover  { background: #bfdbfe; }
.btn-copy.copied { background: #dcfce7; color: #15803d; border-color: #86efac; }

pre {
  background: #0f172a;
  color: #86efac;
  border-radius: 8px;
  padding: 18px;
  font-size: 0.72rem;
  line-height: 1.7;
  overflow-x: auto;
  margin-top: 8px;
  font-family: 'Courier New', monospace;
  border: 1px solid #1e293b;
}
