/* Clean, scoped grid only for the Best Selling section */

/* 1) Identify Best Selling section via attribute or heading helper class */
section[data-category="สินค้าขายดี"],
section[data-section-id="best-selling"],
section.best-selling-section {
  --card-gap: 32px;
}

/* 2) The new grid wrapper */
.best-selling-clean-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--card-gap);
  align-items: stretch;
  box-sizing: border-box;
  padding: 0 15px;
  width: 100%;
}

/* 3) Children normalization (only inside this grid) */
.best-selling-clean-grid > * {
  min-width: 0;
  margin: 0;
  padding: 0;
}

/* 4) Card sizing and safety */
.best-selling-clean-grid .card,
.best-selling-clean-grid .product-card {
  width: 100%;
  margin: 0;
  box-sizing: border-box;
  overflow: hidden;
}

/* Fix product name font size and wrapping */
.best-selling-clean-grid .product-card .product-title,
.best-selling-clean-grid .product-card .card-title,
.best-selling-clean-grid .product-card .product-name {
  font-size: 10px !important;
  font-weight: 600 !important;
  color: #0066cc !important; /* เปลี่ยนเป็นสีฟ้าเข้มแทน #1b365d */
  word-break: break-word;
  white-space: normal;
  line-height: 1.25 !important;
  margin-bottom: 10px !important;
  letter-spacing: 0.01em !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  text-align: center !important;
  line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  padding: 0 12px !important;
}

/* 5) Image presentation */
.best-selling-clean-grid .card-img-top-wrapper {
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.best-selling-clean-grid .card-img-top {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

/* 6) Responsive breakpoints */
@media (max-width: 1200px){
  .best-selling-clean-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 992px){
  .best-selling-clean-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 576px){
  .best-selling-clean-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
