/* ==========================================================================
   PRODUCT GALLERY - SLIDER DESIGN v2.0
   ========================================================================== */


.product-gallery-wrapper {
    position: relative;
}


.product-main-slider {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #f5f5f5;
}


.gallery-main-image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1/1;
    overflow: hidden;
}


.gallery-main-image-container.loading {
    position: relative;
}

.gallery-main-image-container.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.05);
    z-index: 2;
    pointer-events: none;
    animation: fadeInOverlay 300ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.gallery-main-image-container.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 32px;
    height: 32px;
    margin: -16px 0 0 -16px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
    z-index: 3;
    pointer-events: none;
    transform: translate3d(-50%, -50%, 0);
    will-change: transform;
}

@keyframes spin {
    to {
        rotate: 360deg;
    }
}

@keyframes fadeInOverlay {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.gallery-main-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    transition: opacity 450ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
        transform 450ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform: translate3d(0, 0, 0);
    will-change: opacity, transform;
}


.gallery-main-image.fade-out {
    opacity: 0;
    transform: translate3d(0, 0, 0) scale(1.02);
    z-index: 1;
}

.gallery-main-image.fade-in {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    z-index: 2;
}


.zoom-image {
    cursor: zoom-in;
    transition: transform 450ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform: translate3d(0, 0, 0);
    will-change: transform;
}

.zoom-image:hover:not(.zoomed) {
    transform: translate3d(0, 0, 0) scale(1.03);
}

.zoom-image.zoomed {
    transform: translate3d(0, 0, 0) scale(2.2);
    cursor: zoom-out;
    z-index: 1000;
    position: relative;
    transition: transform 150ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}


.gallery-bookmark-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    background: white;
    color: #666;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
    z-index: 15;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.gallery-bookmark-btn:hover {
    background: #f9fafb;
    color: #8b5cf6;
    border-color: #8b5cf6;
    transform: scale(1.05);
}

.gallery-bookmark-btn.active {
    background: #8b5cf6;
    color: white;
    border-color: #8b5cf6;
}

.gallery-bookmark-btn.active svg {
    fill: var(--primary-background);
}


.gallery-fullscreen-btn {
    position: absolute;
    bottom: 16px;
    right: 16px;
    background: var(--primary-background-hover);
    color: white;
    padding: 10px;
    border-radius: 8px;
    opacity: 0;
    transition: all 300ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
    border: none;
    z-index: 10;
    transform: translate3d(0, 0, 0);
    will-change: opacity, transform;
}

.gallery-fullscreen-btn.fade-out {
    opacity: 0;
    transform: translate3d(0, 0, 0) scale(0.95);
    z-index: 1;
}

.gallery-fullscreen-btn.fade-in {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    z-index: 11;
}

.product-main-slider:hover .gallery-fullscreen-btn,
.gallery-main-image-container:hover .gallery-fullscreen-btn {
    opacity: 1;
}

.gallery-fullscreen-btn:hover {
    background: var(--primary-background);
    transform: scale(1.08);
}



.gallery-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.9);
    color: #7d1d60;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    opacity: 1;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-prev-btn {
    left: 16px;
}

.gallery-next-btn {
    right: 16px;
}

.gallery-nav-btn:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.gallery-nav-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.gallery-nav-btn:disabled {
    opacity: 0.4 !important;
    cursor: not-allowed;
}


.gallery-thumbnails-wrapper {
    position: relative;
    margin-top: 12px;
    padding: 0 4px;
}

.gallery-thumbnails-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 4px 0;
}

.gallery-thumbnails-scroll::-webkit-scrollbar {
    display: none;
}


.gallery-thumb {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.7;
    transition: all 0.25s ease;
    position: relative;
    border: 2px solid transparent;
    background: #f5f5f5;
}

.gallery-thumb:hover {
    opacity: 1;
    transform: scale(1.05);
}

.gallery-thumb.active {
    opacity: 1;
    border-color: #7d1d60;
}

.gallery-thumb img,
.gallery-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.gallery-thumb.video-thumb::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1;
    pointer-events: none;
    border-radius: 6px;
}


.thumb-scroll-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: white;
    border: 1px solid #e5e7eb;
    color: #374151;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.gallery-thumbnails-wrapper:hover .thumb-scroll-btn {
    opacity: 1;
}

.thumb-scroll-left {
    left: -16px;
}

.thumb-scroll-right {
    right: -16px;
}

.thumb-scroll-btn:hover {
    background: #f9fafb;
    transform: translateY(-50%) scale(1.1);
}

.thumb-scroll-btn:disabled {
    opacity: 0 !important;
}

/* ==========================================================================
   LIGHTBOX MODAL - Optional Fullscreen View
   ========================================================================== */

.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-lightbox.active {
    display: flex;
    opacity: 1;
}

.lightbox-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
}

.lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}


.lightbox-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    padding: 0.75rem;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg) scale(1.1);
}


