/**
 * Sanang Custom Product Gallery Styles
 */

.sanang-product-gallery {
    margin-bottom: 30px;
    width: 500px;
    max-width: 500px;
}

/* Main Gallery */
.gallery-main {
    margin-bottom: 15px;
    width: 500px;
    position: relative;
}

.gallery-main-swiper {
    width: 500px;
    height: 500px;
    border: 1px solid #F6F6F6;
    border-top-left-radius: 10px;
    overflow: hidden;
    background: #fff;
}

.gallery-main-swiper .swiper-slide {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #fff;
}

.gallery-main-swiper img,
.gallery-main-swiper video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    cursor: pointer;
    display: block;
    transition: transform 0.2s ease;
}

.gallery-main-swiper img:hover,
.gallery-main-swiper video:hover {
    transform: scale(1.02);
}

/* Main Gallery Navigation Arrows */
.gallery-main-navigation {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 10;
}

/* Hide arrows on desktop screens (992px and above) */
@media (min-width: 992px) {
    .gallery-main-navigation {
        display: none !important;
    }
}

.gallery-main-prev,
.gallery-main-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: transparent !important;
    background-color: transparent !important;
    border: 0 !important;
    border-width: 0 !important;
    border-style: none !important;
    box-shadow: none !important;
    outline: none !important;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
    transition: opacity 0.3s ease;
    z-index: 11;
    padding: 0 !important;
    margin: 0 !important;
}

.gallery-main-prev {
    left: 8px;
}

.gallery-main-next {
    right: 8px;
}

.gallery-main-prev img,
.gallery-main-next img {
    width: 30px;
    height: 30px;
    display: block;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.gallery-main-prev:hover,
.gallery-main-next:hover,
.gallery-main-prev:focus,
.gallery-main-next:focus,
.gallery-main-prev:active,
.gallery-main-next:active {
    background: transparent !important;
    background-color: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    outline: none !important;
}

.gallery-main-prev:hover img,
.gallery-main-next:hover img {
    opacity: 1;
}

/* Disabled state for navigation arrows */
.gallery-main-prev.disabled,
.gallery-main-next.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.gallery-main-prev.disabled img,
.gallery-main-next.disabled img {
    opacity: 0.5;
}

/* Thumbnails */
.gallery-thumbs {
    width: 500px;
    position: relative;
}

.gallery-thumbs-navigation {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 500px;
    padding: 5px 0;
}

.gallery-thumbs-swiper {
    flex: 1;
    height: 80px;
    overflow: hidden;
    width: 100%;
    padding: 2px 3px 2px 0;
}

.gallery-thumbs-prev,
.gallery-thumbs-next {
    flex-shrink: 0;
    width: 30px;
    height: 80px;
    border: none;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 40px !important;
    border: 0px !important;
    background: #123282 !important;
    color: #fff !important;
    transition: all 0.2s ease;
    z-index: 10;
    font-weight: 300;
    line-height: 1;
}

.gallery-thumbs-prev.swiper-button-disabled,
.gallery-thumbs-next.swiper-button-disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.gallery-thumbs-prev.swiper-button-disabled:hover,
.gallery-thumbs-next.swiper-button-disabled:hover {
    color: #fff;
    transform: none;
    box-shadow: none;
}

.gallery-thumbs-swiper .swiper-slide {
    cursor: pointer;
    opacity: 0.7;
    transition: all 0.3s ease;
    border: 2px solid #F6F6F6;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    width: 76px !important;
    height: 76px !important;
    flex-shrink: 0;
    margin: 2px 6px 2px 0;
    box-sizing: border-box;
    background: #fff;
}

.gallery-thumbs-swiper .swiper-slide:hover,
.gallery-thumbs-swiper .swiper-slide-thumb-active {
    opacity: 1;
    border-color: #123282;
}

.gallery-thumbs-swiper img {
    width: 76px;
    height: 76px;
    object-fit: cover;
    display: block;
}

/* Video thumbnail styling */
.thumb-video {
    position: relative;
    width: 76px;
    height: 76px;
    display: block;
    border-radius: 2px;
    overflow: hidden;
}

.thumb-video img {
    width: 76px;
    height: 76px;
    object-fit: cover;
    display: block;
}

/* Video play button - simple and clean */
.thumb-video .play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    pointer-events: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    z-index: 2;
    line-height: 1;
    padding-left: 2px; /* Slight offset to center triangle visually */
}

