@charset "UTF-8";
/* =====================================================
   cat_product-card.css v5.4 — Карточка товара (3-колоночная)
   Путь: /css2/cat_product-card.css
   Группа конфигуратора: css_каталоги (2-й в группе)
   Зависит от: cat_catalog.css (CSS-переменные темы), all_micro.css (timing-токены)
   v5.4 — transition timing → --mi-t-* tokens
   v5.3 — стили .product-card__buy--in-cart
   ===================================================== */

/* ═══ СПИСОК ТОВАРОВ ═══ */

.list-goods {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  flex-direction: column;
}

/* ───────────────────────────────────────────────────────
   FALLBACK (без View Transitions): grid-template-rows
   Браузеры без VT — плавное схлопывание через CSS grid
   ─────────────────────────────────────────────────────── */
.list-goods__product {
  list-style: none;
  margin-bottom: 8px;
  display: grid;
  grid-template-rows: 1fr;
  opacity: 1;
  transition:
    grid-template-rows 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.3s ease,
    margin-bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.list-goods__product:last-child { margin-bottom: 0; }

.list-goods__product > .product-card {
  min-height: 0;
  overflow: hidden;
  transition:
    padding 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    border-width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.list-goods__product.page__hidden {
  grid-template-rows: 0fr;
  opacity: 0;
  margin-bottom: 0 !important;
  pointer-events: none;
}
.list-goods__product.page__hidden > .product-card {
  padding-top: 0;
  padding-bottom: 0;
  border-top-width: 0;
  border-bottom-width: 0;
}

/* ───────────────────────────────────────────────────────
   PRIMARY (View Transitions API): браузер анимирует
   JS ставит класс .list-goods--vt когда API доступен.
   Отключаем CSS-transition, скрываем через display:none
   — браузер сам анимирует snapshot'ы.
   ─────────────────────────────────────────────────────── */
.list-goods--vt .list-goods__product {
  transition: none;
  view-transition-class: product-item;
}
.list-goods--vt .list-goods__product > .product-card {
  transition: none;
}
.list-goods--vt .list-goods__product.page__hidden {
  display: none !important;
  grid-template-rows: unset;
  opacity: unset;
  margin-bottom: unset !important;
}

/* VT: анимация ухода (элемент фильтруется — исчезает) */
::view-transition-old(*.product-item):only-child {
  animation: vt-product-out 0.25s ease-in forwards;
}
/* VT: анимация появления (элемент возвращается) */
::view-transition-new(*.product-item):only-child {
  animation: vt-product-in 0.3s ease-out;
}
/* VT: оставшиеся элементы — плавное перемещение */
::view-transition-group(*.product-item) {
  animation-duration: 0.35s;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes vt-product-out {
  to { opacity: 0; transform: scale(0.96) translateY(-6px); }
}
@keyframes vt-product-in {
  from { opacity: 0; transform: scale(0.96) translateY(6px); }
}

/* ═══ КАРТОЧКА: 3-колоночный grid ═══ */

.product-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 110px 1fr 155px;
  gap: 16px;
  align-items: center;
  transition: border-color var(--mi-t-bounce), background var(--mi-t-bounce), box-shadow var(--mi-t-bounce);
}
.product-card:hover {
  border-color: var(--card-border-hover);
  background: var(--card-bg-hover);
  box-shadow: var(--card-shadow-hover);
}

/* ═══ ФОТО ═══ */

.product-card__photo {
  width: 110px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--photo-bg);
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  text-decoration: none;
  position: relative;
  border: var(--photo-border);
  transition: background var(--mi-t-base);
}

.product-card__img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  padding: 6px;
  transition: transform 0.4s ease;
}
.product-card:hover .product-card__img { transform: scale(1.05); }

