/**
 * Product Gallery Lightbox Styles
 * Place this file in: app/code/Vendor/HomepageManager/view/frontend/web/css/product-gallery.css
 * 
 * Add to your layout XML:
 * <css src="Vendor_HomepageManager::css/product-gallery.css"/>
 */

/* Lightbox Container */
.gallery-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

/* Overlay */
.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1;
}

/* Content Container */
.lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Close Button */
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s ease;
}

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

/* Image Container - CRITICAL FOR SMOOTH PERFORMANCE */
.lightbox-image-container {
    position: relative;
    width: 90%;
    height: 85%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    /* Enable hardware acceleration */
    will-change: auto;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Image/Video - OPTIMIZED FOR SMOOTH TRANSFORMS */
.lightbox-image,
#lightbox-video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    pointer-events: none;
    
    /* CRITICAL: Enable hardware acceleration for smooth transforms */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    perspective: 1000px;
    -webkit-perspective: 1000px;
    
    /* Smooth rendering */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* Zoom Controls */
.lightbox-zoom-controls {
        position: absolute;
    bottom: 60px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: rgb(0 0 0 / 69%);
    border-radius: 61px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 5;
}

.zoom-btn {
       width: 30px;
    padding: 7px;
    height: 30px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.zoom-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

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

.zoom-level {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    min-width: 50px;
    text-align: center;
}

/* Navigation Arrows */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: all 0.2s ease;
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

/* Counter */
.lightbox-counter {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 5;
}

/* Thumbnails */
.lightbox-thumbnails {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 80%;
    z-index: 5;
}

.thumbnails-container {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 10px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.thumbnails-container::-webkit-scrollbar {
    height: 4px;
}

.thumbnails-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.thumbnails-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.thumbnail-item {
    position: relative;
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.thumbnail-item:hover {
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.thumbnail-item.active {
    border-color: #fff;
    transform: scale(1.05);
}

.thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #000;
}

/* Gallery Grid Styles */
.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 0;
    transition: transform 0.2s ease;
}

.gallery-item:hover {
    transform: scale(1.02);
}

.gallery-item img,
.gallery-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Responsive Design */
@media (max-width: 768px) {
    .lightbox-image-container {
        width: 95%;
        height: 80%;
    }
    
    .lightbox-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
    }
    
    .lightbox-nav {
        width: 44px;
        height: 44px;
    }
    
    .lightbox-prev {
        left: 10px;
    }
    
    .lightbox-next {
        right: 10px;
    }
    
    .lightbox-zoom-controls {
        bottom: 100px;
        right: 10px;
        flex-direction: column;
        padding: 8px;
    }
    
    .lightbox-thumbnails {
        max-width: 90%;
    }
    
    .thumbnail-item {
        width: 50px;
        height: 50px;
    }
}

@media (max-width: 480px) {
    .lightbox-nav {
        width: 40px;
        height: 40px;
    }
    
    .lightbox-zoom-controls {
        bottom: 90px;
        scale: 0.9;
    }
    
    .thumbnail-item {
        width: 45px;
        height: 45px;
    }
}

/* Loading State */
.lightbox-image.loading {
    opacity: 0.5;
}

/* Print Styles */
@media print {
    .gallery-lightbox {
        display: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .lightbox-close,
    .zoom-btn,
    .lightbox-nav {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .gallery-lightbox,
    .lightbox-image,
    #lightbox-video,
    .lightbox-close,
    .zoom-btn,
    .lightbox-nav,
    .thumbnail-item {
        transition: none !important;
    }
}