/* ════════════════════════════════════════════════════════
   LOJA MACHLASER — Estilos complementares
   Fundo branco, miniaturas de galeria, busca na sidebar
   Adicionar em: yourtheme/assets/css/loja-novo.css
   (ou incluir via wp_enqueue_style)
════════════════════════════════════════════════════════ */

/* ── Variáveis ── */
:root {
  --ml-blue:       #0057ff;
  --ml-blue-soft:  rgba(0, 87, 255, .08);
  --ml-ink:        #0D1120;
  --ml-muted:      #9CA3AF;
  --ml-border:     rgba(0, 0, 0, .12);
  --ml-border-md:  rgba(0, 0, 0, .14);
  --ml-font:       var(--font-b, 'Barlow', sans-serif);
}

/* ── Seletor reutilizável — produtos grid (evita 4× repetições) ── */
:is(ul.products.columns-1,
    ul.products.columns-2,
    ul.products.columns-3,
    ul.products.columns-4,
    ul.products.columns-5) { /* sobrescrito nos media queries abaixo */
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 18px !important;
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* ── Seção principal ── */
.produtos-grid-section {
  background: #f8f9fb !important;
  padding: 48px 0 80px;
}

/* ── Sidebar ── */
.filtros-sidebar {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, .09);
  border-radius: 14px;
  padding: 24px 20px;
  position: sticky;
  top: 100px;
}

/* ── Campo de busca na sidebar ── */
.filtro-search-wrap {
  position: relative;
  margin-bottom: 20px;
}
.filtro-search-icon {
    position: absolute;
    left: 0px;
    top: 20%;
    transform: translateY(-50%);
    width: 15px;
    height: 15px;
    stroke: var(--ml-muted);
    pointer-events: none;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.filtro-search-input {
  width: 100%;
  padding: 9px 32px 9px 34px;
  border: 1.5px solid var(--ml-border-md);
  border-radius: 8px;
  font-family: var(--ml-font);
  font-size: .85rem;
  color: var(--ml-ink);
  background: #fff;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.filtro-search-input:focus {
  border-color: var(--ml-blue);
  box-shadow: 0 0 0 3px var(--ml-blue-soft);
}
.filtro-search-input::placeholder { color: #B0B9C6; }

.filtro-search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ml-muted);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .2s;
  border-radius: 4px;
}
.filtro-search-clear:hover { color: #EF4444; }

/* ── Painel de auto-suggest (sugestões) ── */
.filtro-autosuggest {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: min(640px, calc(100vw - 32px));
  max-width: 640px;
  background: #fff;
  border: 1px solid rgba(0, 87, 255, 0.16);
  border-radius: 16px;
  box-shadow: 0 24px 48px rgba(0, 87, 255, 0.14);
  z-index: 9999999 !important;
  max-height: 420px;
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: mlSuggestIn 0.14s ease;
  box-sizing: border-box;
  display: none;
}

@keyframes mlSuggestIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-5px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.filtro-autosuggest[hidden] {
  display: none;
}

.ml-suggest-header {
  padding: 12px 16px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #4f6fa8;
}

.ml-suggest-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.15s;
  border: none;
  background: transparent;
  text-align: left;
  width: 100%;
}

.ml-suggest-item:hover,
.ml-suggest-item.active {
  background: rgba(0, 87, 255, 0.08);
}

.ml-suggest-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: #9ca3af;
}

.ml-suggest-thumb-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 50px;
  height: 50px;
  border-radius: 12px;
  overflow: hidden;
  background: #f5f5f5;
}

.ml-suggest-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ml-suggest-thumb-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: #e5e7eb;
  color: #9ca3af;
}

