/* ╔══════════════════════════════════════════════════════╗
 * ║ ecommerceProducts.css — Estilos Loja Online B2B     ║
 * ║ BH3 Distribuidora | CONSART ERP                     ║
 * ╚══════════════════════════════════════════════════════╝ */

/* ───────────────────────────────────────────────────────
   Variáveis de controle do card
   ─────────────────────────────────────────────────────── */
:root {
  --ecom-card-width: 260px;        /* largura mínima do card  */
  --ecom-card-min-height: 360px;   /* altura mínima do card   */
  --ecom-card-image-height: 200px; /* altura do bloco da foto */
}

.c-page--ecommerce-products {
  background: var(--c-page-bg, #f3f4f6);
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--c-text, #0f172a);
}

/* ░░░ HEADER (INFO DA LOJA — PODE SER REMOVIDO SE NÃO USAR) ░░░ */

.ecom-header {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 1.25rem 3vw 0.75rem;
}

.ecom-header__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ecom-header__logo {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
  object-fit: cover;
}

.ecom-header__titles {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.ecom-header__subtitle {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7280;
}

.ecom-header__title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
}

/* ░░░ CONTEÚDO ░░░ */

.ecom-main {
  width: 100%;
  max-width: 100%;
  margin: 0 0 2.5rem;
  padding: 0 0 2rem;
}

/* ╔══════════════════════════════════════════════════════╗
 * ║ FILTROS DE PRODUTOS                                 ║
 * ╚══════════════════════════════════════════════════════╝ */

.ecom-filters {
  margin-top: 0;
  padding: 1rem 3vw 0.75rem;
  border-radius: 0;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem 1.5rem;
}

.ecom-filters__left,
.ecom-filters__right {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1rem;
  align-items: flex-end;
}

/* Centralizar os grupos da esquerda */
.ecom-filters__left {
  justify-content: center;
  flex: 1 1 auto;
}

.ecom-filters__group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 11rem;
}

/* Campo de busca com largura dobrada */
.ecom-filters__group--search {
  flex: 2 1 320px;
}

.ecom-filters__label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7280;
}

.ecom-filters__search-wrapper {
  display: flex;
  align-items: stretch;
  border-radius: 999px;
  border: 1px solid #cbd5f5;
  background: #f9fafb;
  overflow: hidden;
  width: 100%;
}

.ecom-filters__search-input {
  border: none;
  flex: 1;
  padding: 0.55rem 0.85rem 0.55rem 0.9rem;
  background: transparent;
  font-size: 0.9rem;
  outline: none;
  color: #111827;
}

.ecom-filters__search-input::placeholder {
  color: #9ca3af;
}

.ecom-filters__search-btn {
  border: none;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #f9fafb;
  padding: 0.45rem 0.9rem;
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ecom-filters__select {
  border-radius: 999px;
  border: 1px solid #d1d5db;
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  background: #ffffff;
  outline: none;
  min-width: 8rem;
}

/* Alternância de visualização */

.ecom-filters__group--view {
  min-width: 10.5rem;
}

.ecom-filters__view-toggle {
  display: inline-flex;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  overflow: hidden;
  background: #f9fafb;
}

.ecom-filters__view-btn {
  border: none;
  background: transparent;
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
  cursor: pointer;
  color: #4b5563;
  min-width: 4.3rem;
}

.ecom-filters__view-btn--active {
  background: #ffffff;
  color: #1d4ed8;
  font-weight: 600;
}

/* ╔══════════════════════════════════════════════════════╗
 * ║ ÁREA DE PRODUTOS + BANNERS (PAINEL COM BORDA)        ║
 * ╚══════════════════════════════════════════════════════╝ */

.ecom-products {
  margin-top: 1.4rem;
  padding: 0 3vw;
}

.ecom-products__panel {
  background: #f8fafc;
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.06);
  padding: 24px 24px 28px;
}

/* BANNERS SUPERIORES (fixos) */

.ecom-banner-boxes {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}

