/**
 * Product Gallery Styles
 */

.edelweiss-product-gallery {
    margin: 2rem 0;
    width: 100%;
}

.edelweiss-product-gallery__main {
    margin-bottom: 20px;
    cursor: zoom-in;
    position: relative;
    background: #f9f9f9;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.edelweiss-product-gallery__main-image-wrapper {
    position: relative;
    width: 100%;
}

.edelweiss-product-gallery__main-image {
    width: 100%;
    height: auto;
    display: block;
    background: #fff;
    transition: opacity 0.3s ease;
}

.edelweiss-product-gallery__zoom-icon {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.8);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    pointer-events: none;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.edelweiss-product-gallery__main:hover .edelweiss-product-gallery__zoom-icon {
    opacity: 1;
}

.edelweiss-product-gallery__zoom-icon .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    color: #1d2327;
}

.edelweiss-product-gallery__thumbnails {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

@media (max-width: 600px) {
    .edelweiss-product-gallery__thumbnails {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 900px) {
    .edelweiss-product-gallery[data-columns="2"] .edelweiss-product-gallery__thumbnails { grid-template-columns: repeat(2, 1fr); }
    .edelweiss-product-gallery[data-columns="3"] .edelweiss-product-gallery__thumbnails { grid-template-columns: repeat(3, 1fr); }
    .edelweiss-product-gallery[data-columns="4"] .edelweiss-product-gallery__thumbnails { grid-template-columns: repeat(4, 1fr); }
    .edelweiss-product-gallery[data-columns="5"] .edelweiss-product-gallery__thumbnails { grid-template-columns: repeat(5, 1fr); }
    .edelweiss-product-gallery[data-columns="6"] .edelweiss-product-gallery__thumbnails { grid-template-columns: repeat(6, 1fr); }
}

.edelweiss-product-gallery__thumbnail-item {
    position: relative;
    background: #f9f9f9;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.edelweiss-product-gallery__thumbnail-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.edelweiss-product-gallery__thumbnail-item.is-active {
    border-color: #2271b1;
    box-shadow: 0 2px 8px rgba(34, 113, 177, 0.2);
}

.edelweiss-product-gallery__thumbnail-wrapper {
    position: relative;
    width: 100%;
    padding-top: 100%; /* Square thumbnails */
}

@supports (aspect-ratio: 1/1) {
    .edelweiss-product-gallery__thumbnail-wrapper {
        padding-top: 0;
        aspect-ratio: 1 / 1;
    }
}

.edelweiss-product-gallery__thumbnail-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Modal / Lightbox Styles */
.edelweiss-gallery-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.edelweiss-gallery-modal.is-active {
    display: flex;
    opacity: 1;
}

.edelweiss-gallery-modal__backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

.edelweiss-gallery-modal__content {
    position: relative;
    z-index: 1;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.edelweiss-gallery-modal__image-container {
    background: #fff;
    padding: 10px;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

.edelweiss-gallery-modal__image {
    max-width: 100%;
    max-height: 80vh;
    display: block;
    height: auto;
}

.edelweiss-gallery-modal__close,
.edelweiss-gallery-modal__prev,
.edelweiss-gallery-modal__next {
    position: absolute;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 2rem;
    padding: 10px;
    border-radius: 50%;
    line-height: 1;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
}

.edelweiss-gallery-modal__close:hover,
.edelweiss-gallery-modal__prev:hover,
.edelweiss-gallery-modal__next:hover {
    background: rgba(255, 255, 255, 0.4);
}

.edelweiss-gallery-modal__close {
    top: -60px;
    right: 0;
}

.edelweiss-gallery-modal__prev {
    left: -70px;
    top: 50%;
    transform: translateY(-50%);
}

.edelweiss-gallery-modal__next {
    right: -70px;
    top: 50%;
    transform: translateY(-50%);
}

@media (max-width: 768px) {
    .edelweiss-gallery-modal__prev {
        left: 10px;
        background: rgba(0,0,0,0.5);
    }
    .edelweiss-gallery-modal__next {
        right: 10px;
        background: rgba(0,0,0,0.5);
    }
    .edelweiss-gallery-modal__close {
        top: 10px;
        right: 10px;
        background: rgba(0,0,0,0.5);
    }
}
