/* CSS Variables - Universal Product Carousel */
:root {
    --upc-accent: #007cba;
    --upc-text-dark: #333;
    --upc-text-light: #666;
    --upc-white: #ffffff;
    --upc-border: #DADADA;
    --upc-border-light: #e9ecef;
    --upc-border-lighter: #eee;
    --upc-bg-white: rgba(255, 255, 255, 0.95);
    --upc-bg-white-solid: #ffffff;
}

.merida-universal-product-carousel {
    width: 100%;
    overflow: hidden;
    /* Ensures content stays within bounds */
    position: relative;
}

.merida-universal-product-carousel .merida-carousel-track {
    display: flex;
    flex-wrap: nowrap;
    /* Prevent wrapping */
    overflow-x: scroll;
    /* Enable horizontal scrolling */
    -webkit-overflow-scrolling: touch;
    /* Smooth scrolling on iOS */
    scroll-snap-type: x mandatory;
    /* Snap to items */
    padding-bottom: 15px;
    /* Space for scrollbar */
}

.merida-universal-product-carousel .merida-carousel-track>li.product {
    flex: 0 0 auto;
    /* Prevent items from growing/shrinking */
    scroll-snap-align: start;
    /* Snap to the start of each item */
    /* Adjust width based on desired products per row, e.g., for 4 products */
    width: calc(100% / 4);
    /* Example: 4 products per row */
    box-sizing: border-box;
    padding: 0 10px;
    /* Adjust spacing between products */
}

/* Adjust for different screen sizes if needed, similar to Kadence grid */
@media (max-width: 767px) {
    .merida-universal-product-carousel .merida-carousel-track>li.product {
        width: calc(100% / 2);
        /* 2 products on small screens */
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .merida-universal-product-carousel .merida-carousel-track>li.product {
        width: calc(100% / 3);
        /* 3 products on medium screens */
    }
}

/* Ensure consistent height for product items */
.merida-universal-product-carousel .merida-carousel-track .product-loop-item {
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Ensure inner content takes full height */
}

/* Styling for navigation arrows */
.merida-universal-product-carousel .merida-carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--upc-bg-white);
    border: 1px solid var(--upc-border-lighter);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: background-color 0.3s ease;
}

.merida-universal-product-carousel .merida-carousel-arrow:hover {
    background-color: var(--upc-bg-white-solid);
}

.merida-universal-product-carousel .merida-carousel-prev {
    left: 10px;
}

.merida-universal-product-carousel .merida-carousel-next {
    right: 10px;
}

.merida-products-carousel p.price-net-gross {
    text-align: left;
    font-size: 14px;
    line-height: 24px;
}

.merida-products-carousel span.price-net {
    text-align: left;
    font-size: 18px;
    line-height: 24px;
}

/* Categories Snackbar Styles */
.merida-categories-snackbar {
    width: 100%;
    overflow: hidden;
    position: relative;
    margin: 20px 0;
}

/* Border and padding only for subcategories snackbar (not top categories carousel) */
.merida-categories-snackbar:not(.merida-top-categories-carousel) {
    padding: 24px;
    border: 1px solid var(--upc-border);
    border-radius: 8px;
    background: var(--upc-bg-white-solid);
}

.merida-categories-snackbar h3 {
    font-size: 20px;
    font-weight: 500;
    color: var(--upc-text-dark);
    margin: 0 0 16px 0;
}

.merida-categories-snackbar .merida-carousel-track.categories {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: scroll;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    gap: 20px;
    padding: 0 50px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.merida-categories-snackbar .merida-carousel-track.categories::-webkit-scrollbar {
    display: none;
}

.merida-categories-snackbar .category-item {
    flex: 0 0 auto;
    scroll-snap-align: start;
    min-width: 120px;
    max-width: 150px;
}

.merida-categories-snackbar .category-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: inherit;
    padding: 10px;
    transition: all 0.3s ease;
    height: 100%;
}

.merida-categories-snackbar .category-link:hover {
    transform: translateY(-2px);
}

.merida-categories-snackbar .category-image {
    width: 80px;
    height: 80px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.merida-categories-snackbar .category-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.merida-categories-snackbar .category-name {
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    line-height: 1.3;
    color: var(--upc-text-dark);
}

.merida-categories-snackbar .category-link:hover .category-name {
    color: var(--upc-accent);
}

/* Left gradient blend - starts below heading (only for subcategories snackbar) */
.merida-categories-snackbar:not(.merida-top-categories-carousel)::before {
    content: '';
    position: absolute;
    left: 0;
    top: 56px; /* Heading height + margin (20px + 16px + padding) */
    bottom: 0;
    width: 30px;
    background: linear-gradient(to right, var(--upc-bg-white-solid) 0%, rgba(255, 255, 255, 0) 100%);
    z-index: 2;
    pointer-events: none;
}

/* Right gradient blend - starts below heading (only for subcategories snackbar) */
.merida-categories-snackbar:not(.merida-top-categories-carousel)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 56px; /* Heading height + margin (20px + 16px + padding) */
    bottom: 0;
    width: 30px;
    background: linear-gradient(to left, var(--upc-bg-white-solid) 0%, rgba(255, 255, 255, 0) 100%);
    z-index: 2;
    pointer-events: none;
}

/* Navigation arrows for categories snackbar */
.merida-categories-snackbar .merida-carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--upc-bg-white);
    border: 1px solid var(--upc-border-light);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    padding: 0;
    margin: 0;
}

.merida-categories-snackbar .merida-carousel-arrow:hover {
    background-color: var(--upc-bg-white-solid);
    border-color: var(--upc-accent);
}

.merida-categories-snackbar .merida-carousel-arrow .merida-carousel-icon {
    width: 20px;
    height: 20px;
    filter: invert(0.4);
    transition: filter 0.3s ease;
}

.merida-categories-snackbar .merida-carousel-arrow:hover .merida-carousel-icon {
    filter: invert(0.2);
}

.merida-categories-snackbar .merida-carousel-prev {
    left: 10px;
}

.merida-categories-snackbar .merida-carousel-next {
    right: 10px;
}

/* Responsive adjustments */
@media (max-width: 767px) {
    .merida-categories-snackbar:not(.merida-top-categories-carousel) {
        padding: 16px;
    }

    .merida-categories-snackbar h3 {
        font-size: 18px;
        margin-bottom: 12px;
    }

    .merida-categories-snackbar:not(.merida-top-categories-carousel)::before,
    .merida-categories-snackbar:not(.merida-top-categories-carousel)::after {
        top: 46px; /* Adjusted for mobile heading (18px + 12px + padding) */
    }

    .merida-categories-snackbar .merida-carousel-track.categories {
        padding: 0 30px;
    }

    .merida-categories-snackbar .category-item {
        min-width: 100px;
        max-width: 120px;
    }

    .merida-categories-snackbar .category-image {
        width: 60px;
        height: 60px;
    }

    .merida-categories-snackbar .category-name {
        font-size: 12px;
    }
}