.ecom-banner-card {
  border-radius: 22px;
  overflow: hidden;
  background: transparent;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  aspect-ratio: 3.6 / 1;
  display: flex;
}

.ecom-banner-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

/* GRID DE PRODUTOS — mantém padrão mesmo com 1 produto */
.ecom-products__grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  justify-content: flex-start;
}

/* Modo lista: empilha os mesmos cards em coluna */
.ecom-products__grid--list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

/* ╔══════════════════════════════════════════════════════╗
 * ║ SKELETON (CARREGAMENTO DE PRODUTOS)                  ║
 * ╚══════════════════════════════════════════════════════╝ */

.ecom-products__skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--ecom-card-width), 1fr));
  gap: 24px;
  margin-top: 24px;
}

#productsSkeleton[hidden] {
  display: none !important;
}

.ecom-products__skeleton-card {
  background: #e5e7eb;
  border-radius: 20px;
  overflow: hidden;
  min-height: var(--ecom-card-min-height);
  position: relative;
}

.ecom-products__skeleton-img {
  height: var(--ecom-card-image-height);
  background: linear-gradient(90deg, #e5e7eb 0%, #f3f4f6 50%, #e5e7eb 100%);
  background-size: 200% 100%;
  animation: ecom-skeleton-shimmer 1.4s infinite;
}

.ecom-products__skeleton-text {
  padding: 12px 16px 18px;
  background: #f1f5f9;
}

.ecom-products__skeleton-text::before,
.ecom-products__skeleton-text::after {
  content: "";
  display: block;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #e5e7eb 0%, #f3f4f6 50%, #e5e7eb 100%);
  background-size: 200% 100%;
  animation: ecom-skeleton-shimmer 1.4s infinite;
}

.ecom-products__skeleton-text::after {
  margin-top: 8px;
  width: 70%;
}

@keyframes ecom-skeleton-shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* ╔══════════════════════════════════════════════════════╗
 * ║ CARD DE PRODUTO                                      ║
 * ╚══════════════════════════════════════════════════════╝ */

.ecom-product-card {
  background: #ffffff;
  border-radius: 20px;
  padding: 16px 18px 18px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  min-height: var(--ecom-card-min-height);
  box-sizing: border-box;
  transition:
    transform 0.16s ease-out,
    box-shadow 0.16s ease-out,
    background 0.16s ease-out;
  cursor: default;
}

.ecom-product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.12);
  background: #f9fbff;
}

.ecom-product-card--list {
  border-radius: 12px;
}

/* Topo: imagem + infos */

.ecom-product-card__top {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Área fixa da imagem */
.ecom-product-card__image-wrapper {
  width: 100%;
  height: var(--ecom-card-image-height);
  min-height: var(--ecom-card-image-height);
  max-height: var(--ecom-card-image-height);
  background: #ffffff;
  border-radius: 16px;
  padding: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 10px;
  overflow: hidden;
}

.ecom-product-card__image {
  width: 100%;
  height: 100%;
  max-width: 220px;   /* 🔺 imagem maior */
  max-height: 220px;
  object-fit: contain !important;
}

.ecom-product-card__image-placeholder {
  font-size: 32px;
}

/* Bloco de informações textuais */

.ecom-product-card__info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ecom-product-card__category {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
}

/* Nome do produto (compacto) */
.ecom-product-card__title,
.ecom-product-card__name {
  font-size: 11px;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.2;
  margin: 2px 0 0 0;
}

/* Código */
.ecom-product-card__code,
.ecom-product-card__sku {
  font-size: 11px;
  color: #64748b;
}

/* Descrição curta (detalhes) */
.ecom-product-card__details {
  font-size: 10px;
  color: #9ca3af;
}

/* Tags de estoque / mínimo */

.ecom-product-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

/* Pills genéricas */
.ecom-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
}

