/* ─── PRODUCT CARD — reference layout, спокойный зелёный ──────────────────── */
:root {
  --product-green: #3d8f63;
  --product-green-hover: #2f7350;
  --product-green-muted: #5a9a78;
}

/* ─── Сетка ───────────────────────────────────────────────────────────────── */
.products-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 32px 20px;
  align-items: stretch;
  width: 100%;
}

.products-grid > .product-card {
  min-width: 0;
  max-width: 100%;
}

.products-grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 1100px) {
  .products-grid,
  .products-grid--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .products-grid,
  .products-grid--3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(12px, 3.5vw, 20px) clamp(8px, 2.5vw, 12px);
    align-items: stretch;
  }

  .products-grid > .product-card {
    width: 100%;
    min-width: 0;
  }

  .product-card {
    height: 100%;
    gap: clamp(8px, 2.5vw, 12px);
  }

  .product-card-img-wrap {
    width: 100%;
    max-width: 100%;
    border-radius: clamp(10px, 3vw, 16px);
  }

  .product-card-info {
    flex: 1;
    min-width: 0;
    padding: 0 2px;
    gap: clamp(6px, 2vw, 10px);
  }

  .product-cat {
    font-size: clamp(10px, 2.8vw, 12px);
    line-height: 1.35;
    min-height: calc(2 * 1.35 * 1em);
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .product-name {
    font-size: clamp(12px, 3.6vw, 14px);
    line-height: 1.35;
    min-height: calc(3 * 1.35 * 1em);
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .product-name a {
    min-width: 0;
  }

  .product-price {
    margin-top: auto;
  }

  .product-price .price-sale {
    font-size: clamp(14px, 4vw, 18px);
  }

  .product-price .price-original {
    font-size: clamp(12px, 3.2vw, 16px);
  }

  .product-badge {
    top: clamp(6px, 2vw, 12px);
    left: clamp(6px, 2vw, 12px);
    font-size: clamp(9px, 2.5vw, 11px);
    padding: 3px 8px;
  }

  .add-cart-form {
    bottom: clamp(6px, 2vw, 12px);
    right: clamp(6px, 2vw, 12px);
    max-width: calc(100% - 12px);
  }

  .btn-add-card {
    font-size: clamp(10px, 2.8vw, 13px);
    height: clamp(28px, 8vw, 36px);
    min-width: 0;
    max-width: 100%;
    padding: 0 clamp(8px, 2.5vw, 16px);
    white-space: nowrap;
  }
}

.products-grid-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 0;
  color: #888;
}

/* ─── Карточка (reference) ────────────────────────────────────────────────── */
.product-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
}

.product-card-img-wrap {
  position: relative;
  background: #f5f5f5;
  border-radius: 16px;
  aspect-ratio: 1;
  overflow: hidden;
}

.product-card-img-link {
  display: block;
  width: 100%;
  height: 100%;
}

.product-card-img-wrap .product-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.product-card:hover .product-img {
  transform: scale(1.05);
}

.product-img-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: #aaa;
  font-size: 13px;
}

.product-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--product-green);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 99px;
  z-index: 1;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.product-badge.sold-out {
  background: #111;
}

.add-cart-form {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 2;
  margin: 0;
}

.btn-add-card {
  position: static;
  background: var(--product-green);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  height: 36px;
  padding: 0 16px;
  border-radius: 99px;
  border: none;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.18s, transform 0.18s, background 0.12s;
  min-width: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.product-card:hover .btn-add-card {
  opacity: 1;
  transform: translateY(0);
}

.btn-add-card:hover {
  background: var(--product-green-hover);
}

.btn-add-card:disabled {
  cursor: wait;
  opacity: 0.7;
}

@media (max-width: 991px) {
  .btn-add-card {
    opacity: 1;
    transform: translateY(0);
  }
}

.product-card-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 4px;
  flex: 1;
  min-width: 0;
}

.product-cat {
  font-size: 12px;
  color: var(--product-green-muted);
  font-weight: 500;
  line-height: 1.35;
}

.product-name {
  font-size: 16px;
  font-weight: 700;
  color: #111;
  line-height: 1.3;
  min-width: 0;
  overflow-wrap: anywhere;
}

.product-name a {
  color: inherit;
}

.product-name a:hover {
  opacity: 0.75;
}

.product-price {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: auto;
  padding-top: 2px;
}

.product-price .price-sale {
  font-size: 18px;
  font-weight: 700;
  color: var(--product-green);
}

.product-price .price-original {
  font-size: 16px;
  color: #777;
  text-decoration: line-through;
}

.product-card.sold-out .product-img {
  opacity: 0.5;
}

/* ─── Вид списком (каталог) ───────────────────────────────────────────────── */
.products-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.products-list .product-card {
  flex-direction: row;
  align-items: center;
  gap: 20px;
  background: #fff;
  border-radius: 16px;
  padding: 12px 16px;
}

.products-list .product-card-img-wrap {
  width: 96px;
  height: 96px;
  flex-shrink: 0;
  aspect-ratio: auto;
}

.products-list .product-img {
  object-fit: cover;
}

.products-list .product-card-info {
  flex: 1;
  min-width: 0;
}

.products-list .add-cart-form {
  position: static;
}

.products-list .btn-add-card {
  opacity: 1;
  transform: none;
}

@media (max-width: 560px) {
  .products-list .product-card {
    flex-wrap: wrap;
  }

  .products-list .add-cart-form {
    width: 100%;
    padding-left: 112px;
  }

  .products-list .btn-add-card {
    width: 100%;
  }
}
