/* =========================================================
   Single Product Styles
========================================================= */

/* =======================================
   КОНТЕЙНЕР
======================================= */
.sp-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    max-width: 1420px;
    width: 100%;
    margin: 0 auto;
    padding: 20px;
    margin-top: 73px;
}

/* =======================================
   ЛЕВАЯ КОЛОНКА - ГАЛЕРЕЯ
======================================= */
.sp-left {
    position: relative;
}

.sp-gallery-wrapper {
    width: 100%;
}

/* Контейнер галереи */
.sp-gallery-container {
    display: flex;
    flex-direction: row;
    gap: 20px;
    align-items: flex-start;
}

/* Миниатюры слева - ВЕРТИКАЛЬНО */
.sp-gallery-thumbs {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 600px;
    overflow-y: auto;
    width: 100px;
    flex-shrink: 0;
}

.sp-gallery-thumb {
    width: 100px;
    height: 100px;
    border: 1px solid #ddd;
    cursor: pointer;
    overflow: hidden;
    background: #f8f8f8;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.sp-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.sp-gallery-thumb:hover {
    border-color: #000;
}

.sp-gallery-thumb.active {
    border-color: #000;
    border-width: 2px;
}

/* Большое фото справа */
.sp-gallery-main {
    flex: 1;
    position: relative;
    background: #f8f8f8;
    min-height: 500px;
}

.sp-gallery-slide {
    display: none;
    width: 100%;
}

.sp-gallery-slide.is-active {
    display: block;
}

.sp-gallery-slide img {
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
}

/* =======================================
   ПРАВАЯ КОЛОНКА - ИНФОРМАЦИЯ
======================================= */
.sp-right {
    position: relative;
    padding: 0 20px;
}

/* Хлебные крошки */
.sp-right .breadcrumbs-container {
    margin-bottom: 20px !important;
}

/* Кнопка избранного */
.sp-fav-btn {
    position: absolute;
    top: 0;
    right: 20px;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    z-index: 10;
}

.sp-fav-btn img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.3s ease;
}

.sp-fav-btn .fav-active {
    opacity: 0;
}

.sp-fav-btn.active .fav-default {
    opacity: 0;
}

.sp-fav-btn.active .fav-active {
    opacity: 1;
}

/* Название товара */
.sp-title {
    font-family: 'Body', 'Roboto', sans-serif;
    font-weight: 400;
    font-size: 24px;
    line-height: 1.2;
    text-transform: uppercase;
    color: #000;
    margin: 0 0 20px 0;
    padding-right: 40px;
}

/* Верхний ряд - оплата долями и цена */
.sp-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #ddd;
}

.sp-pay-badge {
    font-family: 'Body', 'Roboto', sans-serif;
    font-weight: 400;
    font-size: 14px;
    color: #000;
    text-transform: uppercase;
    cursor: pointer;
    transition: color 0.3s ease;
}

.sp-pay-badge:hover {
    color: #666;
}

.sp-price {
    font-family: 'Body', 'Roboto', sans-serif;
    font-weight: 400;
    font-size: 24px;
    color: #000;
}

/* Блоки */
.sp-block {
    margin-bottom: 30px;
}

.sp-block-title {
    font-family: 'Body', 'Roboto', sans-serif;
    font-weight: 400;
    font-size: 16px;
    text-transform: uppercase;
    color: #000;
    margin-bottom: 15px;
}

.sp-block-content {
    /* Контент блоков */
}

/* Блок размеров */
.sp-size-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.sp-size-swatch {
    width: 50px;
    height: 50px;
    border: 1px solid #000;
    background: #fff;
    color: #000;
    font-family: 'Body', 'Roboto', sans-serif;
    font-weight: 400;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
}

.sp-size-swatch:hover {
    background: #f0f0f0;
}

.sp-size-swatch.is-selected {
    background: #000;
    color: #fff;
}

.sp-size-swatch.is-out {
    background: #f8f8f8;
    color: #999;
    border-color: #ddd;
    cursor: not-allowed;
}

.sp-size-swatch.is-out:hover {
    background: #f8f8f8;
}

.sp-size-empty,
.sp-size-single {
    font-family: 'Body', 'Roboto', sans-serif;
    font-size: 14px;
    color: #666;
}

