/* ============================================================
   produtos.html — catálogo B2B (protótipo visual, ~10 produtos
   demonstrativos). Referência de UX/UI: Preline Storefront/Marketplace
   (estrutura de sidebar+grid, chips de categoria, filtros ativos) —
   identidade visual 100% Rolamentos Betim (azul institucional, fundo
   claro, sem roxo/identidade Preline). Reaproveita tokens.css/header.css
   para botões, eyebrow, container etc.
   ============================================================ */

/* ---- Topo do catálogo ---- */
.catalog-top { background: var(--bg-light); padding: 28px 0 0; }
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dark-muted); margin-bottom: 18px; }
.breadcrumb a { color: var(--text-dark-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--rb-blue); }
.breadcrumb i { font-size: 10px; opacity: 0.6; }
.breadcrumb span[aria-current] { color: var(--text-dark); font-weight: 600; }

.catalog-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 22px; }
.catalog-heading h1 { font-family: var(--font-display); font-size: clamp(26px, 3.4vw, 38px); color: var(--text-dark); margin: 6px 0 10px; }
.catalog-heading p { font-size: 15px; color: var(--text-dark-muted); max-width: 620px; margin: 0; line-height: 1.6; }

/* ---- Busca destacada do catálogo ---- */
.catalog-search-wrap {
  display: flex; align-items: center; gap: 12px;
  height: 56px; background: #fff; border: 1px solid var(--line-light); border-radius: 14px;
  box-shadow: var(--shadow-soft); padding: 0 8px 0 20px; margin-bottom: 22px;
}
.catalog-search-wrap i.fa-magnifying-glass { color: var(--rb-blue); font-size: 16px; }
.catalog-search-wrap input {
  flex: 1; height: 100%; border: none; outline: none; font-size: 15px; font-family: var(--font-body); color: var(--text-dark); background: transparent;
}
.catalog-search-wrap input::placeholder { color: var(--text-dark-muted); }
.catalog-search-clear {
  display: none; width: 34px; height: 34px; border-radius: 50%; border: none; background: var(--bg-light-alt);
  color: var(--text-dark-muted); cursor: pointer; align-items: center; justify-content: center; flex-shrink: 0;
}
.catalog-search-wrap.has-value .catalog-search-clear { display: flex; }

/* ---- Chips de categoria (topo) ---- */
.category-chips { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 22px; scrollbar-width: thin; }
.category-chips::-webkit-scrollbar { height: 6px; }
.category-chip {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px; border: 1px solid var(--line-light); background: #fff;
  font-size: 13.5px; font-weight: 600; color: var(--text-dark); cursor: pointer; white-space: nowrap;
  transition: background .2s ease, border-color .2s ease, color .2s ease;
  text-decoration: none;
}
/* Índice de links server-side (Story 4.1, Fase 2) — fallback pré-JS dentro
   de #products-grid, sobrescrito pelo innerHTML real assim que
   catalog-demo.js roda; discreto de propósito, nunca visível após a
   hidratação em navegadores com JS. */
.catalog-index-fallback { list-style: none; margin: 0; padding: 0; columns: 3; column-gap: 24px; }
.catalog-index-fallback li { break-inside: avoid; padding: 4px 0; font-size: 13px; }
.catalog-index-fallback a { color: var(--text-dark-muted); text-decoration: none; }
.catalog-index-fallback a:hover { text-decoration: underline; }
.category-chip .count { color: var(--text-dark-muted); font-weight: 500; }
.category-chip:hover { border-color: var(--rb-blue); }
.category-chip.is-active { background: var(--rb-blue); border-color: var(--rb-blue); color: #fff; }
.category-chip.is-active .count { color: rgba(255,255,255,0.75); }

/* ---- Área principal: sidebar + grid ---- */
.catalog-main { padding: 8px 0 var(--section-pad); background: var(--bg-light); }
.catalog-layout { display: grid; grid-template-columns: 260px 1fr; gap: 36px; align-items: start; }

.filters-panel {
  position: sticky; top: 96px;
  border: 1px solid var(--line-light); border-radius: 16px; padding: 22px;
  background: #fff;
}
.filters-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.filters-panel-head h2 { font-size: 15px; font-family: var(--font-display); color: var(--text-dark); margin: 0; }
.filters-clear-btn { background: none; border: none; color: var(--rb-blue); font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 0; }

.filter-group { padding: 18px 0; border-bottom: 1px solid var(--line-light); }
.filter-group:last-child { border-bottom: none; padding-bottom: 0; }
.filter-group-title { font-size: 13px; font-weight: 700; color: var(--text-dark); margin: 0 0 12px; text-transform: uppercase; letter-spacing: 0.03em; }
.filter-option { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; cursor: pointer; }
.filter-option-label { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--text-dark-muted); }
.filter-option input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--rb-blue); cursor: pointer; }
.filter-option .count { font-size: 12px; color: var(--text-dark-muted); opacity: 0.75; }
.filter-option:hover .filter-option-label { color: var(--text-dark); }

