/**
 * Fixed CSS for Product Gallery with Video Support
 * Lebasino 2.4
 */

.woocommerce-product-gallery--custom-swiper {
    position: relative;
    width: 100%;
}

.custom-gallery-wrapper {
    display: flex;
    gap: 20px;
    direction: rtl;
}

/* ========== Thumbnails ========== */
.gallery-thumbs-wrapper {
    width: 80px;
    flex-shrink: 0;
}

.gallery-thumbs {
    height: 350px;
    max-height: 350px;
    direction: rtl;
    overflow: hidden;
}

.gallery-thumbs .swiper-wrapper {
    direction: rtl;
}

.gallery-thumbs .swiper-slide {
    width: 80px !important;
    height: 80px !important;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    border-radius: 16px;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
}

.gallery-thumbs .swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-thumbs .swiper-slide-thumb-active {
    opacity: 1;
    border-color: var(--primary-color, #e31b54);
}

.gallery-thumbs .swiper-slide:hover {
    opacity: 1;
}

/* ========== Video Thumbnail Badge ========== */
.swiper-slide--video {
    position: relative;
}

.thumb-video-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 28px;
    height: 28px;
    background: rgba(15, 23, 42, 0.82);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    pointer-events: none;
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 3;
}

.thumb-video-badge svg {
    margin-right: -2px;
    fill: #ffffff;
}

.swiper-slide--video:hover .thumb-video-badge,
.swiper-slide--video.swiper-slide-thumb-active .thumb-video-badge {
    background: var(--primary-color, #e31b54);
    transform: translate(-50%, -50%) scale(1.15);
    box-shadow: 0 4px 12px rgba(227, 27, 84, 0.45);
}

.thumb-video-placeholder {
    width: 100%;
    height: 100%;
    background: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 18px;
}

/* ========== Main Gallery Slider ========== */
.gallery-main-wrapper {
    flex: 1;
    min-width: 0;
    width: 100%;
}

.gallery-main {
    width: 100% !important;
    height: 350px;
    max-height: 350px;
    border-radius: 16px;
    overflow: hidden;
    direction: rtl;
}

.gallery-main .swiper-wrapper {
    direction: rtl;
    height: 100%;
}

.gallery-main .swiper-slide {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100% !important;
}

.gallery-main .swiper-slide a {
    display: block;
    width: 100%;
    height: 100%;
}

.gallery-main .swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 16px;
    transition: transform 0.3s ease;
}

.gallery-main .swiper-slide a:hover img {
    transform: scale(1.05);
}

/* ========== Main Video Player Container ========== */
.lebasino-video-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000000;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
}

.lebasino-product-video {
    width: 100%;
    height: 100%;
    max-height: 350px;
    object-fit: contain;
    background: #000000;
    border-radius: 16px;
    outline: none;
}

.lebasino-video-iframe {
    width: 100%;
    height: 100%;
    min-height: 350px;
    border: none;
    border-radius: 16px;
    background: #000000;
}

/* ========== Mobile ========== */
@media (max-width: 768px) {
    .custom-gallery-wrapper {
        flex-direction: column;
        gap: 15px;
    }

    .gallery-main-wrapper {
        order: 1;
        width: 100%;
    }

    .gallery-main {
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
        min-height: 300px;
    }
    
    .gallery-main .swiper-slide {
        height: auto !important;
        width: 100% !important;
    }

    .gallery-main .swiper-slide img {
        object-fit: cover;
    }

    .lebasino-product-video,
    .lebasino-video-iframe {
        min-height: 300px;
        max-height: 480px;
    }

    .gallery-thumbs-wrapper {
        order: 2;
        width: 100%;
        height: 80px;
    }

    .gallery-thumbs {
        height: 80px !important;
        width: 100%;
    }

    .gallery-thumbs .swiper-slide {
        width: 80px !important;
        height: 80px !important;
    }
}

/* ========== RTL Fix ========== */
.swiper-rtl .swiper-slide {
    text-align: inherit;
}

.gallery-main .swiper-slide-duplicate {
    width: 100% !important;
}

.swiper-rtl .gallery-thumbs .swiper-slide {
    margin-left: 0 !important;
}

.swiper-rtl.gallery-thumbs.swiper-horizontal > .swiper-wrapper > .swiper-slide {
    margin-left: 0 !important;
}

/* Animation */
.gallery-main .swiper-slide {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-main .swiper-slide-active {
    opacity: 1;
}
