/**
 * Enhanced Product Gallery Styles
 * Complementary styles for the product image gallery
 */

/* Gallery Container */
.product-gallery-container {
    position: relative;
    width: 100%;
}

/* Main Gallery Styles */
.product-gallery-main {
    position: relative;
    margin-bottom: 20px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-gallery-main:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.main-image-container {
    position: relative;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    aspect-ratio: 1;
    overflow: hidden;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Swiper Overrides */
.product-gallery-swiper {
    width: 100%;
    height: 100%;
}

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

/* Image Wrapper */
.image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    overflow: hidden;
}

/* Main Images */
.main-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: all 0.3s ease;
    cursor: zoom-in;
    display: block;
    padding: 20px;
    max-width: 100%;
    max-height: 100%;
}

.main-image:hover {
    transform: scale(1.01);
}

/* Image Overlay */
.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.1) 0%,
        rgba(0, 0, 0, 0.05) 50%,
        rgba(0, 0, 0, 0.1) 100%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(1px);
}

.image-wrapper:hover .image-overlay {
    opacity: 1;
}

/* Enhanced Zoom Button */
.zoom-btn {
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 25px;
    width: auto;
    height: 50px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(15px);
    font-weight: 600;
    font-size: 14px;
    color: #333;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.zoom-btn:hover {
    background: #fff;
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
    border-color: #007bff;
    color: #007bff;
}

.zoom-btn:active {
    transform: scale(0.98) translateY(0);
}

.zoom-btn i {
    font-size: 16px;
    transition: all 0.3s ease;
}

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

.zoom-text {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Navigation Buttons */
.gallery-nav-btn {
    width: 45px !important;
    height: 45px !important;
    background: rgba(255, 255, 255, 0.95) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15) !important;
    margin-top: -22.5px !important;
    backdrop-filter: blur(10px) !important;
}

.gallery-nav-btn:hover {
    background: #fff !important;
    transform: scale(1.1) !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25) !important;
}

.gallery-nav-btn::after {
    display: none !important;
}

.gallery-nav-btn i {
    font-size: 18px;
    color: #333;
    transition: color 0.3s ease;
}

.gallery-nav-btn:hover i {
    color: #007bff;
}

.swiper-button-prev.gallery-nav-btn {
    left: 20px !important;
}

.swiper-button-next.gallery-nav-btn {
    right: 20px !important;
}

/* Pagination */
.swiper-pagination {
    bottom: 20px !important;
}

.swiper-pagination-bullet {
    background: rgba(255, 255, 255, 0.8) !important;
    opacity: 1 !important;
    width: 12px !important;
    height: 12px !important;
    margin: 0 6px !important;
    transition: all 0.3s ease !important;
}

.swiper-pagination-bullet-active {
    background: #fff !important;
    transform: scale(1.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Enhanced Thumbnail Gallery */
.product-gallery-thumbs {
    margin-top: 20px;
    padding: 0 5px;
}

.product-thumbs-swiper {
    padding: 8px 0;
    overflow: visible;
}

.thumb-slide {
    width: auto !important;
    margin-right: 12px;
    cursor: pointer;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 3px solid transparent;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.thumb-slide::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(0, 123, 255, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.thumb-slide:hover::before {
    opacity: 1;
}

.thumb-slide:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    border-color: rgba(0, 123, 255, 0.3);
}

.thumb-slide.active {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25), 0 4px 15px rgba(0, 123, 255, 0.3);
    transform: translateY(-2px) scale(1.02);
}

.thumb-slide.active::before {
    opacity: 0.3;
}

.thumb-image {
    width: 90px;
    height: 90px;
    object-fit: contain;
    display: block;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
    padding: 8px;
    background: #fff;
}

.thumb-slide:not(.active) .thumb-image {
    opacity: 0.8;
    filter: brightness(0.9);
}

.thumb-slide.active .thumb-image,
.thumb-slide:hover .thumb-image {
    opacity: 1;
    filter: brightness(1);
}

/* Loading States */
.image-loading {
    position: relative;
}

.image-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: gallerySpinner 1s linear infinite;
    z-index: 10;
}

@keyframes gallerySpinner {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error States */
.image-error {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 14px;
    flex-direction: column;
}

.image-error::before {
    content: '🖼️';
    font-size: 48px;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-image-container {
        aspect-ratio: 4/3;
    }
    
    .zoom-btn {
        width: 50px;
        height: 50px;
    }
    
    .zoom-btn i {
        font-size: 18px;
    }
}

@media (max-width: 768px) {
    .main-image-container {
        aspect-ratio: 1;
        border-radius: 12px;
        min-height: 300px;
    }
    
    .product-gallery-main {
        margin-bottom: 20px;
        border-radius: 12px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    }
    
    .main-image {
        padding: 15px;
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
    }
    
    .gallery-nav-btn {
        width: 40px !important;
        height: 40px !important;
        backdrop-filter: blur(10px);
        background: rgba(255, 255, 255, 0.95) !important;
    }
    
    .gallery-nav-btn i {
        font-size: 16px;
    }
    
    .zoom-btn {
        width: auto;
        height: 45px;
        padding: 0 16px;
        border-radius: 22px;
        font-size: 13px;
        backdrop-filter: blur(15px);
    }
    
    .zoom-btn i {
        font-size: 14px;
    }
    
    .zoom-text {
        font-size: 12px;
    }
    
    .thumb-image {
        width: 70px;
        height: 70px;
        border-radius: 8px;
        padding: 6px;
    }
    
    .product-gallery-thumbs {
        margin-top: 15px;
    }
    
    .thumb-slide {
        margin-right: 10px;
        border-radius: 10px;
    }
    
    .swiper-button-prev.gallery-nav-btn {
        left: 15px !important;
    }
    .swiper-button-next.gallery-nav-btn {
        right: 15px !important;
    }
}

@media (max-width: 480px) {
    .main-image-container {
        min-height: 280px;
        border-radius: 10px;
    }
    
    .product-gallery-main {
        border-radius: 10px;
    }
    
    .main-image {
        padding: 10px;
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
    }
    
    .thumb-image {
        width: 60px;
        height: 60px;
        border-radius: 6px;
        padding: 4px;
    }
    
    .thumb-slide {
        margin-right: 8px;
        border-radius: 8px;
    }
    
    .gallery-nav-btn {
        width: 36px !important;
        height: 36px !important;
    }
    
    .gallery-nav-btn i {
        font-size: 14px;
    }
    
    .zoom-btn {
        height: 40px;
        padding: 0 14px;
        font-size: 12px;
        border-radius: 20px;
    }
    
    .zoom-btn i {
        font-size: 12px;
    }
    
    .zoom-text {
        font-size: 11px;
    }
    
    .swiper-pagination-bullet {
        width: 10px !important;
        height: 10px !important;
        margin: 0 4px !important;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .main-image,
    .thumb-image {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .main-image,
    .zoom-btn,
    .gallery-nav-btn,
    .thumb-slide,
    .image-overlay {
        transition: none;
    }
    
    .image-loading::after {
        animation: none;
    }
}

/* Focus States for Keyboard Navigation */
.zoom-btn:focus,
.gallery-nav-btn:focus,
.thumb-slide:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .product-gallery-container {
        break-inside: avoid;
    }
    
    .image-overlay,
    .zoom-btn,
    .gallery-nav-btn,
    .swiper-pagination {
        display: none !important;
    }
}
