/* =============================================
   components/products/products.css
/* ── Grid ─────────────────────────────────────────────────────────── */
.produtos-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  width: 100%;
}

@media (min-width: 640px) {
  .produtos-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.875rem;
  }
}
@media (min-width: 900px) {
  .produtos-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
@media (min-width: 1024px) {
  .produtos-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
  }
}
@media (min-width: 1400px) {
  .produtos-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* ── Card ─────────────────────────────────────────────────────────── */
.produto-card {
  display: grid;
  grid-template-rows: auto 1fr; /* media fixa + body cresce igual */
  background: var(--branco, #fff);
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.15s, border-color 0.2s;
}
/*Hover do produto*/
@media (hover: hover) and (pointer: fine) {
  .filtro-chip--ativo:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #fff;
  }
  .filtros-pro__limpar:hover {
    background: #fee2e2;
  }
  html.dark .produto-card:hover,
  html.dark .produto-card:focus-visible {
    border-color: #3b82f6;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  }
  html.dark .filtro-chip:hover {
    border-color: #3b82f6;
    color: #93c5fd;
  }
  .filtro-chip:hover {
    border-color: var(--azul-medio, #2563eb);
    color: var(--azul-medio, #2563eb);
  }
  .produto-card:hover .produto-card__img {
    transform: scale(1.05);
  }
  .produto-card:hover,
  .produto-card:focus-visible {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    border-color: var(--azul-medio, #2563eb);
    outline: none;
  }
}

.produto-card:focus-visible {
  outline: 2px solid var(--azul-medio, #2563eb);
  outline-offset: 2px;
}

/* ── Área de média ────────────────────────────────────────────────── */
.produto-card__media {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1; /* quadrado perfeito — consistente */
  background: #f8fafc;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.produto-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

/* Placeholder sem imagem — ícone SVG centralizado */
.produto-card__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  color: #94a3b8;
  font-size: 2rem;
}

/* ── Badges sobre a imagem ────────────────────────────────────────── */
.produto-card__badge {
  position: absolute;
  top: 0.45rem;
  left: 0.45rem;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.18rem 0.4rem;
  border-radius: 0.3rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1.4;
}

.produto-card__badge--out {
  background: #fee2e2;
  color: #b91c1c;
}

/* Distância */
.produto-card__dist {
  position: absolute;
  bottom: 0.4rem;
  right: 0.4rem;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.18rem 0.4rem;
  border-radius: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.2rem;
  backdrop-filter: blur(4px);
}

/* ── Corpo ─────────────────────────────────────────────────────────── */
.produto-card__body {
  display: flex;
  flex-direction: column;
  padding: 0.55rem 0.6rem 0.65rem;
  gap: 0.18rem;
  align-self: stretch;
}

/* Loja */
.produto-card__loja {
  display: flex;
  align-items: center;
  gap: 0.22rem;
  margin: 0;
}

.produto-card__loja-nome {
  font-size: 0.68rem;
  color: var(--texto-suave, #64748b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.produto-card__selo {
  color: var(--azul-medio);
  font-size: 0.78rem;
  flex-shrink: 0;
}

/* Nome — clamp a 2 linhas, altura mínima fixa */
.produto-card__nome {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--texto, #0f172a);
  line-height: 1.35;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(0.78rem * 1.35 * 2);
}

/* Preço */
.produto-card__preco {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--azul-medio, #2563eb);
  margin: 0.12rem 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Estoque com cores semânticas ─────────────────────────────────── */
.produto-card__estoque {
  font-size: 0.67rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.22rem;
  margin: 0;
  margin-top: auto; /* empurra para o fundo do body */
  padding: 0.22rem 0.45rem;
  border-radius: 0.35rem;
  width: fit-content;
  line-height: 1;
}

/* Verde — estoque ≥ 10 */
.produto-card__estoque.est--ok {
  background: #dcfce7;
  color: #15803d;
}

/* Amarelo — estoque 5 a 9 */
.produto-card__estoque.est--medio {
  background: #fef9c3;
  color: #a16207;
}

/* Vermelho — estoque 1 a 4 */
.produto-card__estoque.est--baixo {
  background: #fee2e2;
  color: #b91c1c;
}

/* Cinza — sem estoque */
.produto-card__estoque.est--zero {
  background: #f1f5f9;
  color: #94a3b8;
}

/* ── Skeleton ─────────────────────────────────────────────────────── */
.busca-loading {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .busca-loading {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (min-width: 900px) {
  .busca-loading {
    grid-template-columns: repeat(4, 1fr);
  }
}
@media (min-width: 1024px) {
  .busca-loading {
    grid-template-columns: repeat(5, 1fr);
  }
}
@media (min-width: 1400px) {
  .busca-loading {
    grid-template-columns: repeat(6, 1fr);
  }
}

.produto-card-skeleton {
  border-radius: 0.75rem;
  aspect-ratio: 3 / 4;
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease infinite;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ── Estado vazio ─────────────────────────────────────────────────── */
.sem-resultados {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3.5rem 1.5rem;
  gap: 0.75rem;
}

.sem-resultados__icon {
  font-size: 3rem;
  color: #cbd5e1;
  line-height: 1;
}

.sem-resultados__titulo {
  font-size: 1rem;
  font-weight: 700;
  color: var(--texto, #0f172a);
  margin: 0;
}

.sem-resultados__sub {
  font-size: 0.85rem;
  color: var(--texto-suave, #64748b);
  margin: 0;
  line-height: 1.6;
  max-width: 320px;
}

.filtro-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.32rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1.5px solid #cbd5e1;
  border-radius: 2rem;
  background: var(--branco, #fff);
  color: var(--texto, #0f172a);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s,
    box-shadow 0.15s;
  white-space: nowrap;
  user-select: none;
  line-height: 1;
}

.filtro-chip--sm {
  padding: 0.26rem 0.55rem;
  font-size: 0.73rem;
}
.filtro-chip--ativo {
  background: var(--azul-medio, #2563eb);
  border-color: var(--azul-medio, #2563eb);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.22);
}

/* ── Ver mais ─────────────────────────────────────────────────────── */
.ver-mais-wrapper {
  display: flex;
  justify-content: center;
  padding: 1.25rem 0 0.5rem;
}

/* Spin para loader */
@keyframes sp {
  to {
    transform: rotate(360deg);
  }
}
.sp {
  display: inline-block;
  animation: sp 0.8s linear infinite;
}

/* ── Dark mode ────────────────────────────────────────────────────── */
html.dark .produto-card {
  background: #1e293b;
  border-color: #334155;
}
html.dark .produto-card__media,
html.dark .produto-card__placeholder {
  background: #0f172a;
  color: #334155;
}

html.dark .produto-card__nome {
  color: #f1f5f9;
}
html.dark .produto-card__loja-nome,
html.dark .produto-card__estoque.est--zero {
  color: #94a3b8;
}

html.dark .produto-card-skeleton {
  background: linear-gradient(90deg, #1e293b 25%, #273549 50%, #1e293b 75%);
  background-size: 200% 100%;
}

html.dark .filtros-pro__row,
html.dark .filtros-pro__footer {
  border-color: #334155;
}

html.dark .filtro-chip {
  background: #1e293b;
  border-color: #475569;
  color: #f1f5f9;
}
html.dark .filtro-chip--ativo {
  background: var(--azul-medio);
  border-color: var(--azul-medio);
  color: #fff;
}

html.dark .filtros-pro__input {
  background: #0f172a;
  border-color: #334155;
  color: #f1f5f9;
}

html.dark .filtros-pro__input:focus {
  border-color: #3b82f6;
}

html.dark .filtros-pro__toggle-track {
  background: #475569;
}
html.dark .filtros-pro__toggle-label {
  color: #f1f5f9;
}

html.dark .sem-resultados__titulo {
  color: #f1f5f9;
}
html.dark .sem-resultados__icon {
  color: #334155;
}

/* ── Responsivo mobile fino ───────────────────────────────────────── */
@media (max-width: 480px) {
  .filtros-pro {
    padding: 0.875rem;
    gap: 0.7rem;
  }

  .filtros-pro__row {
    flex-direction: column;
    gap: 0.75rem;
    margin-top: -1rem;
  }

  .filtros-pro__group--input {
    flex: 1 1 100%;
  }

  .filtro-chip {
    padding: 0.28rem 0.55rem;
    font-size: 0.73rem;
  }
}
