/**
 * Стили для кастомного слайдера галереи товаров
 */

/* Основной контейнер галереи */
.custom-gallery {
    position: relative;
    width: 100%;
    max-width: 600px;
}

/* Скрыть старую галерею, если она осталась на странице */
.product-gallery-column > :not(.custom-gallery) {
    display: none !important;
}

/* Блок с большим изображением: фиксированная высота области + contain —
   вертикальные фото заполняют высоту, горизонтальные — ширину */

.gallery-main {
    position: relative;
    width: 100%;
    height: min(520px, 62vh);
    min-height: 280px;
    overflow: hidden;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
}

.gallery-main img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: opacity 0.3s ease;
}

/* Стрелки навигации */
.gallery-arrows {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 10px;
    pointer-events: none;
    z-index: 10;
}

.gallery-arrow {
    pointer-events: all;
    background: transparent;
    border: none;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
    font-size: 42px;
    line-height: 1;
    color: #D4AF37; /* fallback золотой цвет */
    box-shadow: none;
}

.gallery-arrow:hover:not(:disabled) {
    transform: scale(1.12);
    opacity: 0.9;
}

.gallery-arrow:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.gallery-arrow span {
    line-height: 1;
}

/* Миниатюры */
.gallery-thumbs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 10px 0;
    scroll-behavior: smooth;
}

.gallery-thumb {
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    border: 3px solid transparent;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.6;
}

.gallery-thumb:hover {
    opacity: 0.8;
    transform: translateY(-2px);
}

.gallery-thumb.active {
    opacity: 1;
    border-color: #007bff;
    box-shadow: 0 0 10px rgba(0, 123, 255, 0.5);
}

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

/* Адаптивность (тот же брейкпоинт, что и бургер-меню) */
@media (max-width: 991px) {
    .gallery-main {
        height: min(400px, 52vh);
        min-height: 240px;
    }

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

    .gallery-arrow {
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .gallery-main {
        height: min(320px, 48vh);
        min-height: 200px;
    }

    .gallery-thumb {
        width: 60px;
        height: 60px;
    }
}

/* Страница товара: до 1275px — колонка (как на сайте), галерея сверху по центру, блок описания/цены ниже, по центру */
@media screen and (max-width: 1275px) {
    .single-product-wrapper.radonega_kartochka_otstup .single-product-row {
        flex-direction: column !important;
        flex-wrap: nowrap !important;
    }

    .single-product-wrapper.radonega_kartochka_otstup .single-product-row > .product-column {
        flex: 1 1 auto !important;
        max-width: 100% !important;
    }

    .single-product-wrapper.radonega_kartochka_otstup .single-product-row .product-column {
        flex-direction: column !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
    }

    .single-product-wrapper.radonega_kartochka_otstup .single-product-row .product-column > .product-gallery-column {
        flex: 0 0 auto !important;
        max-width: 100% !important;
        width: 100%;
        padding-right: 0 !important;
        padding-left: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        order: 1;
    }

    .single-product-wrapper.radonega_kartochka_otstup .single-product-row .product-column > .product-info {
        flex: 0 0 auto !important;
        max-width: 100% !important;
        width: 100%;
        order: 2;
        padding-top: 1rem !important;
        padding-left: 12px !important;
        padding-right: 12px !important;
        box-sizing: border-box !important;
    }

    .single-product-wrapper.radonega_kartochka_otstup .product-gallery-column .custom-gallery {
        margin-left: auto !important;
        margin-right: auto !important;
        width: 100% !important;
        max-width: min(600px, 100%) !important;
    }

    .single-product-wrapper.radonega_kartochka_otstup .product-info .summary.entry-summary,
    .single-product-wrapper.radonega_kartochka_otstup .product-info .product_meta.product-meta {
        text-align: center !important;
    }

    .single-product-wrapper.radonega_kartochka_otstup .product-info .woocommerce-product-rating {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
    }

    .single-product-wrapper.radonega_kartochka_otstup .product-info .product-review {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 6px;
    }

    .single-product-wrapper.radonega_kartochka_otstup .product-info .star-rating {
        margin-left: auto !important;
        margin-right: auto !important;
    }

    .single-product-wrapper.radonega_kartochka_otstup .product-info .summary.entry-summary ul {
        display: inline-block !important;
        text-align: left !important;
        margin-left: auto !important;
        margin-right: auto !important;
        padding-left: 1.25em !important;
        box-sizing: border-box !important;
        max-width: min(100%, 32em) !important;
    }

    .single-product-wrapper.radonega_kartochka_otstup .product-info p.price,
    .single-product-wrapper.radonega_kartochka_otstup .product-info p.stock.in-stock,
    .single-product-wrapper.radonega_kartochka_otstup .product-info .woocommerce-product-details__short-description {
        text-align: center !important;
    }

    .single-product-wrapper.radonega_kartochka_otstup .product-info a.share-product {
        display: inline-block !important;
    }

    .single-product-wrapper.radonega_kartochka_otstup .product-info #add-to-cart-message {
        text-align: center !important;
    }

    .single-product-wrapper.radonega_kartochka_otstup .product-info form#add-to-cart-form.cart,
    .single-product-wrapper.radonega_kartochka_otstup .product-info form#add-to-cart-form.cart p {
        text-align: center !important;
    }

    .single-product-wrapper.radonega_kartochka_otstup .product-info form#add-to-cart-form label[for="product-quantity"] {
        display: block !important;
    }

    .single-product-wrapper.radonega_kartochka_otstup .product-info form#add-to-cart-form input#product-quantity {
        margin-left: auto !important;
        margin-right: auto !important;
    }

    .single-product-wrapper.radonega_kartochka_otstup .product-info form#add-to-cart-form button[type="submit"] {
        display: inline-block !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    .single-product-wrapper.radonega_kartochka_otstup .gallery-thumbs {
        justify-content: center !important;
        flex-wrap: wrap !important;
    }
}
