/* =============================================
   КАРТОЧКА ТОВАРА — product-card
   Оптимизировано: contain-paint, will-change убраны где не нужны,
   картинки адаптируются под контейнер автоматически
============================================= */

/* ── Переменные ── */
:root {
    --pc-primary:    #4CAF50;
    --pc-secondary:  #388E3C;
    --pc-accent:     #8BC34A;
    --pc-dark:       #5D4037;
    --pc-white:      #FFFFFF;
    --pc-text:       #212121;
    --pc-text-light: #757575;
    --pc-border:     #E0E0E0;
    --pc-radius:     10px;
    --pc-shadow-sm:  0 2px 8px rgba(0,0,0,.06);
    --pc-shadow-md:  0 4px 16px rgba(0,0,0,.10);
}

/* ── Карточка ── */
.product-card {
    background: var(--pc-white);
    border: 1px solid rgba(0,0,0,.08);
    border-radius: var(--pc-radius);
    padding: 12px;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    box-sizing: border-box;
    contain: layout style;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
    box-shadow: none;
}
.product-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--pc-shadow-md);
    border-color: var(--pc-accent);
}

/* ── Артикул ── */
.product-header { text-align: right; margin-bottom: 6px; min-height: 16px; }
.product-code   { font-size: 10px; color: var(--pc-text-light); font-weight: 500; letter-spacing: .3px; }

/* ── Иконки ── */
.header-icons {
    display: flex;
    justify-content: space-between;
    gap: 4px;
    margin-bottom: 8px;
}
.header-icons .btn-icon,
.header-icons .icon-btn {
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    background: #f8f8f8;
    border: 1px solid var(--pc-border);
    border-radius: 7px;
    cursor: pointer;
    transition: background .2s, border-color .2s, color .2s;
    padding: 0; color: var(--pc-dark);
    position: relative;
}
.header-icons .btn-icon:hover,
.header-icons .icon-btn:hover {
    background: var(--pc-accent);
    border-color: var(--pc-accent);
    color: var(--pc-white);
}
.icon-badge {
    position: absolute; top: -5px; right: -5px;
    background: var(--pc-primary); color: #fff;
    border-radius: 50%; width: 15px; height: 15px;
    display: flex; align-items: center; justify-content: center;
    font-size: 9px; font-weight: 700; line-height: 1;
}

/* ── Акция ── */
.promo-badge-product-tpl {
    position: absolute; top: 8px; left: 8px; z-index: 2;
    background: linear-gradient(135deg,#FF6B6B,#FF4757);
    color: #fff; font-weight: 700; font-size: 10px;
    padding: 3px 9px; border-radius: 20px;
    box-shadow: 0 2px 6px rgba(255,71,87,.35);
    text-transform: uppercase; letter-spacing: .5px;
    pointer-events: none;
}

/* ── Контейнер изображения ── */
.product-image-container {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 8px;
    background: #fff;
    aspect-ratio: 1 / 1;
    width: 100%;
    contain: strict;
}

/* ── Картинка ── */
.product-image-container .product-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 8%;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity .3s ease, transform .35s ease;
}
.product-image.pc-loaded { opacity: 1; }
.product-image { position: relative; z-index: 1; }

.product-card:hover .product-image-container .product-image { transform: scale(1.04); }

.image-overlay {
    position: absolute; inset: 0;
    background: transparent;
    transition: background .3s;
    border-radius: 8px;
    pointer-events: none;
    z-index: 2;
}
.product-image-container:hover .image-overlay { background: rgba(0,0,0,.06); }

/* ── Быстрый просмотр ── */
.quick-view-btn {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%,-50%) scale(.85);
    opacity: 0;
    background: var(--pc-primary); color: #fff;
    border: none; padding: 10px 18px; border-radius: 20px;
    font-weight: 600; font-size: 13px; cursor: pointer;
    transition: opacity .25s ease, transform .25s ease;
    z-index: 3; white-space: nowrap;
    box-shadow: 0 3px 10px rgba(76,175,80,.4);
}
.product-image-container:hover .quick-view-btn {
    opacity: 1;
    transform: translate(-50%,-50%) scale(1);
}
.quick-view-btn:hover { background: var(--pc-secondary); }

