/* Обертка модуля для исключения переполнения */
.sj-products-wrap {
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

/* Общая сетка из 5 колонок */
.sj-products-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin: 0;
    padding: 15px 5px 30px 5px; /* Отступы для корректного отображения теней и ховера */
    box-sizing: border-box;
    max-width: 100%;
}

/* Карточка товара */
.sj-product-item {
    position: relative;
    background: #fff;
    padding: 15px;
    text-align: center;
    border-radius: 4px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    border: 1px solid transparent;
}

/* Эффект приподнимания */
.sj-product-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
    border-color: #f5f5f5;
}

/* Обертка изображения */
.sj-item-image-wrap {
    position: relative;
    overflow: hidden;
    margin-bottom: 15px;
    padding-bottom: 20px; /* Место под кнопку */
}

.sj-item-image-link {
    display: block;
}
.sj-products-grid .sj-item-image-link {
    height: auto !important;
}
.sj-item-image-link img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* Ярлык SALE */
.sj-item-label {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2;
}

.sj-item-label span {
    background: #e77673;
    color: #fff;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

/* Кнопка Wishlist */
.sj-products-wrap .btn-wishlist-custom {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #999;
    transition: all 0.2s ease;
    padding: 0;
    outline: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.sj-products-wrap .btn-wishlist-custom:hover {
    border-color: #bbb;
    color: #666;
    transform: scale(1.05);
}

.sj-products-wrap .btn-wishlist-custom.active svg {
    fill: #e74c3c;
    stroke: #e74c3c;
}

.sj-products-wrap .btn-wishlist-custom.is-loading {
    pointer-events: none;
    opacity: 0.6;
}

/* Кнопка Quick View (Быстрый просмотр) - Всегда видна */
.sj-products-wrap .btn-quickview-custom {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #999;
    transition: all 0.2s ease;
    padding: 0;
    outline: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.sj-products-wrap .btn-quickview-custom:hover {
    border-color: #bbb;
    color: #2b303b;
    transform: scale(1.05);
}

/* Модальное окно Quick View */
.sj-quickview-modal-body {
    padding: 30px;
}

/* Уведомление Wishlist (Toast) */
.sj-products-wrap .wishlist-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #2b303b;
    color: #fff;
    padding: 15px 20px;
    border-radius: 4px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 9999;
    transform: translateY(100px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    font-size: 15px;
}

.sj-products-wrap .wishlist-toast.show {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.sj-products-wrap .wishlist-toast a {
    color: #E97C11;
    text-decoration: underline;
    font-weight: bold;
    margin-left: 5px;
    transition: 0.2s;
}

.sj-products-wrap .wishlist-toast a:hover {
    color: #fff;
    text-decoration: none;
}

.sj-products-wrap .wishlist-toast-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    opacity: 0.7;
    transition: 0.2s;
}

.sj-products-wrap .wishlist-toast-close:hover {
    opacity: 1;
}

/* Контейнер кнопки Add to Cart */
.sj-item-hover-btn {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    opacity: 0;
    transform: translateY(15px);
    transition: all 0.3s ease;
    z-index: 3;
}

.sj-product-item:hover .sj-item-hover-btn {
    opacity: 1;
    transform: translateY(0);
}

/* Сама кнопка Add to Cart / Read more */
.sj-btn-action {
    display: block;
    width: 100%;
    background: #ec7200;
    color: #fff !important;
    text-align: center;
    padding: 10px 0;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    text-decoration: none;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(236, 114, 0, 0.4);
    transition: background 0.2s ease;
}

.sj-btn-action:hover {
    background: #d66700;
    text-decoration: none;
}

/* Информационный блок */
.sj-item-info {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.sj-item-desc-short {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.sj-item-title {
    margin-bottom: 12px;
}

.sj-item-title a {
    font-size: 14px;
    color: #333;
    font-weight: 600;
    text-decoration: none;
    line-height: 1.4;
    transition: color 0.2s ease;
}

.sj-item-title a:hover {
    color: #ec7200;
}

/* Рейтинг и Отзывы */
.sj-item-rating-reviews {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
}

.sj-rating-wrap {
    display: inline-flex;
    align-items: center;
}

.sj-rating-stars {
    position: relative;
    display: inline-block;
    width: 80px; /* 5 звезд по 16px */
    height: 16px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="%23d3d3d3"><path d="M10 15l-5.878 3.09 1.122-6.545L.488 6.91l6.564-.955L10 0l2.948 5.955 6.564.955-4.756 4.635 1.122 6.545z"/></svg>') repeat-x;
    background-size: 16px 16px;
}

.sj-rating-stars-active {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="%23ec7200"><path d="M10 15l-5.878 3.09 1.122-6.545L.488 6.91l6.564-.955L10 0l2.948 5.955 6.564.955-4.756 4.635 1.122 6.545z"/></svg>') repeat-x;
    background-size: 16px 16px;
}

.sj-reviews-count {
    font-size: 13px;
    color: #888;
    line-height: 1;
    margin-top: 1px;
}

/* Цена */
.sj-item-price {
    font-size: 17px;
    font-weight: 700;
    color: #333;
    margin-top: auto;
}

/* Адаптивность */
@media (max-width: 1200px) {
    .sj-products-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 992px) {
    /* Планшеты и Мобильные: Свайп в один ряд (по 2 колонки) */
    .sj-products-wrap {
        overflow: visible; /* Отключаем обрезку для корректной работы скролла */
    }
    .sj-products-grid {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 25px; /* Место для скроллбара и эффекта hover */
        gap: 15px;
        scroll-behavior: smooth;
    }
    .sj-product-item {
        flex: 0 0 calc(50% - 7.5px); /* Строго 2 колонки на экране */
        max-width: calc(50% - 7.5px);
        scroll-snap-align: start;
    }
    /* Стилизация полосы прокрутки свайпера */
    .sj-products-grid::-webkit-scrollbar {
        height: 5px;
    }
    .sj-products-grid::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 5px;
    }
    .sj-products-grid::-webkit-scrollbar-thumb {
        background: #ccc;
        border-radius: 5px;
    }
    .sj-products-grid::-webkit-scrollbar-thumb:hover {
        background: #ec7200;
    }
    .sj-quickview-modal-body { padding: 15px; } /* Уменьшенный отступ для мобильных устройств */
}