* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --marca: #c62828;
  --marca-escura: #b91c1c;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #fff;
  color: #222;
  font-size: 9pt;
}

/* ===================== PDF ===================== */
body.modo-pdf .pdf-header {
  position: fixed;
  top: -26mm;
  left: 0;
  right: 0;
  height: 24mm;
  background: #fff;
}

body.modo-pdf .pdf-header-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 100%;
  padding: 0 2mm 4px;
  border-bottom: 3px solid var(--marca);
}

body.modo-pdf .pdf-logo {
  height: 16mm;
  max-width: 38mm;
  object-fit: contain;
}

body.modo-pdf .pdf-header-nome {
  flex: 1;
  min-width: 0;
}

body.modo-pdf .pdf-header-nome strong {
  display: block;
  font-size: 13pt;
  color: #111;
  line-height: 1.15;
}

body.modo-pdf .pdf-header-nome span {
  font-size: 8pt;
  color: #666;
}

body.modo-pdf .pdf-header-badge {
  text-align: right;
  flex-shrink: 0;
}

body.modo-pdf .nossos-produtos,
.nossos-produtos {
  display: inline-block;
  background: var(--marca);
  color: #fff;
  font-size: 9pt;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 6px 14px;
  border-radius: 3px;
}

body.modo-pdf .pdf-data {
  margin-top: 3px;
  font-size: 7.5pt;
  color: #555;
}

body.modo-pdf .catalogo-pagina {
  max-width: none;
  padding: 0;
}

body.modo-pdf .grupo-section {
  page-break-before: auto;
  break-before: auto;
  margin: 0 0 6px;
  padding: 0;
}

body.modo-pdf .grupo-badge {
  display: inline-block;
  background: var(--marca);
  color: #fff;
  font-size: 8pt;
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px 14px;
  border-radius: 3px;
  margin: 6px 0 4px;
  page-break-after: avoid;
}

body.modo-pdf .produtos-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border-top: 1px solid #d9d9d9;
  border-left: 1px solid #d9d9d9;
}

body.modo-pdf .produto-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 6px 5px 8px;
  min-height: 48mm;
  border-right: 1px solid #d9d9d9;
  border-bottom: 1px solid #d9d9d9;
  break-inside: avoid;
  page-break-inside: avoid;
}

body.modo-pdf .produto-imagem {
  width: 100%;
  height: 28mm;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.modo-pdf .produto-imagem img {
  max-width: 92%;
  max-height: 28mm;
  object-fit: contain;
}

body.modo-pdf .produto-imagem .sem-foto {
  font-size: 7pt;
  color: #bbb;
  text-transform: uppercase;
}

body.modo-pdf .produto-corpo {
  width: 100%;
  margin-top: 4px;
}

body.modo-pdf .produto-codigo {
  font-size: 7pt;
  font-weight: 700;
  color: #888;
  margin-bottom: 2px;
}

body.modo-pdf .produto-titulo {
  font-size: 7.5pt;
  font-weight: 700;
  text-transform: uppercase;
  color: #111;
  line-height: 1.25;
  min-height: 18px;
}

body.modo-pdf .produto-detalhe {
  font-size: 6.5pt;
  color: #555;
  text-transform: uppercase;
}

body.modo-pdf .produto-preco {
  margin-top: 5px;
  font-size: 10pt;
  font-weight: 800;
  color: var(--marca);
}

body.modo-pdf .codigo-seta {
  display: none;
}

/* ===================== LOJA WEB ===================== */
body.modo-web {
  background: #f4f6f8;
  color: #1f2937;
  font-size: 14px;
}

.sync-banner {
  background: #fff7ed;
  border-bottom: 1px solid #fdba74;
  color: #9a3412;
  font-size: 0.85rem;
  padding: 8px 20px;
  text-align: center;
}

.sync-banner[hidden] {
  display: none !important;
}

.sync-banner-php {
  background: #eff6ff;
  border-bottom: 1px solid #93c5fd;
  color: #1e3a8a;
}

.sync-banner-php strong {
  color: #1d4ed8;
}

.loja-acoes {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.loja-header {
  background: #fff;
  border-bottom: 3px solid var(--marca);
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.loja-header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.loja-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.loja-logo {
  height: 48px;
  max-width: 120px;
  object-fit: contain;
}

.loja-brand h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111827;
  line-height: 1.2;
}

.loja-sub {
  font-size: 0.8rem;
  color: #6b7280;
}

body.modo-web .nossos-produtos {
  font-size: 0.8rem;
  padding: 10px 14px;
  border-radius: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}

.btn-primary {
  background: #dc2626;
  color: #fff;
}

.btn-primary:hover {
  background: #b91c1c;
}

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

.btn-outline:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

.btn-sm {
  padding: 10px 14px;
}

.loja-busca-bar {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 16px 20px;
}

.loja-busca-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.campo-busca {
  flex: 1;
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 0 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.campo-busca:focus-within {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
  background: #fff;
}

.campo-busca .icone {
  opacity: 0.5;
  font-size: 0.9rem;
}

.campo-busca input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 12px 0;
  font-size: 0.95rem;
  outline: none;
  color: #111827;
}

.filtro-grupo {
  min-width: 220px;
  padding: 12px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  font-size: 0.9rem;
  color: #374151;
  cursor: pointer;
}

.loja-stats {
  max-width: 1400px;
  margin: 10px auto 0;
  font-size: 0.8rem;
  color: #6b7280;
}

.loja-stats span {
  font-weight: 700;
  color: #dc2626;
}

.loja-layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 20px;
  align-items: start;
}

.loja-sidebar {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  position: sticky;
  top: 90px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
}

.loja-sidebar h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9ca3af;
  margin-bottom: 12px;
  font-weight: 700;
}

