/**
 * WooCommerce Product Gallery - MEGA ZOOM Effect
 * Duże powiększenie na hover + mobile pinch support
 */

/* ==========================================================================
   MEGA ZOOM Effects for Desktop
   ========================================================================== */

.woocommerce-product-gallery__image.photoswipe-item {
    cursor: zoom-in;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform-origin: center center;
}

/* MEGA ZOOM - znacznie większe powiększenie na desktop */
@media (min-width: 768px) {
    .woocommerce-product-gallery__image.photoswipe-item:hover {
        transform: scale(1.25);
        box-shadow: 0 25px 50px rgba(0,0,0,0.3);
        z-index: 100;
        border-radius: 12px;
    }
    
    .woocommerce-product-gallery__image.photoswipe-item:hover img {
        transform: scale(1.4);
        filter: contrast(1.1) brightness(1.05);
    }
    
    /* Dodatkowy zoom na bardzo dużych ekranach */
    @media (min-width: 1200px) {
        .woocommerce-product-gallery__image.photoswipe-item:hover {
            transform: scale(1.35);
        }
        
        .woocommerce-product-gallery__image.photoswipe-item:hover img {
            transform: scale(1.6);
        }
    }
}

/* Subtelniejszy efekt na tablet */
@media (min-width: 768px) and (max-width: 1024px) {
    .woocommerce-product-gallery__image.photoswipe-item:hover {
        transform: scale(1.15);
        box-shadow: 0 15px 30px rgba(0,0,0,0.25);
    }
    
    .woocommerce-product-gallery__image.photoswipe-item:hover img {
        transform: scale(1.25);
    }
}

/* Mobile - brak hover, ale pinch zoom */
@media (max-width: 767px) {
    .woocommerce-product-gallery__image.photoswipe-item {
        touch-action: pan-x pan-y pinch-zoom;
        cursor: grab;
    }
    
    .woocommerce-product-gallery__image.photoswipe-item:active {
        cursor: grabbing;
    }
}

.woocommerce-product-gallery__image.photoswipe-item img {
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: zoom-in;
    width: 100%;
    height: auto;
    display: block;
    transform-origin: center center;
}

/* Enhanced overlay z większą intensywnością */
.woocommerce-product-gallery__image.photoswipe-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(0,0,0,0.1), rgba(0,0,0,0.3));
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.woocommerce-product-gallery__image.photoswipe-item:hover::after {
    opacity: 1;
}

/* Większy zoom indicator */
.woocommerce-product-gallery__image.photoswipe-item::before {
    content: '🔍';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    color: white;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 2;
    text-shadow: 0 4px 8px rgba(0,0,0,0.8);
    pointer-events: none;
}

.woocommerce-product-gallery__image.photoswipe-item:hover::before {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.2);
}

/* ==========================================================================
   Magnifier Glass Effect (Opcjonalny)
   ========================================================================== */

.woocommerce-product-gallery__image.photoswipe-item.magnifier-active {
    position: relative;
}

.magnifier-glass {
    position: absolute;
    width: 200px;
    height: 200px;
    border: 3px solid #007cba;
    border-radius: 50%;
    background: white;
    background-repeat: no-repeat;
    background-size: 400px 400px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.magnifier-glass.active {
    opacity: 1;
}

/* ==========================================================================
   Enhanced Thumbnails
   ========================================================================== */

.woocommerce-product-gallery__thumbnails.photoswipe-thumbnails {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 25px;
    justify-content: flex-start;
}

.woocommerce-product-gallery__thumbnail.photoswipe-thumb {
    flex: 0 0 auto;
    width: 90px;
    height: 90px;
    cursor: pointer;
    border: 3px solid transparent;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    opacity: 0.6;
    position: relative;
    background: #f5f5f5;
}

.woocommerce-product-gallery__thumbnail.photoswipe-thumb:hover {
    border-color: #007cba;
    opacity: 1;
    transform: scale(1.15) translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,123,186,0.3);
}

.woocommerce-product-gallery__thumbnail.photoswipe-thumb.active {
    border-color: #007cba;
    opacity: 1;
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0,123,186,0.4);
}

.woocommerce-product-gallery__thumbnail.photoswipe-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.woocommerce-product-gallery__thumbnail.photoswipe-thumb:hover img {
    transform: scale(1.1);
}

/* ==========================================================================
   Loading States with Animation
   ========================================================================== */

.woocommerce-product-gallery__image.photoswipe-item.loading {
    opacity: 0.5;
    pointer-events: none;
}

.woocommerce-product-gallery__image.photoswipe-item.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60px;
    height: 60px;
    margin: -30px 0 0 -30px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007cba;
    border-radius: 50%;
    animation: mega-spin 1s linear infinite;
    z-index: 10;
}

@keyframes mega-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Mobile Touch Support
   ========================================================================== */

@media (max-width: 767px) {
    .woocommerce-product-gallery__image.photoswipe-item {
        touch-action: manipulation;
    }
    
    .woocommerce-product-gallery__thumbnails.photoswipe-thumbnails {
        justify-content: center;
        gap: 10px;
        overflow-x: auto;
        padding: 10px 0;
    }
    
    .woocommerce-product-gallery__thumbnail.photoswipe-thumb {
        width: 70px;
        height: 70px;
        border-width: 2px;
        flex-shrink: 0;
    }
}

@media (max-width: 480px) {
    .woocommerce-product-gallery__thumbnail.photoswipe-thumb {
        width: 60px;
        height: 60px;
    }
}

/* ==========================================================================
   Accessibility & Performance
   ========================================================================== */

.woocommerce-product-gallery__image.photoswipe-item:focus {
    outline: 4px solid #007cba;
    outline-offset: 4px;
}

.woocommerce-product-gallery__thumbnail.photoswipe-thumb:focus {
    outline: 3px solid #007cba;
    outline-offset: 3px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .woocommerce-product-gallery__image.photoswipe-item,
    .woocommerce-product-gallery__image.photoswipe-item img,
    .woocommerce-product-gallery__thumbnail.photoswipe-thumb {
        transition: none !important;
        animation: none !important;
    }
    
    .woocommerce-product-gallery__image.photoswipe-item:hover {
        transform: none !important;
    }
}

/* GPU Acceleration for smooth animations */
.woocommerce-product-gallery__image.photoswipe-item,
.woocommerce-product-gallery__image.photoswipe-item img,
.woocommerce-product-gallery__thumbnail.photoswipe-thumb {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
    will-change: transform;
}

/* Hidden elements */
.photoswipe-item.hidden {
    display: none !important;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .woocommerce-product-gallery__thumbnails,
    .woocommerce-product-gallery__image::before,
    .woocommerce-product-gallery__image::after {
        display: none !important;
    }
    
    .woocommerce-product-gallery__image {
        transform: none !important;
        box-shadow: none !important;
    }
}
