/* assets/css/product_ui.css - Modern product listing UI (Shopee/Tokopedia style) */

/* Container for product grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 15px;
  padding: 15px 0;
}

/* Horizontal scroll specifically for home page (Produk Terbaru) to match Flash Sale style */
.home-product .product-grid {
  display: flex !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 20px;
}
.home-product .product-grid::-webkit-scrollbar {
  height: 8px;
}
.home-product .product-grid::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}
.home-product .product-grid::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
.home-product .product-grid::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}
.home-product .product-grid .product-card {
  flex: 0 0 200px;
  scroll-snap-align: start;
}

/* Individual product card */
.product-card {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(8px);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.product-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.product-card .info {
  padding: 0.75rem 1rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.product-card .info h3 {
  font-size: 1rem;
  margin: 0 0 0.5rem 0;
  color: var(--text-dark);
  height: 2.4em; /* limit to two lines */
  overflow: hidden;
}

.product-card .info .price {
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.product-card .info .btn-primary {
  align-self: flex-start;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .product-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
  .product-card img {
    height: 150px;
  }
}

@media (max-width: 500px) {
  .product-grid {
    grid-template-columns: 1fr;
  }
}

/* Badge styles */
.new-badge,
.stock-badge,
.sold-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background: var(--primary);
  color: #fff;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}
.new-badge {
  background: #28a745; /* success green */
}
.sold-badge {
  background: #a00;
}

/* Adjust stock badge position */
.stock-badge {
  left: auto;
  right: 0.5rem;
}

/* Out of stock overlay */
.out-of-stock-card {
  opacity: 0.6;
  pointer-events: none;
}

/* Price styling */
.product-card .price {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
}

/* Button styling – reuse btn-primary */
.product-card .product-btn {
  margin-top: 0.5rem;
  align-self: flex-start;
}

/* Disabled button */
.disabled-btn {
  background: #aaa;
  cursor: not-allowed;
}