.ml-suggest-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ml-suggest-name {
  font-weight: 500;
  color: var(--ml-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ml-suggest-name mark {
  background: rgba(0, 87, 255, 0.25);
  font-weight: 600;
  padding: 0 2px;
}

.ml-suggest-meta {
  font-size: 0.75rem;
  color: #9ca3af;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ml-suggest-badge-recent {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(0, 87, 255, 0.1);
  color: var(--ml-blue);
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.ml-suggest-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(0, 87, 255, 0.08);
  color: var(--ml-blue);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  text-decoration: none;
}

.ml-suggest-arrow:hover {
  background: rgba(0, 87, 255, 0.15);
}

.ml-suggest-empty {
  padding: 32px 16px;
  text-align: center;
  color: #9ca3af;
  font-size: 0.9rem;
}

.ml-suggest-empty i {
  display: block;
  font-size: 32px;
  margin-bottom: 8px;
  opacity: 0.5;
}

/* Scrollbar customizada */
.filtro-autosuggest::-webkit-scrollbar {
  width: 6px;
}

.filtro-autosuggest::-webkit-scrollbar-track {
  background: transparent;
}

.filtro-autosuggest::-webkit-scrollbar-thumb {
  background: rgba(0, 87, 255, 0.2);
  border-radius: 3px;
}

.filtro-autosuggest::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 87, 255, 0.35);
}

/* ── Imagem principal do card ── */
.prod-card-real .prod-card-img-wrap {
  position: relative;
  width: 100%;
  padding-top: 72%;
  overflow: hidden;
  background: #fff;
  display: block;
}

.card-main-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
  opacity: 0;
  transition: opacity .28s ease, transform .4s ease;
  cursor: pointer;
}
.card-main-img.active { opacity: 1; }
.prod-card-real:hover .card-main-img.active { transform: scale(1.05); }

/* ── Faixa de miniaturas ── */
.card-thumbs {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px 4px;
  overflow-x: auto;
  scrollbar-width: none;
  background: #fff;
}
.card-thumbs::-webkit-scrollbar { display: none; }

.card-thumb {
  width: 38px;
  height: 38px;
  border: 1.5px solid rgba(0, 0, 0, .1);
  border-radius: 7px;
  background: #F4F6FA;
  cursor: pointer;
  padding: 3px;
  flex-shrink: 0;
  transition: border-color .18s, transform .18s, box-shadow .18s;
  overflow: hidden;
}
.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 4px;
}
.card-thumb.active {
  border-color: var(--ml-blue);
  transform: scale(1.1);
  box-shadow: 0 0 0 2px rgba(0, 87, 255, .15);
}
.card-thumb:hover:not(.active) {
  border-color: #93b4ff;
  transform: scale(1.05);
}

/* ── Estado de carregamento AJAX ── */
.prod-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}
.prod-loading-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  color: var(--ml-muted);
  font-size: .88rem;
  font-family: var(--ml-font);
}
.prod-loading-beam {
  width: 140px;
  height: 3px;
  background: #E5E7EB;
  border-radius: 3px;
  position: relative;
  overflow: hidden;
}
.prod-loading-beam::after {
  content: '';
  position: absolute;
  left: -40%;
  top: 0;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--ml-blue), transparent);
  animation: beamScan .85s ease-in-out infinite;
}
@keyframes beamScan {
  to { left: 100%; }
}

#produtos-grid-wrap { transition: opacity .25s ease; }

ul.products > li.product {
  margin: 0 !important;
  padding: 0 !important;
  float: none !important;
  width: auto !important;
}

/* ── Estado vazio ── */
.prod-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 220px;
  color: var(--ml-muted);
  font-size: .95rem;
  text-align: center;
}
.btn-limpar-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--ml-border-md);
  color: #6B7280;
  font-family: var(--ml-font);
  font-size: .8rem;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color .2s, color .2s;
  margin-top: 4px;
}
.btn-limpar-inline:hover { border-color: var(--ml-blue); color: var(--ml-blue); }

/* ── Paginação ── */
.woocommerce-pagination ul {
  display: flex;
  gap: 6px;
  list-style: none;
  padding: 0;
  justify-content: center;
  flex-wrap: wrap;
}
.woocommerce-pagination ul li a,
.woocommerce-pagination ul li span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--ml-border);
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 600;
  color: #6B7280;
  text-decoration: none;
  transition: border-color .2s, color .2s, background .2s;
}
.woocommerce-pagination ul li a:hover { border-color: var(--ml-blue); color: var(--ml-blue); }
.woocommerce-pagination ul li span.current {
  background: var(--ml-blue);
  border-color: var(--ml-blue);
  color: #fff;
}

/* ── Ordenação WooCommerce ── */
.woocommerce-ordering { margin: 0; }
.woocommerce-ordering select {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, .15);
  border-radius: 6px;
  color: var(--ml-ink);
  font-family: var(--ml-font);
  font-size: .8rem;
  padding: 7px 12px;
  cursor: pointer;
  outline: none;
  transition: border-color .2s;
}
.woocommerce-ordering select:focus { border-color: var(--ml-blue); }