/* ---- Filtros ativos + ordenação ---- */
.catalog-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.catalog-count { font-size: 14px; color: var(--text-dark-muted); }
.catalog-count strong { color: var(--text-dark); }
.catalog-sort { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-dark-muted); }
.catalog-sort select {
  border: 1px solid var(--line-light); border-radius: 8px; padding: 8px 32px 8px 12px; font-size: 13.5px; color: var(--text-dark);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%234B5763' stroke-width='1.5' fill='none' fill-rule='evenodd'/%3E%3C/svg%3E") no-repeat right 12px center;
  appearance: none; cursor: pointer;
}

.active-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.active-filter-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 8px 6px 14px; border-radius: 999px;
  background: rgba(0, 94, 184, 0.08); color: var(--rb-blue); font-size: 12.5px; font-weight: 600;
}
.active-filter-chip button { border: none; background: rgba(0,94,184,0.15); color: var(--rb-blue); width: 18px; height: 18px; border-radius: 50%; cursor: pointer; font-size: 11px; line-height: 1; }
.clear-all-filters { font-size: 12.5px; font-weight: 600; color: var(--text-dark-muted); background: none; border: none; cursor: pointer; text-decoration: underline; }

/* ---- Botão de filtros mobile ---- */
.mobile-filters-toggle {
  display: none; align-items: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 10px;
  border: 1px solid var(--line-light); background: #fff; font-size: 13.5px; font-weight: 600; color: var(--text-dark); cursor: pointer;
}
.mobile-filters-toggle .badge { background: var(--rb-blue); color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 999px; }

/* ---- Grid de produtos ---- */
.products-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }

/* Skeleton de carregamento — mesma proporção do .product-card real, para o
   usuário ver de imediato que a página está buscando o catálogo (nunca
   parece travada) em vez de uma grid em branco. Fica marcado no HTML por
   padrão e é substituído automaticamente assim que catalog-demo.js renderiza
   os produtos reais (grid.innerHTML é sobrescrito) — nenhum JS extra
   necessário para "esconder" o skeleton. */
.product-card-skeleton {
  display: flex; flex-direction: column;
  border: 1px solid var(--line-light); border-radius: 16px; background: #fff; overflow: hidden;
}
.product-card-skeleton .sk-media { aspect-ratio: 4/3; }
.product-card-skeleton .sk-body { padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.product-card-skeleton .sk-line { height: 12px; border-radius: 6px; }
.product-card-skeleton .sk-line.sk-title { height: 15px; width: 78%; }
.product-card-skeleton .sk-line.sk-meta { width: 45%; }
.product-card-skeleton .sk-line.sk-desc { width: 100%; }
.product-card-skeleton .sk-line.sk-desc-short { width: 62%; }
.product-card-skeleton .sk-line.sk-cta { height: 40px; border-radius: 999px; margin-top: 4px; }
.product-card-skeleton .sk-media,
.product-card-skeleton .sk-line {
  background: linear-gradient(100deg, var(--bg-light-alt) 30%, #eef2f6 50%, var(--bg-light-alt) 70%);
  background-size: 200% 100%;
  animation: sk-shimmer 1.5s ease-in-out infinite;
}
@keyframes sk-shimmer {
  0% { background-position: 150% 0; }
  100% { background-position: -50% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .product-card-skeleton .sk-media, .product-card-skeleton .sk-line { animation: none; }
}
.product-card {
  display: flex; flex-direction: column;
  border: 1px solid var(--line-light); border-radius: 16px; background: #fff; overflow: hidden;
  transition: transform .3s var(--ease-industrial), box-shadow .3s var(--ease-industrial), border-color .3s ease;
}
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-soft); border-color: transparent; }
.product-card-media {
  position: relative; aspect-ratio: 4/3; background: var(--bg-light-alt);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.product-card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease-industrial); }
.product-card:hover .product-card-media img { transform: scale(1.06); }
/* Crossfade de 2ª imagem no hover (só quando o produto tem 2 imagens no Media
   Hub — ver catalog-demo.js/productCardHtml). Produto com 1 imagem usa a
   regra acima sem alteração nenhuma. */