/* ── Рейтинг ── */
.product-rating {
    color: #FFC107; font-size: 12px;
    margin: 4px 0 5px; letter-spacing: 1px;
}

/* ── Название ── */
.product-title-link {
    text-decoration: none; color: inherit;
    flex-grow: 1; display: flex;
    align-items: flex-start; margin-bottom: 8px;
}
.product-title {
    font-size: 15px; font-weight: 600; line-height: 1.4;
    color: var(--pc-text); margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden; text-overflow: ellipsis;
    min-height: 54px;
    transition: color .2s;
}
.product-title-link:hover .product-title { color: var(--pc-secondary); }

/* ── Статус / цена ── */
.product-status-section {
    margin-top: auto;
    display: flex; flex-direction: column;
    gap: 6px; min-height: 84px; justify-content: flex-end;
}
.out-of-stock-label {
    color: #E53935; font-size: 12px; font-weight: 600;
    text-align: center; margin: 0; padding: 4px 0;
}
.shoppost-price {
    width: 100%; display: flex;
    align-items: center; justify-content: center;
}
.price-wrap {
    display: flex; flex-direction: column;
    align-items: center; gap: 2px; width: 100%;
}
.price-current {
    color: var(--pc-text); font-size: 22px;
    font-weight: 700; display: block;
    text-align: center; line-height: 1.2;
}
.price-old {
    text-decoration: line-through;
    color: var(--pc-text-light); font-size: 13px; text-align: center;
}
.price-sale { color: #E53935; }

/* ── Кнопки ── */
.buy-btn {
    width: 100%; padding: 9px 0;
    background: var(--pc-primary); color: #fff;
    border: none; border-radius: 7px;
    font-weight: 700; font-size: 13px;
    cursor: pointer; line-height: 1;
    transition: background .2s, transform .15s;
}
.buy-btn:hover { background: var(--pc-secondary); transform: translateY(-1px); }
.notify-btn {
    width: 100%; padding: 9px 0;
    background: #fff; color: #E65100;
    border: 1px solid #FFCC80; border-radius: 7px;
    font-size: 12px; font-weight: 600; cursor: pointer;
    line-height: 1.2; text-align: center;
    transition: background .2s, border-color .2s;
}
.notify-btn:hover { background: #f5f5f5; border-color: #FFA726; }
.ms2_form { margin: 0; padding: 0; width: 100%; }

/* ── Сетка товаров ── */
.df-products-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

/* =============================================
   ДЕСКТОП ≥1025px — 4 карточки в ряд
============================================= */
@media (min-width: 1025px) {
    .product-card {
        width: calc((100% - 60px) / 4);
        min-width: 220px;
        max-width: 280px;
        text-align: center;
    }
    .product-image-container img { padding: 10%; }
    .header-icons { justify-content: center; gap: 8px; }
    .header-icons .btn-icon,
    .header-icons .icon-btn { width: 32px; height: 32px; }
    .price-current { font-size: 24px; }
}

/* =============================================
   МОБИЛЬ ≤768px — 2 карточки в ряд
============================================= */
@media (max-width: 768px) {
    .df-products-wrapper { gap: 8px !important; }
    .product-card {
        width: calc(50% - 4px) !important;
        min-width: 0 !important;
        flex: 0 0 calc(50% - 4px) !important;
        padding: 8px 7px 7px !important;
        box-sizing: border-box !important;
    }
    .product-title { font-size: 12px !important; min-height: 46px !important; -webkit-line-clamp: 3 !important; }
    .price-current { font-size: 18px !important; }
    .price-old     { font-size: 11px !important; }
    .buy-btn, .notify-btn { padding: 7px 0 !important; font-size: 12px !important; border-radius: 6px !important; }
    .header-icons .btn-icon,
    .header-icons .icon-btn { width: 26px !important; height: 26px !important; }
    .header-icons svg { width: 12px !important; height: 12px !important; }
    .product-rating { font-size: 10px !important; }
    .product-code   { font-size: 9px !important; }
    .quick-view-btn { font-size: 10px !important; padding: 8px 12px !important; border-radius: 14px !important; }
    .promo-badge-product-tpl { font-size: 9px; padding: 2px 7px; top: 6px; left: 6px; }
}