.product-card__no-photo {
  color: var(--text-muted);
  font-size: 11px;
  font-style: italic;
  text-align: center;
  padding: 6px;
  line-height: 1.3;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Бейдж бренда / честный знак */
.product-card__hallmark {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.product-card__hallmark-img {
  border-radius: 4px;
  opacity: 0.6;
  max-width: 24px;
  transition: opacity var(--mi-t-base);
}
.product-card__hallmark-img:hover { opacity: 1; }

/* ═══ ИНФО ═══ */

.product-card__info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.product-card__name {
  font-size: 15px;
  font-weight: 700;
  color: var(--name-color);
  text-decoration: none;
  line-height: 1.3;
  letter-spacing: -0.01em;
  transition: color var(--mi-t-base);
}
.product-card__name:hover { color: var(--name-hover); }

.product-card__type {
  font-size: 12px;
  color: var(--type-color);
}

/* Характеристики — одна строка через точку */
.product-card__specs {
  font-size: 12.5px;
  color: var(--specs-color);
  line-height: 1.4;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ─── Наличие ─── */

.product-card__status {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.product-card__avail {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  margin: 0;
}

/* Цвет по data-stock (processor.py меняет только атрибут, не класс) */
.product-card__avail[data-stock="yes"],
.product-card__avail--yes { color: var(--avail-yes); }

.product-card__avail[data-stock="no"],
.product-card__avail--no { color: var(--avail-no); }

/* Точка-индикатор: ::before (новые страницы) + .avail-dot (старые) */
.product-card__avail-dot,
.product-card__avail::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.product-card__avail[data-stock="yes"] .product-card__avail-dot,
.product-card__avail[data-stock="yes"]::before,
.product-card__avail--yes .product-card__avail-dot,
.product-card__avail--yes::before {
  background: var(--avail-yes);
  box-shadow: 0 0 5px var(--avail-glow);
}
.product-card__avail[data-stock="no"] .product-card__avail-dot,
.product-card__avail[data-stock="no"]::before,
.product-card__avail--no .product-card__avail-dot,
.product-card__avail--no::before {
  background: var(--avail-no);
}

.product-card__delivery {
  font-size: 11px;
  color: var(--text-muted);
}

.product-card__expected {
  font-size: 11px;
  color: var(--action-color);
  font-weight: 500;
}

/* Подарки / промо */
.product-card__promo {
  font-size: 11.5px;
  color: var(--avail-yes);
  font-weight: 600;
  margin: 0;
  padding: 2px 0;
}
.product-card__promo-sub {
  font-weight: 400;
  font-size: 11px;
  color: var(--specs-color);
}

/* ─── Действия ─── */

.product-card__actions {
  display: flex;
  gap: 10px;
  margin-top: 2px;
}
.product-card__action {
  font-size: 11.5px;
  color: var(--action-color);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  text-decoration: none;
  transition: color var(--mi-t-base);
  font-family: inherit;
}
.product-card__action:hover { color: var(--action-hover); }

/* Бейдж распродажи */
.product-card__sale {
  display: inline-block;
  padding: 2px 8px;
  background: #dc2626;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
}

/* ═══ ПРАВАЯ ЗОНА: ЦЕНА + КНОПКА ═══ */

.product-card__price-area {
  text-align: center;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 0;
  padding-left: 16px;
  margin: -14px -16px -14px 0;
  padding-right: 16px;
  background: var(--price-bg);
  border-left: 1px solid var(--price-border);
  border-radius: 0 10px 10px 0;
  transition: background var(--mi-t-base), border-color var(--mi-t-base);
}

.product-card__article {
  font-size: 10px;
  color: var(--article-color);
  letter-spacing: 0.03em;
}

.product-card__price-row {
  display: flex;
  align-items: baseline;
  gap: 3px;
}

.product-card__price {
  font-size: 21px;
  font-weight: 800;
  color: var(--price-color);
  letter-spacing: -0.5px;
}

.product-card__currency {
  font-size: 13px;
  color: var(--currency-color);
  font-weight: 500;
}

/* Кнопка «В корзину» */
.product-card__buy {
  margin-top: 6px;
  padding: 8px 20px;
  background: linear-gradient(135deg, #16a34a, #15803d);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--mi-t-base) ease;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.2);
  font-family: inherit;
}
.product-card__buy:hover {
  background: linear-gradient(135deg, #15803d, #166534);
  box-shadow: 0 4px 14px rgba(22, 163, 74, 0.3);
  transform: translateY(-1px);
}
.product-card__buy:active { transform: translateY(0); }
.product-card__buy:focus-visible {
  outline: 2px solid #16a34a;
  outline-offset: 2px;
}

/* Кнопка «В корзине» — после добавления */
.product-card__buy--in-cart {
  background: var(--card-bg);
  color: #16a34a;
  border: 1.5px solid #16a34a;
  box-shadow: none;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.product-card__buy--in-cart::before {
  content: '\2713';
  font-weight: 700;
}
.product-card__buy--in-cart:hover {
  background: rgba(22, 163, 74, 0.08);
  box-shadow: none;
  transform: none;
}

/* ═══ ПУСТОЙ КАТАЛОГ ═══ */
.product-card--empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  padding: 30px 16px;
  display: block;
}

/* ═══ RESPONSIVE ═══ */

@media (max-width: 960px) {
  .product-card { grid-template-columns: 100px 1fr 140px; gap: 12px; }
  .product-card__photo { width: 100px; height: 82px; }
}

@media (max-width: 600px) {
  .product-card {
    grid-template-columns: 80px 1fr;
    grid-template-rows: auto auto;
    gap: 10px 12px;
    padding: 12px;
  }
  .product-card__photo {
    width: 80px;
    height: 70px;
    grid-row: 1 / 3;
  }
  .product-card__info { grid-column: 2; }
  .product-card__price-area {
    grid-column: 1 / -1;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border-left: none;
    border-top: 1px solid var(--price-border);
    border-radius: 0 0 10px 10px;
    margin: 0 -12px -12px;
  }
  .product-card__article { display: none; }
  .product-card__buy { margin-top: 0; }
  .product-card__price { font-size: 20px; }
}

@media (max-width: 420px) {
  .list-goods__product { margin-bottom: 6px; }
  .product-card { padding: 10px; gap: 8px 10px; border-radius: 8px; }
  .product-card__photo { width: 70px; height: 60px; border-radius: 6px; }
  .product-card__name { font-size: 14px; }
  .product-card__specs { font-size: 12px; }
  .product-card__price { font-size: 18px; }
  .product-card__buy { padding: 7px 16px; font-size: 12px; }
  .product-card__price-area { margin: 0 -10px -10px; padding: 10px 12px; border-radius: 0 0 8px 8px; }
}

@media (max-width: 240px) {
  .product-card__name { font-size: 13px; }
  .product-card__price { font-size: 16px; }
  .product-card__buy { font-size: 11px; padding: 6px 12px; }
}

/* Отключаем hover на тачскринах */
@media (hover: none) and (pointer: coarse) {
  .product-card:hover {
    border-color: var(--card-border);
    background: var(--card-bg);
    box-shadow: none;
  }
  .product-card:hover .product-card__img { transform: none; }
}

/* Без анимации для пользователей с reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .list-goods__product {
    transition: none;
  }
  .list-goods__product.page__hidden {
    display: none !important;
  }
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation-duration: 0.01s !important;
  }
}