.product-card-media-primary, .product-card-media-secondary { position: absolute; inset: 0; }
.product-card-media-secondary { opacity: 0; transition: opacity .4s var(--ease-industrial), transform .5s var(--ease-industrial); }
.product-card:hover .product-card-media-secondary { opacity: 1; }
.product-card:hover .product-card-media-primary { opacity: 0; }
.product-card-media-fallback {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #0d2036, #051425);
}
.product-card-media-fallback i { font-size: 56px; color: rgba(126, 182, 239, 0.55); }
.product-card-category-tag {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  background: var(--rb-blue-darker); color: #ffffff; font-size: 9px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
.product-card-disclaimer { margin: 6px 18px 0; font-size: 10.5px; color: var(--text-dark-muted); text-align: center; }
.product-card-body { padding: 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-card-name { font-size: 15px; font-weight: 700; color: var(--text-dark); margin: 0; line-height: 1.35; }
.product-card-meta { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-dark-muted); flex-wrap: wrap; }
.product-card-meta .code { font-family: 'Courier New', monospace; background: var(--bg-light-alt); padding: 2px 8px; border-radius: 6px; }
.product-card-brand { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--rb-blue); }
.product-card-desc { font-size: 13px; color: var(--text-dark-muted); line-height: 1.55; margin: 2px 0 4px; }
.product-card-availability { font-size: 12px; color: var(--text-dark-muted); display: flex; align-items: center; gap: 6px; margin-top: auto; }
.product-card-availability .dot { width: 7px; height: 7px; border-radius: 50%; background: #3DDC84; flex-shrink: 0; }
.product-card-cta {
  margin-top: 12px; display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; border-radius: 10px; background: var(--rb-blue); color: #fff; font-size: 13px; font-weight: 700;
  text-decoration: none; border: none; cursor: pointer; transition: background .2s ease;
}
.product-card-cta:hover { background: var(--rb-blue-dark); }
.product-card-cta { font-family: inherit; width: 100%; padding: 0; }

/* Fazer pedido pelo WhatsApp — mesma forma do CTA azul, cor verde,
   sempre ACIMA de "Adicionar ao orçamento" (pedido do cliente). */
.product-card-cta-whatsapp {
  margin-top: 12px; display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; border-radius: 10px; background: #1FAE5B; color: #fff; font-size: 13px; font-weight: 700;
  text-decoration: none; border: none; cursor: pointer; transition: background .2s ease;
  font-family: inherit; width: 100%; padding: 0;
}
.product-card-cta-whatsapp:hover { background: #189449; }
.product-card-cta-whatsapp + .product-card-cta { margin-top: 8px; }

/* Imagem e nome do card agora são links reais para a página de detalhes
   (ver catalog-demo.js) — CSS aditivo só para neutralizar sublinhado/cor
   padrão de <a>; nenhuma medida, cor de fundo ou espaçamento já aprovado
   foi alterado. */
.product-card-media, .product-card-name a { text-decoration: none; color: inherit; }
.product-card-media:hover, .product-card-name a:hover { text-decoration: none; }

/* ---- Empty state ---- */
.catalog-empty { display: none; flex-direction: column; align-items: center; text-align: center; padding: 70px 20px; }
.catalog-empty.is-visible { display: flex; }
.catalog-empty i { font-size: 40px; color: var(--text-dark-muted); opacity: 0.4; margin-bottom: 18px; }
.catalog-empty h3 { font-size: 18px; color: var(--text-dark); margin: 0 0 8px; }
.catalog-empty p { font-size: 14px; color: var(--text-dark-muted); margin: 0 0 20px; }

/* ---- Nota de dados demonstrativos ---- */
.catalog-demo-note {
  margin-top: 30px; padding: 14px 18px; border-radius: 12px; background: var(--bg-light-alt);
  border: 1px dashed var(--line-light); font-size: 12.5px; color: var(--text-dark-muted); line-height: 1.6;
}
.catalog-demo-note strong { color: var(--text-dark); }

/* ---- Drawer de filtros (mobile) ---- */
.filters-drawer-backdrop {
  position: fixed; inset: 0; z-index: 400; background: rgba(5,15,28,0.6);
  display: none; opacity: 0; transition: opacity .25s ease;
}
.filters-drawer-backdrop.is-open { display: block; opacity: 1; }
.filters-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 401;
  width: min(88vw, 360px); background: #fff; transform: translateX(100%);
  transition: transform .3s var(--ease-industrial);
  display: flex; flex-direction: column;
}
.filters-drawer-backdrop.is-open .filters-drawer { transform: translateX(0); }
.filters-drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line-light); }
.filters-drawer-head h3 { font-size: 16px; margin: 0; font-family: var(--font-display); }
.filters-drawer-close { background: none; border: none; font-size: 18px; color: var(--text-dark-muted); cursor: pointer; }
.filters-drawer-body { padding: 8px 20px; overflow-y: auto; flex: 1; }
.filters-drawer-footer { padding: 16px 20px; border-top: 1px solid var(--line-light); }
.filters-drawer-footer .btn { width: 100%; height: 48px; }

