.gallery {
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    /*padding: 20px;*/
    gap: 0;
    /*height: 600px;*/
    position: relative;
    z-index: 0;
    overflow: hidden;
}

.thumbnail-column {
    flex: 0 0 var(--thumb-size);
    height: 600px;
    position: relative;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    /*max-width: 100px;*/
}

.main-image-column {
    flex: 1;
    height: 600px;
}

.main-image {
    height: 100%;
}

.main-image img {
    max-height: 600px;
    object-fit: contain;
}

.thumbnailSwiper {
    height: calc(100% - 80px);
    margin: 40px 0;
}

.thumbnailSwiper .swiper-slide {
    width: var(--thumb-size);
    height: calc(100% / 4);
}

.main-image picture {
    padding: 0 5px;
}

.swiper-slide img {
    /*width: 100%;
    height: 100%;*/
    object-fit: cover;
    border-radius: 4px;
    transition: transform 0.3s ease;
}

.nav-button {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 30px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.nav-button.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.nav-prev {
    top: 0;
}

.nav-next {
    bottom: 0;
}

/* Overlay styles */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(3px);
}

.overlay img {
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
    animation: fadeIn 0.3s ease-in-out;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    color: #fff;
    font-size: 30px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transition: background 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@media (max-width: 768px) {
    .gallery {
        flex-direction: column-reverse;
        gap: 16px;
        height: auto;
    }

    .thumbnail-column {
        display: none;
    }

    .main-image-column {
        width: 100%;
        height: auto;
    }

    .main-image {
        touch-action: pan-y pinch-zoom;
    }

    .nav-button {
        top: 50%;
        transform: translateY(-50%);
    }

    .nav-prev {
        left: 0;
    }

    .nav-next {
        right: 0;
        left: auto;
    }
}

.thumbnailSwiper {
    height: calc(100% - 80px);
    margin: 40px 0;
    padding: 0 10px;
}

.thumbnailSwiper .swiper-slide {
    width: var(--thumb-size);
    height: calc((100% - 30px) / 4); /* Space for 3 margins between 4 items */
    margin-bottom: 10px;
    border: 2px solid transparent;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.thumbnailSwiper .swiper-slide:last-child {
    margin-bottom: 0;
}

.thumbnailSwiper .swiper-slide-thumb-active {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.2);
}

/*.swiper-slide img {*/
/*    width: 100%;*/
/*    height: 100%;*/
/*    object-fit: cover;*/
/*    border-radius: 2px;*/
/*}*/

.main-image {
    height: 100%;
    /*display: flex;*/
    align-items: center;
    justify-content: center;
}

.main-image picture {
    width: 600px;
    height: 600px;
    display: block;
}

.main-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/**/
.thumbnailSwiper .swiper-slide {
    width: 100px;
    height: 100px !important; /* Force exact height */
    margin-bottom: 10px;
    border: 2px solid transparent;
    border-radius: 4px;
    overflow: hidden; /* Ensure content stays within bounds */
    display: flex; /* Enable proper centering */
    align-items: center;
    justify-content: center;
}

.thumbnailSwiper .swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ensure image fills the space */
    border-radius: 2px;
}

.thumbnail-column {
    flex: 0 0 120px; /* Slightly wider to account for padding */
    height: 600px;
    position: relative;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 0 10px;
}

.thumbnailSwiper {
    height: calc(100% - 80px);
    margin: 40px 0;
}

.thumbnailSwiper .swiper-slide {
    width: 100px;
    height: 100px;
    aspect-ratio: 1/1;
    position: relative;
    margin-bottom: 10px;
}

.thumbnailSwiper .swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

/* For responsive behavior */
@media (max-width: 768px) {
    .thumbnailSwiper .swiper-slide {
        width: clamp(60px, 15vw, 100px);
        height: clamp(60px, 15vw, 100px);
    }
}

@media (max-width: 768px) {
    .gallery {
        flex-direction: column-reverse;
        height: auto;
        padding: 0;
    }

    .main-image-column {
        width: 100%;
        aspect-ratio: 1/1;
        height: auto;
    }

    .main-image {
        width: 100%;
        height: 100%;
    }

    .main-image picture,
    .main-image img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        aspect-ratio: 1/1;
    }

    .thumbnail-column {
        display: none;
    }

    .swiper-slide {
        width: 100%;
        aspect-ratio: 1/1;
    }
}

.overlay-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.overlay-nav:hover {
    background: rgba(255, 255, 255, 0.2);
}

.overlay-prev {
    left: 20px;
}

.overlay-next {
    right: 20px;
}

@media (max-width: 768px) {
    .overlay-nav {
        width: 40px;
        height: 40px;
    }

    .overlay-prev {
        left: 10px;
    }

    .overlay-next {
        right: 10px;
    }
}



#addToCartForm {
    position: relative;
    z-index: 2;
}