/* Product Lightbox Styles - Matching Review Popup Design */
.sanang-product-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
}

.sanang-product-lightbox.active {
    display: block;
}

/* Lightbox elements */
.sanang-product-lightbox * {
    box-sizing: border-box;
}

/* Main overlay - full screen dark background */
.sanang-product-lightbox .product-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.75);
    z-index: 1000000;
}

/* Content container that holds everything we DON'T want to close when clicked */
.sanang-product-lightbox .product-lightbox-content {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000001;
    pointer-events: none; /* Transparent to clicks by default */
}

/* Navigation areas */
.sanang-product-lightbox .product-nav-area {
    position: fixed;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 15%;
    top: 0;
    z-index: 1000002;
    cursor: pointer;
    pointer-events: auto; /* Capture clicks on navigation */
}

.sanang-product-lightbox .product-prev-area {
    left: 0;
}

.sanang-product-lightbox .product-next-area {
    right: 0;
}

.sanang-product-lightbox .product-prev-btn, 
.sanang-product-lightbox .product-next-btn {
    color: white;
    font-size: 60px;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.sanang-product-lightbox .product-prev-area:hover .product-prev-btn,
.sanang-product-lightbox .product-next-area:hover .product-next-btn {
    opacity: 1;
}

.sanang-product-lightbox .product-prev-area.disabled, 
.sanang-product-lightbox .product-next-area.disabled {
    cursor: default;
}

.sanang-product-lightbox .product-prev-area.disabled .product-prev-btn,
.sanang-product-lightbox .product-next-area.disabled .product-next-btn {
    opacity: 0.3;
}

.sanang-product-lightbox .product-prev-area.disabled:hover .product-prev-btn,
.sanang-product-lightbox .product-next-area.disabled:hover .product-next-btn {
    opacity: 0.3;
}

/* Content area */
.sanang-product-lightbox .product-content-area {
    position: fixed;
    left: 15%;
    right: 15%;
    top: 0;
    height: 100%;
    z-index: 1000002;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sanang-product-lightbox .product-slide-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sanang-product-lightbox .product-content-wrapper {
    max-width: 90%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-lightbox-media {
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-lightbox-media img,
.product-lightbox-media video {
    max-width: 100%;
    max-height: 80vh;
    display: block;
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Close button - Matching customer review popup design exactly */
.sanang-product-lightbox .product-lightbox-close {
    position: fixed;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 30px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s;
    z-index: 1000005;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: rgba(0,0,0,0.5);
    pointer-events: auto;
}

.sanang-product-lightbox .product-lightbox-close:hover {
    opacity: 1;
}

/* Counter */
.sanang-product-lightbox .product-lightbox-counter {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 1000003;
    pointer-events: none;
}

/* Prevent body scroll when product lightbox is open */
body.product-lightbox-open {
    overflow: hidden;
}

/* Hide thumbnails on smaller screens and set up responsive layout */
@media (max-width: 991px) {
    .gallery-thumbs {
        display: none !important;
    }
    
    .gallery-main {
        margin-bottom: 0px;
    }
    
    /* 50/50 layout for gallery and product info */
    .product-media-info {
        display: flex !important;
        align-items: flex-start;
        gap: 20px;
    }
    
    .sanang-product-gallery {
        width: 50% !important;
        max-width: 50% !important;
        flex: 0 0 50%;
    }
    
    .gallery-main {
        width: 100%;
    }
    
    .gallery-main-swiper {
        width: 100%;
        height: 0;
        padding-bottom: 100%; /* Creates square aspect ratio */
        position: relative;
    }
    
    .gallery-main-swiper .swiper-wrapper {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }
    
    .gallery-main-swiper .swiper-slide {
        align-items: flex-start !important; /* Top align images */
        justify-content: center;
    }
    
    /* Ensure navigation arrows are positioned correctly within square container */
    .gallery-main-navigation {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 10;
    }
    
    .summary.entry-summary {
        width: 50% !important;
        flex: 0 0 50%;
    }
}

/* Mobile layout - stack vertically */
@media (max-width: 767px) {
    .product-media-info {
        display: block !important;
        flex-direction: column !important;
    }
    
    .sanang-product-gallery {
        width: 100% !important;
        max-width: 100% !important;
        flex: none !important;
        margin-bottom: 20px;
    }
    
    .gallery-main {
        width: 100%;
    }
    
    .gallery-main-swiper {
        width: 100%;
        height: 0;
        padding-bottom: 100%; /* Creates square aspect ratio */
        position: relative;
    }
    
    .gallery-main-swiper .swiper-wrapper {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }
    
    .gallery-main-swiper .swiper-slide {
        align-items: flex-start !important; /* Top align images */
        justify-content: center;
    }
    
    .summary.entry-summary {
        width: 100% !important;
        flex: none !important;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .gallery-main-swiper {
        height: 300px;
    }
    
    .gallery-thumbs-swiper {
        height: 60px;
        padding: 2px 0;
    }
    
    .gallery-thumbs-prev,
    .gallery-thumbs-next {
        width: 25px;
        height: 60px;
        font-size: 18px;
        border-radius: 4px;
    }
    
    .gallery-thumbs-swiper .swiper-slide {
        border-width: 1px;
        width: 60px !important;
        height: 60px !important;
        margin: 2px 3px 2px 0;
    }
    
    .gallery-thumbs-swiper img,
    .thumb-video img {
        width: 60px;
        height: 60px;
    }
    
    .thumb-video {
        width: 60px;
        height: 60px;
    }
    
    .thumb-video .play-icon {
        width: 18px;
        height: 18px;
        font-size: 9px;
        padding-left: 1px;
    }
    
    .thumb-video .play-icon {
        width: 20px;
        height: 20px;
        font-size: 10px;
        padding-left: 1px;
    }
    
    .sanang-product-lightbox .product-nav-area {
        width: 20%;
    }
    
    .sanang-product-lightbox .product-content-area {
        left: 20%;
        right: 20%;
    }
    
    .sanang-product-lightbox .product-prev-btn, 
    .sanang-product-lightbox .product-next-btn {
        font-size: 40px;
    }
    
    .sanang-product-lightbox .product-lightbox-close {
        top: 15px;
        right: 15px;
        width: 35px;
        height: 35px;
        font-size: 25px;
    }
    
    .sanang-product-lightbox .product-lightbox-counter {
        bottom: 20px;
        font-size: 12px;
        padding: 6px 12px;
    }
}

@media (max-width: 480px) {
    .gallery-main-swiper {
        height: 250px;
    }
    
    .gallery-thumbs-swiper {
        height: 50px;
        padding: 2px 0;
    }
    
    .gallery-thumbs-swiper .swiper-slide {
        width: 50px !important;
        height: 50px !important;
        margin: 2px 2px 2px 0;
    }
    
    .gallery-thumbs-swiper img,
    .thumb-video img {
        width: 50px;
        height: 50px;
    }
    
    .gallery-thumbs-prev,
    .gallery-thumbs-next {
        width: 20px;
        height: 50px;
        font-size: 16px;
        border-radius: 3px;
    }
    
    .thumb-video {
        width: 50px;
        height: 50px;
    }
    
    .thumb-video .play-icon {
        width: 16px;
        height: 16px;
        font-size: 8px;
        padding-left: 1px;
    }
}

/* Animation for smooth transitions */
.gallery-main-swiper .swiper-slide {
    transition: transform 0.3s ease;
}

.gallery-thumbs-swiper .swiper-slide {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Variation active state */
.gallery-thumbs-swiper .swiper-slide.variation-active {
    border-color: #FFB930 !important;
    box-shadow: 0 0 0 2px rgba(255, 185, 48, 0.3);
}

/* Loading state */
.sanang-product-gallery.loading .gallery-main-swiper {
    background: #f0f0f0;
    position: relative;
}

.sanang-product-gallery.loading .gallery-main-swiper::after {
    content: 'Loading...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #666;
    font-size: 16px;
}