@media (max-width: 1100px) {
  .products-grid { grid-template-columns: repeat(2, 1fr); }
  .catalog-layout { grid-template-columns: 1fr; }
  .filters-panel { display: none; }
  .mobile-filters-toggle { display: inline-flex; }
}
@media (max-width: 640px) {
  .products-grid { grid-template-columns: 1fr; }
  .catalog-heading { flex-direction: column; align-items: flex-start; }
  .catalog-search-wrap { height: 50px; }
  .catalog-toolbar { flex-direction: column; align-items: stretch; }
  .catalog-sort { justify-content: space-between; }
}

/* ---- Compartilhar categoria/marca/seleção (catalog-demo.js) ----
   Fica no cabeçalho da página, à direita do título; só existe com filtro ativo. */
.catalog-share { position: relative; align-self: center; display: flex; flex-direction: column; align-items: flex-end; }
.catalog-share:empty { display: none; }
.share-listing-btn {
  position: relative; display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 24px; border-radius: 999px; border: 1px solid transparent; cursor: pointer;
  font-family: var(--font-body); font-size: 14px; font-weight: 700; letter-spacing: 0.02em; color: #fff;
  background: linear-gradient(135deg, var(--rb-blue) 0%, var(--rb-blue-dark) 100%);
  box-shadow: 0 12px 30px -10px rgba(0, 94, 184, 0.55);
  transition: transform .35s var(--ease-industrial), box-shadow .35s var(--ease-industrial);
}
.share-listing-btn i { font-size: 15px; }
.share-listing-btn:hover { transform: translateY(-2px); box-shadow: 0 18px 40px -10px rgba(0, 94, 184, 0.65); }
/* Destaque ao aparecer: "pop" + anel pulsando três vezes. */
.share-listing-btn.is-entering { animation: shareListingPop .55s cubic-bezier(.34, 1.56, .64, 1) both; }
.share-listing-btn.is-entering::after {
  content: ""; position: absolute; inset: -2px; border-radius: 999px; pointer-events: none;
  border: 2px solid var(--rb-blue); animation: shareListingRing 1.3s ease-out .35s 3 both;
}
@keyframes shareListingPop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
@keyframes shareListingRing { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(1.25, 1.7); opacity: 0; } }

.share-listing-panel {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 30; width: min(460px, 92vw);
  padding: 16px; border-radius: 16px; text-align: left;
  background: #fff; border: 1px solid var(--line-light); box-shadow: var(--shadow-soft);
}
.share-listing-panel[hidden] { display: none; }
.share-listing-panel label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-dark); margin-bottom: 8px; }
.share-listing-row { display: flex; flex-wrap: wrap; gap: 8px; }
.share-listing-row input {
  flex: 1 1 100%; min-width: 0; padding: 11px 12px; border-radius: 10px;
  border: 1px solid var(--line-light); background: var(--bg-light-alt); color: var(--text-dark);
  font-family: var(--font-body); font-size: 13.5px; outline: none;
}
.share-listing-row input:focus { border-color: var(--rb-blue); box-shadow: 0 0 0 3px rgba(0, 94, 184, 0.14); }
.share-listing-row .btn { flex: 1 1 0; padding: 11px 14px; font-size: 13px; box-shadow: none; }
.catalog-heading .share-listing-feedback { margin: 10px 0 0; font-size: 12.5px; font-weight: 600; color: #1b7a3d; max-width: none; }
.share-listing-feedback:empty { display: none; }

@media (max-width: 760px) {
  .catalog-share { align-self: stretch; align-items: stretch; }
  .share-listing-btn { justify-content: center; }
  .share-listing-panel { position: static; width: auto; margin-top: 10px; }
  .share-listing-row .btn { flex: 1 1 100%; }
  /* Botão de largura total: anel cresce pouco na horizontal para não vazar da tela. */
  .share-listing-btn.is-entering::after { animation-name: shareListingRingWide; }
}
@keyframes shareListingRingWide { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(1.04, 1.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .share-listing-btn.is-entering, .share-listing-btn.is-entering::after { animation: none; }
}