/* ── Card featured ── */
.prod-card-real--featured {
  border-color: #c7d4f8 !important;
  box-shadow: 0 4px 20px rgba(0, 87, 255, .08);
}
.prod-card-real--featured .card-badge {
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
}

/* ════════════════════════════════════════════════════════
   TABS DE CATEGORIA
════════════════════════════════════════════════════════ */

:is(.wc-category-tabs,
    .product-categories-bar,
    .ml-cat-tabs,
    .woocommerce-product-subcategories,
    .woocommerce .wc-block-product-categories) {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  padding: 12px 24px;
  background: #fff;
  border-bottom: 1px solid rgba(0, 0, 0, .07);
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
:is(.wc-category-tabs,
    .product-categories-bar,
    .ml-cat-tabs)::-webkit-scrollbar { display: none; }

:is(.wc-category-tabs,
    .product-categories-bar,
    .ml-cat-tabs) a,
:is(.ml-cat-tabs,
    .woocommerce-product-subcategories) li {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  scroll-snap-align: start;
  flex-shrink: 0;
  padding: 6px 16px;
  border-radius: 20px;
  border: 1.5px solid rgba(0, 0, 0, .1);
  font-family: var(--ml-font);
  font-size: .8rem;
  font-weight: 600;
  color: #4B5563;
  text-decoration: none;
  background: #fff;
  transition: border-color .18s, color .18s, background .18s;
  list-style: none;
}
:is(.wc-category-tabs,
    .product-categories-bar,
    .ml-cat-tabs) a:hover {
  border-color: var(--ml-blue);
  color: var(--ml-blue);
}

/* Tab ativa */
:is(.wc-category-tabs a.current,
    .wc-category-tabs a.active,
    .product-categories-bar .current,
    .ml-cat-tabs .active,
    .ml-cat-tabs [aria-current="page"]) {
  background: var(--ml-blue);
  border-color: var(--ml-blue);
  color: #fff !important;
}

:is(.wc-category-tabs, .ml-cat-tabs) .cat-count {
  background: rgba(255, 255, 255, .25);
  border-radius: 10px;
  padding: 1px 7px;
  font-size: .72rem;
}

/* ════════════════════════════════════════════════════════
   CARROSSEL NOS CARDS DA LOJA
════════════════════════════════════════════════════════ */

.prod-carousel {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.carousel-track {
  width: 100%;
  height: 100%;
  position: relative;
}
.carousel-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.carousel-slide.active { opacity: 1; }
.carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 10px;
}

/* Setas */
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, .92);
  border: 1px solid var(--ml-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity .2s, background .2s, box-shadow .2s;
  padding: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
}
.carousel-btn svg { width: 14px; height: 14px; color: var(--ml-ink); }
.carousel-prev { left: 6px; }
.carousel-next { right: 6px; }
.prod-card-real:hover .carousel-btn { opacity: 1; }
.carousel-btn:hover { background: #fff; box-shadow: 0 3px 10px rgba(0, 0, 0, .2); }

/* Dots — ocultos */
.carousel-dots,
.carousel-dot { display: none; }

/* Imagem única (sem carrossel) */
.prod-card-real .prod-card-img-wrap > a {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.prod-card-real .prod-card-img-wrap > a > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 10px;
  transition: transform .4s ease;
}
.prod-card-real:hover .prod-card-img-wrap > a > img { transform: scale(1.05); }

/* ── Responsivo ── */
@media (max-width: 1280px) {
  :is(ul.products.columns-1,
      ul.products.columns-2,
      ul.products.columns-3,
      ul.products.columns-4,
      ul.products.columns-5) {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}
@media (max-width: 900px) {
  .produtos-grid-inner { grid-template-columns: 1fr !important; }
  .filtros-sidebar { position: static !important; }
  :is(ul.products.columns-1,
      ul.products.columns-2,
      ul.products.columns-3,
      ul.products.columns-4,
      ul.products.columns-5) {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}
@media (max-width: 560px) {
  :is(ul.products.columns-1,
      ul.products.columns-2,
      ul.products.columns-3,
      ul.products.columns-4,
      ul.products.columns-5) {
    grid-template-columns: 1fr !important;
  }
}