/* ─── Product Grid ─── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-8);
  contain: layout style;
}

@media (min-width: 640px) {
  .product-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 1025px) {
  .product-grid { grid-template-columns: repeat(5, 1fr); }
}

.product-grid--recommended .product-card:nth-child(n+19) { display: none; }
@media (min-width: 640px) {
  .product-grid--recommended .product-card:nth-child(n+19) { display: flex; }
}

/* ─── Product Card (exact copy of rose-card) ─── */
.product-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.product-card__img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 8 / 9;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--color-gray-light);
  cursor: pointer;
}

.product-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ─── Discount badge ─── */
.product-card__discount {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  font-size: 11px;
  font-weight: var(--fw-bold);
  color: var(--color-white);
  background: var(--color-primary);
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  pointer-events: none;
}

/* ─── Controls area (same as rose-card) ─── */
.product-card__controls {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  height: 36px;
  z-index: 2;
}

.product-card__plus-btn {
  position: absolute;
  right: 0;
  top: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-white);
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  z-index: 1;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.product-card__plus-btn img {
  pointer-events: none;
}

.product-card__plus-btn:active {
  transform: scale(0.92);
}

.product-card__plus-btn--hidden {
  opacity: 0;
  transform: scale(0.4);
  pointer-events: none;
}

/* ─── Quantity bar (expands from under + button, same as rose-card) ─── */
.product-card__qty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: stretch;
  background: var(--color-white);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-card);
  overflow: hidden;

  opacity: 0;
  transform: scaleX(0);
  transform-origin: right center;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.3, 0.64, 1);
}

.product-card__qty--visible {
  opacity: 1;
  transform: scaleX(1);
  pointer-events: auto;
}

.product-card__qty-btn {
  flex-shrink: 0;
  width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  user-select: none;
}

.product-card__qty-btn img {
  pointer-events: none;
}

.product-card__qty-btn:active {
  background: var(--color-gray-light);
}

.product-card__qty-field {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: text;
}

.product-card__qty-input {
  width: 100%;
  height: 11px;
  border: none;
  outline: none;
  background: transparent;
  text-align: center;
  font-size: var(--fs-base);
  font-weight: var(--fw-bold);
  color: var(--color-black);
  padding: 0;
  -moz-appearance: textfield;
  appearance: textfield;
}

.product-card__qty-input::-webkit-outer-spin-button,
.product-card__qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}

/* ─── Info below image (same as rose-card) ─── */
.product-card__info {
  padding: var(--sp-12) var(--sp-4);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--sp-5);
  overflow-x: hidden;
}

.product-card__prices {
  display: flex;
  align-items: flex-end;
  gap: 4px;
}

.product-card__price {
  margin-bottom: -3px;
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  line-height: var(--lh-15);
  color: var(--color-black);
  pointer-events: none;
}

.product-card__old-price {
  font-size: var(--fs-sm);
  font-weight: var(--fw-regular);
  line-height: var(--lh-9);
  color: var(--color-black);
  text-decoration: line-through;
  opacity: 0.64;
}

.product-card__old-price:empty {
  display: none;
}

.product-card__name {
  display: block;
  width: 100%;
  font-size: var(--fs-base);
  font-weight: var(--fw-regular);
  line-height: var(--lh-10);
  color: var(--color-black);
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ─── Infinite scroll sentinel ─── */
.products-sentinel {
  display: flex;
  justify-content: center;
  padding: var(--sp-16) 0;
  min-height: 48px;
}

.products-sentinel__spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--color-gray-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.2s;
  animation: sentinel-spin 0.7s linear infinite;
}

.products-sentinel--loading .products-sentinel__spinner {
  opacity: 1;
}

.products-sentinel--done {
  display: none;
}

@keyframes sentinel-spin {
  to { transform: rotate(360deg); }
}