/* Sem estoque */
.ecom-tag--stock-zero {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

/* Baixo estoque */
.ecom-tag--stock-low {
  background: #fffbeb;
  border-color: #facc15;
  color: #92400e;
}

/* Estoque OK */
.ecom-tag--stock-ok {
  background: #ecfdf3;
  border-color: #bbf7d0;
  color: #15803d;
}

/* Parte inferior: preço + ações */

.ecom-product-card__bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.ecom-product-card__price-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ecom-product-card__price-label {
  font-size: 12px;
  color: #94a3b8;
}

.ecom-product-card__price {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
}

/* Ações: quantidade + botão */

.ecom-product-card__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* Grupo quantidade/unidade */

.ecom-product-card__qty-group,
.ecom-product-card__qty-wrapper {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  padding: 4px 10px;
  gap: 6px;
}

.ecom-product-card__qty-input {
  width: 40px;
  border: none;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #0f172a;
  outline: none;
  background: transparent;
}

.ecom-product-card__qty-input::-webkit-outer-spin-button,
.ecom-product-card__qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.ecom-product-card__qty-input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.ecom-product-card__qty-label,
.ecom-product-card__unit {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
}

/* Botão adicionar */

.ecom-product-card__btn,
.ecom-product-card__add-btn {
  flex: 1;
  border: none;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(79, 70, 229, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition:
    transform 0.12s ease-out,
    box-shadow 0.12s ease-out,
    filter 0.12s ease-out;
}

.ecom-product-card__btn:hover,
.ecom-product-card__add-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(79, 70, 229, 0.42);
  filter: brightness(1.03);
}

.ecom-product-card__btn:active,
.ecom-product-card__add-btn:active {
  transform: translateY(0);
  box-shadow: 0 8px 18px rgba(79, 70, 229, 0.32);
}

/* Estado desabilitado (sem estoque) */

.ecom-product-card__btn:disabled,
.ecom-product-card--disabled .ecom-product-card__btn {
  background: #e2e8f0;
  box-shadow: none;
  color: #94a3b8;
  cursor: not-allowed;
}

/* ░░░ ESTADOS: VAZIO / ERRO ░░░ */

.ecom-products__empty,
.ecom-products__error {
  margin-top: 1.5rem;
  padding: 1.25rem 1rem;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.06);
  text-align: center;
}

.ecom-products__empty-btn {
  margin-top: 0.75rem;
  border-radius: 999px;
  border: none;
  padding: 0.4rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #f9fafb;
}

/* ░░░ PAGINAÇÃO ░░░ */

.ecom-pagination {
  margin-top: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
}

.ecom-pagination__btn {
  border-radius: 999px;
  border: 1px solid #d1d5db;
  padding: 0.35rem 0.9rem;
  background: #ffffff;
  font-size: 0.8rem;
  cursor: pointer;
}

.ecom-pagination__btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ecom-pagination__info {
  font-size: 0.8rem;
  color: #6b7280;
}

/* ░░░ FOOTER ░░░ */

.ecom-footer {
  border-top: 1px solid rgba(148, 163, 184, 0.4);
  padding: 0.9rem 1rem 1.4rem;
  text-align: center;
  font-size: 0.78rem;
  color: #6b7280;
}

.ecom-footer__muted {
  color: #9ca3af;
}

/* ░░░ RESPONSIVO ░░░ */

@media (max-width: 768px) {
  .ecom-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .ecom-header__actions {
    align-self: stretch;
    justify-content: flex-end;
  }

  .ecom-filters {
    flex-direction: column;
  }

  .ecom-filters__right {
    width: 100%;
    justify-content: flex-start;
  }

  .ecom-products {
    padding: 0 1rem;
  }

  .ecom-banner-boxes {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .ecom-product-card {
    border-radius: 16px;
  }

  /* Card no modo grid — nunca estoura largura */
.ecom-product-card {
  max-width: 320px;
  width: 100%;
  justify-self: start;
}

  .ecom-product-card__image {
    max-width: 160px;
  }
}

.ecom-product-card__btn-label {
  display: inline-block;
}

.ecom-product-card__btn-icon {
  width: 16px;
  height: 16px;
  display: inline-block;
  object-fit: contain;
}