.product-details-sticky {
    position: -webkit-sticky; /* For Safari */
    position: sticky;
    top: 2rem;
    z-index: 1019; /* Below navbar */
}

.product-gallery {
    position: relative;
    border-radius: 1rem;
    overflow: hidden;
}

.gallery-main {
    flex-grow: 1;
    min-width: 0; /* Prevents flexbox overflow */
}

/* --- New Product Gallery Styles --- */
.product-gallery {
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 0.5rem 1.5rem rgba(0,0,0,0.07);
}

.product-gallery .carousel-item {
    aspect-ratio: 8 / 9;
    background-color: #f8f9fa;
    padding: 0.5rem; /* Add spacing between image and border */
}

.product-gallery .carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-gallery-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 2;
}

.carousel-progress-bar {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    height: 3px; /* Minimal height for the progress line */
    background-color: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
    overflow: hidden;
    z-index: 2; /* Ensure it's above the image */
}

.progress-segment {
    position: absolute;
    top: 0;
    bottom: 0;
    background-color: transparent; /* Segments are now invisible click targets */
    cursor: pointer;
}

.progress-indicator {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0;
    background-color: var(--bs-primary);
    border-radius: 3px;
    transition: width 0s linear; /* Reset on slide change */
}

.carousel-item.active .progress-indicator {
    width: 100%;
    transition: width var(--bs-carousel-interval) linear;
}

/* Pause animation when carousel is paused */
.product-gallery.is-paused .carousel-item.active .progress-indicator {
    transition-duration: 0s !important;
}


/* Size selection radio buttons */
.size-options .btn-check:checked+.btn {
    background-color: var(--bs-dark);
    border-color: var(--bs-dark);
    color: var(--bs-light);
}

/* Accordion styling */
.accordion-button:not(.collapsed) {
    background-color: var(--bs-light);
    color: var(--bs-dark);
}
.accordion-button:focus {
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
}

/* Color Swatches on Product Detail Page */
.color-swatches .swatch-lg {
    display: block;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #dee2e6;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.color-swatches .swatch-lg:hover {
    transform: scale(1.1);
}
.color-swatches .swatch-lg.active {
    box-shadow: 0 0 0 3px white, 0 0 0 5px var(--bs-primary);
}

@media (max-width: 991.98px) { /* Below lg breakpoint */
    .product-details-sticky {
        position: static;
    }
}

/* Reduce product name font size on product detail page */
.product-details-sticky h1.h2 {
    /* Make it slightly smaller than default h2 on mobile */
    font-size: calc(1.275rem + .6vw);
}

@media (min-width: 992px) {
    .product-details-sticky h1.h2 {
        font-size: 1.75rem; /* A fixed, slightly smaller size on desktop */
    }
}