/* =================================================================
   CARD — reusable product card styles.
   Used in catalog (.cards-grid) and home page carousels (home-hits, home-novelties).
   ================================================================= */

/* ── GRID (catalog) ─────────────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

/* ── CARD BASE ─────────────────────────────────────────────────── */
.card {
  background: var(--pc-card, #fff);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--pc-border, #e8e8e6);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 200ms cubic-bezier(.25,.46,.45,.94),
              box-shadow 200ms cubic-bezier(.25,.46,.45,.94);
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(0,0,0,.07), 0 2px 6px rgba(0,0,0,.03);
}

/* ── IMAGE AREA ─────────────────────────────────────────────────── */
.card__img-wrap {
  position: relative;
  background: #fafaf8;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.card__img-link {
  display: block;
  width: 100%;
  height: 100%;
  text-decoration: none;
  color: inherit;
}

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

/* Wishlist heart — hidden until wishlist feature is implemented */
.card__wishlist {
  display: none;
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(4px);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: var(--pc-text-3, #999);
  transition: color 200ms ease, background 200ms ease, transform 160ms ease;
}

.card__wishlist:hover {
  color: #e74c3c;
  background: #fff;
  transform: scale(1.1);
}

/* ── LABELS (on image) — same shape as savings badge, left side ── */
.card__label {
  position: absolute;
  top: 0;
  left: 0;
  height: 32px;
  display: flex;
  align-items: center;
  padding: 0 12px 0 10px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 0 0 10px 0;
  z-index: 1;
}

.card__label--new {
  background: linear-gradient(90deg, #96ea2e, #7bc425);
  color: #315306;
}

.card__label--sale {
  background: linear-gradient(90deg, #ff6b6b, #e74c3c);
  color: #fff;
}

/* ── SAVINGS BADGE ("выгода") — legacy on image, скрыт (перенесён в блок цен) ── */
.card__savings {
  display: none;
}

/* ── SAVINGS INLINE — полная строка (mobile) ───────────────────── */
.card__savings-inline {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: #cd4178;
  line-height: 1.2;
}

/* ── SAVINGS PCT — только −N% (desktop) ────────────────────────── */
.card__savings-pct {
  display: none;
}

/* ── PINK BUTTON — only inside "Похожие товары" ─────────────────── */
.featured-product .card__buy {
  background: #cd4178;
}

.featured-product .card__buy:hover {
  background: #d54e84;
  box-shadow: 0 4px 14px rgba(205,65,120,.22);
}

/* ── BODY ───────────────────────────────────────────────────────── */
.card__body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
  border-radius: 14px 14px 0 0;
  margin-top: -10px;
  position: relative;
  z-index: 1;
  background: var(--pc-card, #fff);
}

.card__title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--pc-text, #1a1a1a);
  margin: 0 0 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;
}

/* ── BADGES (specs) ─────────────────────────────────────────────── */
.card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
  min-height: 26px;
  align-content: flex-start;
}

.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  color: var(--pc-text-2, #666);
  background: #f2f2f0;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
}

.card__badge-accent {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--pc-blue, #00a7e1);
  background: rgba(0,167,225,.08);
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
}

/* ── FOOTER ─────────────────────────────────────────────────────── */
.card__footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--pc-border, #e8e8e6);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

/* ── PRICE ──────────────────────────────────────────────────────── */
.card__price {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card__price-old {
  font-size: 12px;
  color: var(--pc-text-3, #999);
  text-decoration: line-through;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.card__price-current {
  font-size: 20px;
  font-weight: 700;
  color: var(--pc-text, #1a1a1a);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  line-height: 1.2;
}

/* ── ACTIONS ────────────────────────────────────────────────────── */
.card__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.card__buy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--pc-blue, #00a7e1);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 11px 20px;
  border: none;
  border-radius: 10px;
  text-decoration: none;
  cursor: pointer;
  transition: background 200ms ease, transform 160ms ease, box-shadow 200ms ease;
  white-space: nowrap;
}

.card__buy:hover {
  background: var(--pc-blue-hover, #0094c8);
  box-shadow: 0 4px 14px rgba(0,167,225,.22);
  transform: translateY(-1px);
}

.card__buy:active {
  transform: translateY(0) scale(0.97);
}

/* Override legacy .product-detail__reserve-cart inside cards */
.card .card__buy.product-detail__reserve-cart {
  width: auto;
  font-size: 14px;
  font-weight: 600;
}

.card__buy svg {
  fill: currentColor;
  flex-shrink: 0;
}

/* "Подробнее" arrow button */
.card__more-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--pc-border, #e8e8e6);
  background: #fff;
  color: var(--pc-blue, #00a7e1);
  text-decoration: none;
  flex-shrink: 0;
  transition: background 200ms ease, border-color 200ms ease, transform 160ms ease;
}

.card__more-btn:hover {
  background: rgba(0,167,225,.08);
  border-color: var(--pc-blue, #00a7e1);
  transform: translateY(-1px);
}

.card__more-btn svg {
  stroke: currentColor;
}

/* ── DESKTOP — G1: цены в один ряд, кнопки ниже ─────────────────── */
@media (min-width: 641px) {
  .card__footer {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .card__price {
    flex-flow: row wrap;
    align-items: baseline;
    gap: 4px 8px;
  }

  .card__price-current {
    order: 1;
    font-size: 18px;
  }

  .card__price-old {
    order: 2;
  }

  .card__savings-pct {
    order: 3;
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    color: #cd4178;
    line-height: 1.25;
    white-space: nowrap;
  }

  .card__savings-inline {
    display: none;
  }

  .card__actions {
    display: flex;
    gap: 8px;
  }

  .card__buy {
    flex: 1;
    justify-content: center;
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* ── RESPONSIVE — base card ─────────────────────────────────────── */
@media (max-width: 991px) {
  .cards-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .card {
    border-radius: 10px;
  }

  .card__body {
    padding: 8px 8px 10px;
  }

  .card__title {
    font-size: 13px;
    min-height: 2em;
    margin-bottom: 6px;
    -webkit-line-clamp: 2;
  }

  .card__badges {
    gap: 4px;
    margin-bottom: 8px;
  }

  .badge,
  .card__badge-accent {
    font-size: 12px;
    padding: 3px 7px;
    border-radius: 4px;
  }

  .card__price-current {
    font-size: 16px;
  }

  .card__price-old {
    font-size: 12px;
  }

  /* Label badge — smaller on mobile */
  .card__label {
    height: 24px;
    font-size: 10px;
    padding: 0 8px 0 6px;
    border-radius: 0 0 8px 0;
  }

  /* Savings inline — чуть компактнее на mobile */
  .card__savings-inline {
    font-size: 11px;
  }

  .card__buy {
    font-size: 13px;
    padding: 8px 10px;
    gap: 4px;
    border-radius: 8px;
  }

  .card__more-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid #e8e8e6;
  }

  .card__more-btn svg {
    width: 14px;
    height: 14px;
  }

  /* Footer — vertical layout on mobile */
  .card__footer {
    flex-direction: column;
    align-items: stretch;
    padding-top: 8px;
    gap: 8px;
    margin-top: auto;
  }

  .card__price {
    text-align: left;
  }

  .card__actions {
    display: flex;
    gap: 6px;
  }

  .card__buy {
    flex: 1;
    justify-content: center;
  }

  .card__more-btn {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
  }

  .card__wishlist {
    width: 24px;
    height: 24px;
  }

  .card__wishlist svg {
    width: 13px;
    height: 13px;
  }

  .card__img-wrap {
    aspect-ratio: 1 / 1;
  }

  /* Disable hover effects on mobile */
  .card:hover {
    transform: none;
    box-shadow: none;
  }
}
