/**
 * MidOcean Variant Gallery - Styles
 * Style CSS dla dynamicznej galerii wariantów
 */

/* Główny kontener galerii */
.woocommerce-product-gallery {
    position: relative;
    transition: opacity 0.3s ease-in-out;
}

/* Animacja podczas zmiany galerii */
.midocean-gallery-changing {
    opacity: 0.5;
    pointer-events: none;
}

/* Wrapper galerii */
.woocommerce-product-gallery__wrapper {
    transition: all 0.3s ease-in-out;
}

/* Obrazy galerii */
.woocommerce-product-gallery__image {
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
    position: relative;
    overflow: hidden;
}

.woocommerce-product-gallery__image:hover {
    transform: scale(1.02);
}

/* Linki w galerii */
.woocommerce-product-gallery__image a {
    display: block;
    position: relative;
}

/* Obrazy */
.woocommerce-product-gallery__image img {
    transition: all 0.3s ease-in-out;
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* Loading state */
.midocean-gallery-loading {
    position: relative;
}

.midocean-gallery-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 32px;
    height: 32px;
    margin-top: -16px;
    margin-left: -16px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007cba;
    border-radius: 50%;
    animation: midocean-spin 1s linear infinite;
    z-index: 9999;
    background: rgba(255, 255, 255, 0.8);
}

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

/* Responsywność */
@media (max-width: 768px) {
    .woocommerce-product-gallery__image {
        margin-bottom: 10px;
    }
    
    .woocommerce-product-gallery__image:hover {
        transform: none;
    }
}

/* Kompatybilność z popularnymi motywami */

/* Storefront */
.storefront .woocommerce-product-gallery__image {
    border-radius: 4px;
    overflow: hidden;
}

/* Astra */
.astra-theme .woocommerce-product-gallery {
    margin-bottom: 2em;
}

/* OceanWP */
.oceanwp-theme .woocommerce-product-gallery__wrapper {
    max-width: 100%;
}

/* Kadence */
.kadence-theme .woocommerce-product-gallery__image {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* GeneratePress */
.generate-theme .woocommerce-product-gallery {
    position: relative;
    width: 100%;
}

/* Flexslider override dla smooth transitions */
.flex-viewport {
    transition: height 0.3s ease-in-out;
}

.flexslider .slides > li {
    transition: opacity 0.3s ease-in-out;
}

/* PhotoSwipe gallery improvements */
.woocommerce-product-gallery__trigger {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 3px;
    padding: 8px;
    cursor: pointer;
    z-index: 100;
    transition: background-color 0.3s ease;
}

.woocommerce-product-gallery__trigger:hover {
    background: rgba(0, 0, 0, 0.9);
}

/* Variant gallery specific styles */
.midocean-variant-gallery {
    position: relative;
}

.midocean-variant-gallery .woocommerce-product-gallery__image {
    opacity: 1;
    transform: translateY(0);
    animation: midocean-fade-in 0.3s ease-in-out;
}

@keyframes midocean-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Debug mode styles */
.midocean-debug {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px;
    border-radius: 5px;
    font-size: 12px;
    z-index: 9999;
    max-width: 300px;
    max-height: 200px;
    overflow-y: auto;
}

/* Accessibility improvements */
.woocommerce-product-gallery__image a:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.woocommerce-product-gallery__image img:focus {
    outline: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .woocommerce-product-gallery__image {
        border: 2px solid currentColor;
    }
    
    .midocean-gallery-loading::after {
        border-color: currentColor;
        border-top-color: transparent;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .woocommerce-product-gallery,
    .woocommerce-product-gallery__wrapper,
    .woocommerce-product-gallery__image,
    .woocommerce-product-gallery__image img,
    .flex-viewport,
    .flexslider .slides > li {
        transition: none;
        animation: none;
    }
    
    .woocommerce-product-gallery__image:hover {
        transform: none;
    }
    
    .midocean-gallery-loading::after {
        animation: none;
    }
}

/* Print styles */
@media print {
    .woocommerce-product-gallery__trigger,
    .midocean-gallery-loading::after,
    .midocean-debug {
        display: none !important;
    }
    
    .woocommerce-product-gallery__image {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* Ukrycie przycisku resetu wariantów */
.reset_variations { display: none !important; }