.categoria-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.categoria-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: #374151;
  font-size: 0.875rem;
  transition: background 0.12s;
}

.categoria-link:hover {
  background: #f3f4f6;
}

.categoria-link.ativo {
  background: #fef2f2;
  color: #dc2626;
  font-weight: 600;
}

.categoria-link .qtd {
  font-size: 0.75rem;
  color: #9ca3af;
  background: #f3f4f6;
  padding: 2px 8px;
  border-radius: 999px;
}

.categoria-link.ativo .qtd {
  background: #fee2e2;
  color: #dc2626;
}

.loja-main {
  min-width: 0;
}

body.modo-web .grupo-section {
  margin-bottom: 28px;
}

body.modo-web .grupo-badge {
  display: inline-flex;
  align-items: center;
  background: #dc2626;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 6px 16px;
  border-radius: 6px;
  margin-bottom: 14px;
}

.btn-whatsapp {
  background: #16a34a;
  color: #fff;
}

.btn-whatsapp:hover {
  background: #15803d;
}

body.modo-web .produtos-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border-top: 1px solid #e5e7eb;
  border-left: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
}

body.modo-web .produto-card {
  background: #fff;
  border-right: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: background 0.15s;
}

body.modo-web .produto-card:hover {
  background: #fafafa;
}

body.modo-web .produto-preco {
  margin-top: auto;
  padding-top: 8px;
  font-size: 1rem;
  font-weight: 800;
  color: var(--marca);
}

body.modo-web .produto-card[hidden] {
  display: none !important;
}

body.modo-web .produto-imagem {
  height: 160px;
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border-bottom: 1px solid #f3f4f6;
}

body.modo-web .produto-imagem img {
  max-width: 100%;
  max-height: 136px;
  object-fit: contain;
}

body.modo-web .produto-imagem .sem-foto {
  font-size: 0.75rem;
  color: #d1d5db;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

body.modo-web .produto-corpo {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

body.modo-web .produto-codigo-wrap {
  display: block;
}

body.modo-web .produto-codigo {
  display: inline-block;
  background: #f3f4f6;
  color: #6b7280;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}

body.modo-web .produto-titulo {
  font-size: 0.85rem;
  font-weight: 600;
  color: #111827;
  line-height: 1.35;
  text-transform: none;
  margin-top: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

body.modo-web .produto-detalhe {
  font-size: 0.75rem;
  color: #6b7280;
  text-transform: none;
  margin-top: 2px;
}

.sem-resultados {
  padding: 60px 20px;
}

.sem-resultados-box {
  text-align: center;
  background: #fff;
  border: 1px dashed #d1d5db;
  border-radius: 16px;
  padding: 48px 24px;
}

.sem-resultados-box span {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 12px;
}

.sem-resultados-box h3 {
  font-size: 1.1rem;
  color: #374151;
  margin-bottom: 6px;
}

.sem-resultados-box p {
  color: #9ca3af;
  font-size: 0.9rem;
}

.voltar-topo {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #dc2626;
  color: #fff;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.35);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
  z-index: 300;
}

.voltar-topo.visivel {
  opacity: 1;
  visibility: visible;
}

.voltar-topo:hover {
  transform: translateY(-2px);
}

/* ===================== RESPONSIVO WEB ===================== */
@media screen and (max-width: 1100px) {
  body.modo-web .produtos-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media screen and (max-width: 900px) {
  .loja-layout {
    grid-template-columns: 1fr;
  }

  .loja-sidebar {
    position: static;
    max-height: none;
  }

  .categoria-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }

  .categoria-link {
    flex: 0 0 auto;
    border: 1px solid #e5e7eb;
  }

  .loja-header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .loja-acoes {
    width: 100%;
  }

  .loja-acoes .btn {
    flex: 1;
    justify-content: center;
  }
}

@media screen and (max-width: 600px) {
  body.modo-web .produtos-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
  }

  body.modo-web .produto-imagem {
    height: 120px;
  }

  .loja-busca-inner {
    flex-direction: column;
  }

  .filtro-grupo {
    width: 100%;
  }
}

/* ===================== PRINT / PDF ===================== */
@media print {
  .loja-header,
  .loja-busca-bar,
  .loja-sidebar,
  .voltar-topo {
    display: none !important;
  }

  body.modo-web {
    background: #fff;
  }

  .loja-layout {
    display: block;
    padding: 0;
  }
}