/* Блок действий */
.sp-stock-line {
    font-family: 'Body', 'Roboto', sans-serif;
    font-size: 14px;
    color: #000;
    margin-bottom: 20px;
    min-height: 20px;
}

.sp-actions-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Кнопка добавления в корзину */
.sp-add-to-cart {
    width: 100%;
}

.sp-add-to-cart .quantity {
    display: none !important;
}

.sp-add-to-cart .single_add_to_cart_button {
    width: 100%;
    height: 50px;
    background: #000;
    color: #fff;
    border: none;
    font-family: 'Body', 'Roboto', sans-serif;
    font-weight: 400;
    font-size: 16px;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.3s ease;
}

.sp-add-to-cart .single_add_to_cart_button:hover {
    background: #333;
}

.sp-add-to-cart .single_add_to_cart_button:disabled {
    background: #999;
    cursor: not-allowed;
}

/* Вариативная форма */
.variations_form .variations {
    margin-bottom: 20px;
}

.variations_form .reset_variations {
    display: none !important;
}

/* Вторичная кнопка */
.sp-btn-secondary {
    width: 100%;
    height: 50px;
    background: transparent;
    color: #000;
    border: 1px solid #000;
    font-family: 'Body', 'Roboto', sans-serif;
    font-weight: 400;
    font-size: 16px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sp-btn-secondary:hover {
    background: #000;
    color: #fff;
}

/* Табы информации */
.sp-info-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #ddd;
}

.sp-info-tab {
    flex: 1;
    height: 50px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    font-family: 'Body', 'Roboto', sans-serif;
    font-weight: 400;
    font-size: 14px;
    text-transform: uppercase;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sp-info-tab:hover {
    color: #000;
}

.sp-info-tab.active {
    color: #000;
    border-bottom-color: #000;
}

/* =======================================
   ПРАВАЯ ПАНЕЛЬ ИНФОРМАЦИИ
======================================= */
.sp-info-panel {
    position: fixed;
    top: 0;
    right: -460px;
    width: 460px;
    height: 100vh;
    background: #fff;
    z-index: 1000;
    transition: right 0.3s ease;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
}

.sp-info-panel.active {
    right: 0;
}

.sp-info-panel-inner {
    position: relative;
    height: 100%;
    padding: 60px 30px 30px;
    overflow-y: auto;
}

.sp-info-panel-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
}

.sp-info-panel-section {
    display: none;
}

.sp-info-panel-section.is-active {
    display: block;
}

.sp-info-panel-section p {
    font-family: 'Body', 'Roboto', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #000;
    margin-bottom: 15px;
}

/* =======================================
   МОДАЛКА ОПЛАТЫ ДОЛЯМИ
======================================= */
.sp-pay-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001;
    display: none;
    align-items: center;
    justify-content: center;
}

.sp-pay-modal.active {
    display: flex;
}

.sp-pay-modal-inner {
    position: relative;
    background: #fff;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.sp-pay-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    font-size: 20px;
    cursor: pointer;
}

.sp-pay-modal-title {
    font-family: 'Body', 'Roboto', sans-serif;
    font-weight: 400;
    font-size: 18px;
    text-transform: uppercase;
    color: #000;
    text-align: center;
    margin-bottom: 15px;
}

.sp-pay-modal-subtitle {
    font-family: 'Body', 'Roboto', sans-serif;
    font-size: 14px;
    color: #666;
    text-align: center;
    margin-bottom: 30px;
    line-height: 1.4;
}

.sp-pay-modal-schedule {
    margin-bottom: 30px;
}

.sp-pay-modal-schedule-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    font-family: 'Body', 'Roboto', sans-serif;
    font-size: 14px;
    color: #000;
}

.sp-pay-modal-schedule-row:last-child {
    border-bottom: none;
}

.sp-pay-modal-text {
    margin-bottom: 20px;
}

.sp-pay-modal-text p {
    font-family: 'Body', 'Roboto', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #000;
    margin-bottom: 10px;
}

.sp-pay-modal-note {
    font-family: 'Body', 'Roboto', sans-serif;
    font-size: 12px;
    color: #666;
    text-align: center;
    margin-bottom: 20px;
}

