/* SimplexTheme Magnific Popup Gallery - 3:4 Aspect Ratio Pattern */
/*
 * Features:
 * - Dynamic sizing based on MediaSettings.ProductDetailsPictureSize
 * - 3:4 aspect ratio for all product images (width:height = 3:4)
 * - Magnific Popup lightbox with gallery mode and prev/next navigation
 * - Zoom popup respects MediaSettings.MaximumImageSize
 * - Thumbnail gallery for multiple images
 * - Smooth drag navigation transitions with visual feedback
 */

/* Gallery Container */
.gallery {
    width: 100%;
    max-width: var(--product-detail-pic-size);
    margin: 0 auto 2rem;
}

.gallery .picture {
    width: 100%;
    max-width: var(--product-detail-pic-size);
    margin: 0 auto;
}

/* Picture Wrapper - For positioning navigation arrows */
.picture-wrapper {
    position: relative;
    width: 100%;
    max-width: var(--product-detail-pic-size);
    overflow: hidden; /* Contain drag transforms */
}

/* Main Product Image Container - 3:4 Aspect Ratio */
.main-product-link {
    display: block;
    width: 100%;
    max-width: var(--product-detail-pic-size);
    cursor: grab;
    position: relative;
   aspect-ratio: 3 / 4; /* 3/4 for clothing, 4/4 for wigs */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    /* Smooth transitions for opacity and transform */
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.1s ease-out;
}

/* Active dragging state */
.main-product-link.is-dragging {
    cursor: grabbing;
    transition: none; /* Disable transitions during active drag */
}

/* Hover state - subtle feedback */
.main-product-link:hover {
    opacity: 0.95;
}

/* Main Product Image */
.main-product-image {
    width: 100%;
    max-width: var(--product-detail-pic-size);
    height: 100%;
    display: block;
    object-fit: scale-down;
    object-position: center;
    pointer-events: none; /* Prevent default drag behavior */
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    /* Optimized opacity transitions for image swaps - 150ms (40% faster) */
    transition: opacity 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Image swap animation states */
.main-product-image.is-fading-out {
    opacity: 0;
}

.main-product-image.is-fading-in {
    opacity: 1;
}

/* Drag direction indicator (optional subtle effect) */
.main-product-link.dragging-left {
    transform: translateX(-2px);
}

.main-product-link.dragging-right {
    transform: translateX(2px);
}

/* Navigation Arrows - Owl Carousel Style */
.picture-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.55);
    border: none;
    border-radius: 0;
    cursor: pointer;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #444;
}

.picture-wrapper:hover .picture-nav {
    opacity: 1;
}

.picture-nav:hover {
    background: rgba(255,255,255,0.75);
    box-shadow: none;
    transform: translateY(-50%) scale(1.1);
    opacity: 1;
    color: #000;
}

.picture-nav:active {
    transform: translateY(-50%) scale(0.95);
}

.picture-nav-prev {
    left: 0;
}

.picture-nav-next {
    right: 0;
}

.picture-nav svg {
    display: block;
    pointer-events: none;
}

/* Magnific Popup - Max Image Size from Admin Settings */
.mfp-img {
    max-width: var(--max-image-size) !important;
    max-height: var(--max-image-size) !important;
}
/* Thumbnail Container */
.product-thumbs-container {
    margin-top: 10px;
    text-align: center;
    display: flex;
    flex-wrap: wrap;
    gap: 1px;
    justify-content: center;
}

.thumb-item {
    display: inline-block;
    margin-right: 0px;
    border: 2px solid transparent;
    border-radius: 4px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    text-decoration: none;
    width: 100px;
    aspect-ratio: 3 / 4;
    overflow: hidden;
}

.thumb-item:hover {
    border-color: #999;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.thumb-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.thumb-item:hover .thumb-image {
    transform: scale(1.05);
}

/* Accessibility: Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .main-product-link,
    .main-product-image,
    .picture-nav,
    .thumb-item,
    .thumb-image,
    .picture-nav svg {
        transition: none !important;
        animation: none !important;
    }
}

/* Responsive Adjustments - Scale thumbnails and arrows for smaller screens */
@media (max-width: 991.98px) {
    .product-thumbs-container {
        gap: 8px;
        justify-content: center;
    }

    .thumb-item {
        margin-right: 0px;
        width: 80px;
    }

    .picture-nav {
        width: 35px;
        height: 35px;
    }

    .picture-nav-prev {
        left: 5px;
    }

    .picture-nav-next {
        right: 5px;
    }
}

@media (max-width: 768px) {
    .product-thumbs-container {
        gap: 6px;
        justify-content: center;
    }

    .thumb-item {
        margin-right: 0px;
        width: 70px;
    }

    .picture-nav {
        width: 30px;
        height: 30px;
    }
}

@media (max-width: 480px) {
    .product-thumbs-container {
        gap: 4px;
        justify-content: center;
    }

    .thumb-item {
        width: 60px;
    }

    .picture-nav {
        width: 28px;
        height: 28px;
    }

    .picture-nav svg {
        width: 16px;
        height: 16px;
    }
}

/* Print */
@media print {
    .product-thumbs-container {
        display: none;
    }
}
