/* Custom WooCommerce Gallery Styles */

.custom-gallery-wrapper {
    width: 100%;
    max-width: 100%;
}

.custom-main-image {
    width: 100%;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
    background: #f5f5f5;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-main-image img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 600px;
    object-fit: contain;
}

.custom-gallery-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.custom-thumb {
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    background: #fff;
    padding: 5px;
    position: relative;
    overflow: hidden;
}

.custom-thumb:hover {
    border-color: #ddd;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.custom-thumb.active {
    border-color: #333;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.custom-thumb img {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 1/1;
    object-fit: cover;
}

/* Lightbox styles */
.custom-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 999999;
    cursor: zoom-out;
}

.custom-lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-lightbox img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.custom-lightbox-close {
    position: absolute;
    top: 20px;
    right: 40px;
    font-size: 40px;
    color: #fff;
    cursor: pointer;
    z-index: 1000000;
    line-height: 1;
    font-weight: 300;
}

.custom-lightbox-close:hover {
    color: #f00;
}

/* Loading spinner */
.custom-gallery-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive design */
@media (max-width: 768px) {
    .custom-gallery-thumbs {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 8px;
    }
    
    .custom-main-image {
        min-height: 300px;
    }
    
    .custom-main-image img {
        max-height: 400px;
    }
}

@media (max-width: 480px) {
    .custom-gallery-thumbs {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: 5px;
    }
    
    .custom-thumb {
        padding: 3px;
    }
}

/* Override theme gallery styles */
.woocommerce-product-gallery,
.qodef-woo-thumbnails-wrapper {
    display: none !important;
}