.sp-pay-modal-note a {
    color: #000;
    text-decoration: underline;
}

.sp-pay-modal-btn-close {
    width: 100%;
    height: 50px;
    background: #000;
    color: #fff;
    border: none;
    font-family: 'Body', 'Roboto', sans-serif;
    font-weight: 400;
    font-size: 16px;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.3s ease;
}

.sp-pay-modal-btn-close:hover {
    background: #333;
}

/* =======================================
   РЕКОМЕНДУЕМЫЕ ТОВАРЫ
======================================= */
.sp-bottom-section {
    max-width: 1420px;
    margin: 60px auto 0;
    padding: 0 20px;
}

.sp-bottom-title {
    font-family: 'Body', 'Roboto', sans-serif;
    font-weight: 400;
    font-size: 24px;
    text-transform: uppercase;
    color: #000;
    margin-bottom: 30px;
    text-align: center;
}

.sp-bottom-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.sp-bottom-item {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s ease;
}

.sp-bottom-item:hover {
    transform: translateY(-5px);
}

.sp-bottom-thumb {
    width: 100%;
    height: 300px;
    background: #f8f8f8;
    margin-bottom: 15px;
    overflow: hidden;
}

.sp-bottom-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.sp-bottom-name {
    font-family: 'Body', 'Roboto', sans-serif;
    font-size: 14px;
    color: #000;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.sp-bottom-price {
    font-family: 'Body', 'Roboto', sans-serif;
    font-weight: 400;
    font-size: 16px;
    color: #000;
}

/* =======================================
   ФИЛЬТРЫ ЦВЕТА (цветовой кружок слева)
   Предполагаем разметку с data-color на пункте фильтра
======================================= */

/* Общий вид строки цвета */
.filters-panel [data-color] {
    position: relative;
    padding-left: 35px;
    display: flex;
    align-items: center;
    gap: 9px;
    border: 1px solid #cdcdcd;
    height: 34px;
}

/* Кружок слева */
.filters-panel [data-color]::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 20px;
    border: 1px solid #CDCDCD;
    box-sizing: border-box;
    background: transparent;
    margin-left: 4px;
}

/* Белый */
.filters-panel [data-color="white"]::before,
.filters-panel [data-color="Белый"]::before {
    background: #ffffff;
    border-color: #000000;
}

/* Зелёный */
.filters-panel [data-color="green"]::before,
.filters-panel [data-color="Зеленый"]::before,
.filters-panel [data-color="Зелёный"]::before {
    background: #1E9E47;
    border-color: #1E9E47;
}

/* Красный */
.filters-panel [data-color="red"]::before,
.filters-panel [data-color="Красный"]::before {
    background: #D62828;
    border-color: #D62828;
}

/* Розовый */
.filters-panel [data-color="pink"]::before,
.filters-panel [data-color="Розовый"]::before {
    background: #FF8FB7;
    border-color: #FF8FB7;
}

/* Чёрный */
.filters-panel [data-color="black"]::before,
.filters-panel [data-color="Черный"]::before,
.filters-panel [data-color="Чёрный"]::before {
    background: #000000;
    border-color: #000000;
}

/* Чтобы текст не залезал на кружок */
.filters-panel [data-color] span,
.filters-panel [data-color] label {
    display: inline-block;
    margin-left: 10px;
}

