.gallery-slider {
    position: relative;
    width: 100%;
    margin-bottom: 20px;
    touch-action: pan-y pinch-zoom;
    display: flex;
    flex-direction: row;
    box-sizing: border-box;
    --transition-time: 300ms;
    --dot-color: rgba(128, 128, 128, 0.8);
    --dot-active-color: gray;
    --prev-next-color: rgba(112, 99, 85, 0.8);
    --prev-next-hover-color: rgba(112, 99, 85, 1);
    --active-border-color: silver;
    --nav-bg-color: #f3cbb94d;
    --nav-bg-color-hover: #F3CBB969;
    /* border: solid 1px lab(38.15 50.39 31.83 / 0.41); */
    min-height: 80vh;
    max-width: 100%;
    align-items: stretch; /* Make children match heights */
    height: auto;
    gap: 20px; /* Add proper spacing between thumbnails and main image */
}

.gallery-slider * {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;    
}

.gallery-thumbnails {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--prev-next-color) transparent;
    order: 1;
    width: 120px;
    max-width: 120px;
    max-height: 80vh; /* Limit height to 80% of viewport height */
    padding: 25px 5px 5px 5px;
    flex-shrink: 0;
    align-self: stretch; /* Match height of container */
}

.gallery-thumbnails::-webkit-scrollbar {
    width: 6px;
    height: auto;
}

.gallery-thumbnails::-webkit-scrollbar-track {
    background: transparent;
}

.gallery-thumbnails::-webkit-scrollbar-thumb {
    background-color: var(--prev-next-color);
    border-radius: 3px;
}

.gallery-thumbnail {
    width: 100%;
    
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 4px;
    /* overflow: hidden; */
    /* transition: border-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease; */
    /* flex-shrink: 0; */
    /* padding: 2px; */
    transition: transform 0.2s ease, border-color 0.2s ease;
    /* border: solid 1px transparent; */
    /* box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); */
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.gallery-thumbnail:hover {
    transform: scale(1.05);
    
    /* background: #efe8e2; */
    /* box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15); */
}

.gallery-thumbnail.active {
    border-color: var(--active-border-color);
    /* background: yellow; */
    /* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); */
}

.gallery-thumbnail img {
    max-width: 100%;
}

.gallery-main {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 6px;
    flex: 1;
    /* box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1); */
    background-color: white;
    order: 2;
    margin: 0; /* Remove margin to ensure proper height matching */
    padding: 20px; /* Use padding instead of margin */
    height: auto;
    min-height: 400px;
    max-height: 80vh; /* Match thumbnails max-height */
    align-self: stretch; /* Stretch to match container height */
    /* border: solid 1px pink; */
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    margin-right: 20px;
}

.gallery-main .gallery-slide {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transform: translateX(100%);
    display: flex;
    align-items: center;
    justify-content: center;
    will-change: transform, opacity;
    background-size: contain;
    background-repeat: no-repeat;
    transition: transform var(--transition-time) ease-out, opacity var(--transition-time) ease-out;
}

/* When animation is explicitly disabled, use no transition */
.gallery-slide.no-transition {
    transition: none !important;
}

/* Remove the transition class as we're using style.transition directly */
.gallery-slide.transition {
    /* This is now handled directly in JavaScript */
}

/* When there's only one slide, make it always visible */
.gallery-slide:only-child {
    opacity: 1;
    position: relative;
    transform: none !important;
}

.gallery-slide.active {
    opacity: 1;
    transform: translateX(0);
    z-index: 1;
}

.gallery-slide.prev {
    opacity: 1;
    transform: translateX(-100%);
}

.gallery-slide.next {
    opacity: 1;
    transform: translateX(100%);
}

.gallery-slide img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    display: block;
    margin: 0 auto;
}

.gallery-nav {
    
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    z-index: 2;
    /* left: 120px; */
    right: 0;
    width: auto;
    /* padding: 0 10px; */
    width: 100%;    
    
}

.gallery-prev,
.gallery-next {
    /* width: 40px;
    height: 40px; */
    border: none;
    background: var(--nav-bg-color);
    color: var(--prev-next-color);
    font-size: 36px;
    border-radius: 6px;
    cursor: pointer;
    pointer-events: auto;
    /* transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease; */
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    /* text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75); */
    padding: 20px 10px;
    margin: 0;
    /* box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); */
    /* transform: translateY(-50%); */
}

.gallery-prev{
    padding-right: 12px;
}
.gallery-next{
    padding-left: 12px;
}

.gallery-prev:hover,
.gallery-next:hover {
    background: var(--nav-bg-color-hover);
    color: var(--prev-next-hover-color);
    /* box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15); */
}

.gallery-prev.disabled,
.gallery-next.disabled {
    opacity: 0.1;
    cursor: default;
    pointer-events: none;
}

/* Ensure .product-photos container is properly sized */
.product-photos {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .gallery-slider {
        flex-direction: column;
        gap: 10px;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        min-height: 40vh;
        align-items: stretch; /* Reset alignment for mobile */
    }

    .gallery-main {
        margin: 0;
        flex: none;
        display: flex; /* Keep flex display for centering */
        align-items: center;
        justify-content: center;
        margin-bottom: 10px;
        padding: 0; /* Remove padding on mobile */
        order: 1; /* Show main image first on mobile */
        max-height: none; /* Remove max-height limitation for mobile */
        min-height: 300px; /* Set minimum height for mobile */
    }

    .gallery-thumbnails {
        flex-direction: row;
        width: 100%;
        max-width: 100%;
        max-height: none; /* Remove max-height limitation for mobile */
        height: auto;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 7px 10px;
        order: 2; /* Show thumbnails after main image on mobile */
        flex-wrap: nowrap;
        box-sizing: border-box;
        align-self: auto; /* Reset alignment */
    }

    .gallery-thumbnail {
        max-width: 80px;
        min-width: 80px;
        flex: 0 0 80px;
        height: 80px;
        box-sizing: border-box;
    }

    /* Reset nav positioning for mobile */
    .gallery-nav {
        box-sizing: border-box;
        padding: 0 10px;
    }
    
    .gallery-prev,
    .gallery-next {
    }
    
    /* Ensure slides are visible */
    .gallery-slide {
        opacity: 0;
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .gallery-slide.active {
        opacity: 1;
        transform: translateX(0);
        z-index: 1;
    }
    
    .gallery-slide img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
    }

    /* Restore the scrollbar styling for thumbnails on mobile */
    .gallery-thumbnails::-webkit-scrollbar {
        width: auto;
        height: 6px;
    }
    
    .gallery-thumbnails::-webkit-scrollbar-track {
        background: transparent;
    }
    
    .gallery-thumbnails::-webkit-scrollbar-thumb {
        background-color: var(--prev-next-color);
        border-radius: 3px;
    }
    
    .gallery-thumbnail img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    /* Fix width issue on mobile */
    .product-photos {
        width: 100%;
        max-width: 100vw;
        overflow: hidden;
        box-sizing: border-box;
    }
    
    .gallery-slider {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        padding: 0;
    }
} 