.lightbox-media-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-loading {
    position: absolute;
    color: white;
    z-index: 1;
}

.lightbox-image,
.lightbox-video {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    display: none;
    border-radius: 0.5rem;
}

.lightbox-image.active,
.lightbox-video.active {
    display: block;
}

.lightbox-image {
    cursor: grab;
    transition: transform 0.3s ease;
}

.lightbox-image.dragging {
    cursor: grabbing;
}


.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    color: #1f2937;
    padding: 1rem;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.lightbox-prev {
    left: 2rem;
}

.lightbox-next {
    right: 2rem;
}

.lightbox-nav:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
}

.lightbox-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}


.lightbox-counter {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 2rem;
    font-size: 1rem;
    font-weight: 600;
    z-index: 10;
}


.lightbox-zoom-controls {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.zoom-btn {
    background: rgba(255, 255, 255, 0.9);
    color: #1f2937;
    padding: 0.75rem;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zoom-btn:hover {
    background: white;
    transform: scale(1.1);
}

.zoom-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ==========================================================================
   MOBILE RESPONSIVE
   ========================================================================== */

@media (max-width: 768px) {


    .product-main-slider {
        border-radius: 8px;
    }

    .gallery-nav-btn {
        width: 40px;
        height: 40px;
        padding: 0.5rem;
    }

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

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

    .gallery-bookmark-btn {
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
    }

    .gallery-fullscreen-btn {
        bottom: 12px;
        right: 12px;
        padding: 8px;
        opacity: 1;
    }


    .gallery-thumb {
        width: 56px;
        height: 56px;
        border-radius: 6px;
    }

    .gallery-thumbnails-scroll {
        gap: 8px;
    }


    .lightbox-nav {
        padding: 0.75rem;
    }

    .lightbox-prev {
        left: 1rem;
    }

    .lightbox-next {
        right: 1rem;
    }

    .lightbox-close {
        top: 1rem;
        right: 1rem;
    }

    .lightbox-counter {
        bottom: 1rem;
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }

    .lightbox-zoom-controls {
        bottom: 1rem;
        right: 1rem;
    }

    .zoom-btn {
        width: 36px;
        height: 36px;
        padding: 0.5rem;
    }


    .zoom-image.zoomed {
        transform: scale(1.8);
    }
}



@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate3d(0, 0, 0) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: translate3d(0, 0, 0) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

.gallery-lightbox.active .lightbox-media-container {
    animation: fadeInScale 450ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ==========================================================================
   LIGHTBOX OPEN STATE - HIDE INTERFERING ELEMENTS
   ========================================================================== */

body.lightbox-open .mobile-sticky-bottom-bar,
body.lightbox-open .mobile-variation-modal,
body.lightbox-open .back-to-top,
body.lightbox-open .variation-selector-modal,
body.lightbox-open .offline-warning,
body.lightbox-open .page-transition,
body.lightbox-open .add-to-cart-modal,
body.lightbox-open header,
body.lightbox-open .header-wrapper,
body.lightbox-open .site-header,
body.lightbox-open .top-bar,
body.lightbox-open .discount-badge,
body.lightbox-open .discount-badge-small,
body.lightbox-open .single_add_to_cart_button,
body.lightbox-open .modal-discount-badge,
body.lightbox-open .variations_form,
body.lightbox-open .product-variations,
body.lightbox-open .installment-modal,
body.lightbox-open .installment-badge,
body.lightbox-open .price-display-wrapper,
body.lightbox-open .woocommerce-variation-add-to-cart,
body.lightbox-open .variation-swatches,
body.lightbox-open .whatsapp-float,
body.lightbox-open .floating-buttons,
body.lightbox-open .wp-chatbot,
body.lightbox-open .tawk-widget,
body.lightbox-open .crisp-client,
body.lightbox-open [class*="chat"],
body.lightbox-open [class*="whatsapp"],
body.lightbox-open .product-actions-section,
body.lightbox-open .product-info-section,
body.lightbox-open .product-price-section,
body.lightbox-open .related-products,
body.lightbox-open .related-products-section,
body.lightbox-open .products-slider,
body.lightbox-open section.related,
body.lightbox-open .upsells,
body.lightbox-open .cross-sells,
body.lightbox-open .woocommerce-product-related,
body.lightbox-open .product-card,
body.lightbox-open footer,
body.lightbox-open .site-footer,
body.lightbox-open main:not(.gallery-lightbox) {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: -1 !important;
}

body.lightbox-open .product-info-section,
body.lightbox-open .trust-indicators-section,
body.lightbox-open .trust-stats,
body.lightbox-open .price-meta-info,
body.lightbox-open .price-meta-item,
body.lightbox-open .product-price,
body.lightbox-open .mobile-sticky-content {
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: -1 !important;
}

body.lightbox-open .gallery-lightbox {
    z-index: 2147483647 !important;

}

body.lightbox-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
}