/* =======================================
   АДАПТИВ
======================================= */
@media (max-width: 1200px) {
    .sp-container {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .sp-gallery-container {
        gap: 15px;
    }

    .sp-gallery-thumbs {
        width: 80px;
    }

    .sp-gallery-thumb {
        width: 80px;
        height: 80px;
    }

    .sp-bottom-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {

    /* общий gap — СТАВИМ 0, чтобы не было отступов между товарами */
    .shop-main .element-grid {
        gap: 0 !important;
        row-gap: 0 !important;
        column-gap: 0 !important;
    }

    /* ============================
       1 ФОРМАТ — одна карточка (view="3x4")
       360 × 560
    ============================ */
    .shop-main .element-grid[data-view="3x4"] {
        grid-template-columns: 1fr !important;
    }

    .shop-main .element-grid[data-view="3x4"] .element-card {
        width: 100%;
        max-width: 360px;
        height: 560px;
        margin: 0 auto;
        box-sizing: border-box;
    }

    /* ============================
       2 ФОРМАТ — 2 карточки (view="4x4")
       180 × 280
    ============================ */
    .shop-main .element-grid[data-view="4x4"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .shop-main .element-grid[data-view="4x4"] .element-card {
        height: 280px;
        border: 1px solid var(--Base-Gray_02, #CDCDCD);
        box-sizing: border-box;
    }

    /* ============================
       3 ФОРМАТ — 4 карточки (view="8x7")
       90 × 140
    ============================ */
    .shop-main .element-grid[data-view="8x7"] {
        grid-template-columns: repeat(4, 1fr) !important;
    }

    .shop-main .element-grid[data-view="8x7"] .element-card {
        height: 140px;
        box-sizing: border-box;
    }
}

@media (max-width: 768px) {
    .sp-container {
        grid-template-columns: 1fr;
        /* одна колонка */
        gap: 20px;
        max-width: 100%;
        width: 100%;
        margin: 60px 0 0;
        padding: 15px;
    }

    .sp-left {
        order: 1;
    }

    .sp-right {
        order: 2;
        padding: 0;
        /* убираем лишний внутренний отступ */
    }

    .sp-gallery-container {
        flex-direction: column;
        gap: 10px;
    }

    .sp-gallery-thumbs {
        flex-direction: row;
        width: 100%;
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 8px;
    }

    .sp-gallery-thumb {
        width: 60px;
        height: 60px;
        flex-shrink: 0;
    }

    .sp-gallery-main {
        min-height: 300px;
    }

    .sp-title {
        font-size: 20px;
    }

    .sp-price {
        font-size: 20px;
    }

    .sp-info-panel {
        width: 100%;
        right: -100%;
    }

    .sp-pay-modal-inner {
        padding: 30px 20px;
    }

    .sp-bottom-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* Убираем ВСЕ margin/padding у контейнеров WooCommerce */
    .shop-main .element-grid,
    .shop-main ul.products,
    .shop-main ul.products li.product,
    .shop-main .element-card,
    .shop-main .wc-block-grid__product,
    .shop-main .product {
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Убираем авто-gap, если тема где-то его подвешивает */
    .shop-main ul.products {
        row-gap: 0 !important;
        column-gap: 0 !important;
        gap: 0 !important;
    }

    /* Сами карточки остаются фиксированных размеров — как ты указал */
    .shop-main .element-grid[data-view="3x4"] .element-card {
        width: 100%;
        max-width: 400px;
        height: 560px;
        box-sizing: border-box;
    }

    .shop-main .element-grid[data-view="4x4"] .element-card {
        height: 280px;
        border: 1px solid var(--Base-Gray_02, #CDCDCD);
        box-sizing: border-box;
    }

    .shop-main .element-grid[data-view="8x7"] .element-card {
        height: 140px;
        box-sizing: border-box;
    }

    /* ====== МОБИЛЬНЫЙ ФИЛЬТР: FOOTER ВСЕГДА СНИЗУ ====== */

    /* Сам панельный контейнер (если он фиксированный на экране) */
    .filters-panel {
        display: flex;
        flex-direction: column;
        max-height: 100vh;
    }

    /* Прокручиваемая часть фильтров */
    .filters-panel__body {
        flex: 1 1 auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Подвал фильтра — прилипает к низу */
    .filters-panel__footer {
        position: sticky;
        bottom: 0;
        left: 0;
        right: 0;
        flex-shrink: 0;
        background: #ffffff;
        z-index: 5;
    }
}

@media (max-width: 480px) {
    .sp-size-swatch {
        width: 40px;
        height: 40px;
        font-size: 12px;
    }

    .sp-actions-buttons {
        gap: 10px;
    }

    .sp-add-to-cart .single_add_to_cart_button,
    .sp-btn-secondary {
        height: 45px;
        font-size: 14px;
    }

    .sp-info-tab {
        font-size: 12px;
        height: 45px;
    }
}

/* Overlay для модалок */
.sp-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

.sp-overlay.active {
    display: block;
}