/* Hide the shop by Section in the filter */
.filter .shop-by-section,
.mobile-filter-modal .shop-by-section {
    display: none;
}
/* Dynamic Shop */
.dynamic-shop {
    display: flex;
    flex-direction: column;
    /* margin-bottom: 40px; */
    padding-top: 16px;
    /* max-width: 1312px; */
    /* margin: 0 auto; */
}


/* Banner */
.dynamic-shop .banner-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 16px;
    width: 100%;
    max-width: 1312px;
    margin: 0 auto;
}
.dynamic-shop .banner {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 80px 48px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 16px;
    min-height: 295px;
    width: 100%;
}

.dynamic-shop .banner .text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 4px;
}

.dynamic-shop .banner .text .breadcrumb {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
    color: #FFF;
    /* Date */
    font-family: var(--theme-font-family);
    font-size: var(--theme-font-size-date);
    font-weight: var(--theme-font-weight-date);
    line-height: var(--theme-line-height-date);
    letter-spacing: var(--theme-letter-spacing-date);
    text-transform: uppercase;
}

.dynamic-shop .banner .text .breadcrumb a {
    color: rgba(255, 255, 255, 0.30);
}

.dynamic-shop .banner .title {
    /* H1 */
    font-family: var(--theme-font-family);
    font-size: var(--theme-font-size-h1);
    font-weight: var(--theme-font-weight-h1);
    line-height: var(--theme-line-height-h1);
    text-transform: uppercase;
}


/* Shop by category */
.dynamic-shop .shop-by-category {
    display: block;
    flex-direction: column;
    padding-top: 24px;
    width: 100%;
    gap: 12px;
}

.dynamic-shop .shop-by-category .title {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-end;
    gap: 8px;
    font-size: 24px;
    font-weight: 600;
    color: #000;
    max-width: 1312px;
    margin: 0 auto;
    margin-bottom: 12px;
    max-width: 1312px;
}

.dynamic-shop .shop-by-category .title h2 {
    color: #000;
    /* H6 */
    font-family: var(--theme-font-family);
    font-size: var(--theme-font-size-h6);
    font-weight: var(--theme-font-weight-h6);
    line-height: var(--theme-line-height-h6);
    text-transform: uppercase;
}

.dynamic-shop .shop-by-category .category {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
    background-color: #F5F5F5;
    border-radius: 16px;
    padding: 20px;
    aspect-ratio: 1 / 1;
    height: 100%;
}
.dynamic-shop .shop-by-category .category .image {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    overflow: hidden;
}

.dynamic-shop .shop-by-category .category .text {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    width: 100%;

}

.dynamic-shop .shop-by-category .category .text h3 {
    color: #000;

    /* H6 */
    font-family: var(--theme-font-family);
    font-size: var(--theme-font-size-h6);
    font-weight: var(--theme-font-weight-h6);
    line-height: var(--theme-line-height-h6);
    text-transform: uppercase;
}

.dynamic-shop .shop-by-category .category .image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* object-fit: cover; */
}
.dynamic-shop .shop-by-category .category .view-more {
    display: flex;
    padding: 16px;
    justify-content: center;
    align-items: center;
    border-radius: 999px;
    background-color: var(--theme-color-background);
    color: #FFF;
    border: none;
    transition: all 0.3s ease;
}
.dynamic-shop .shop-by-category .category:hover .view-more {
    background-color: var(--theme-color-primary);
}
.dynamic-shop .shop-by-category .category:hover .view-more svg path {
    fill: var(--theme-color-text-inverse);
}
.dynamic-shop .shop-by-category .bottom {
    position: relative;
    display: flex;
    justify-content: flex-end;
    gap: 24px;
}

/* Swiper */
.dynamic-shop .shop-by-category .swiper-container {
    overflow: visible;
}

.dynamic-shop .swiper-button-next,
.dynamic-shop .swiper-button-prev {
    position: relative;
    width: 48px;
    height: auto;
    aspect-ratio: 1 / 1 !important;
    border-radius: 999px;
    background-color: var(--e-global-color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin: 0;
    right: 0;
    left: 0;
}

.dynamic-shop .swiper-button-next:hover,
.dynamic-shop .swiper-button-prev:hover {
    background-color: var(--e-global-color-accent);
}

.dynamic-shop .swiper-button-next:after,
.dynamic-shop .swiper-button-prev:after {
    font-size: 14px;
    font-weight: bold;
    color: white;
}

/* Shop */
.dynamic-shop .shop {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 24px;
    width: 100%;
}

/* Products */
.dynamic-shop .products {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 24px;
    width: 100%;
    position: relative;
    max-width: 1312px;
    margin: 0 auto;
}


/* Main */
.dynamic-shop .main {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-end;
    gap: 16px;
    width: 100%;
    margin-top: 12px;
}

/* Main Inner */
.dynamic-shop .main-inner {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 24px;
    width: 100%;
}

/* Products Grid */
.dynamic-shop .products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    /* Add data attribute to store total products count */
    /* Usage: <div class="products-grid" data-total-products="42"> */
    grid-auto-rows: 1fr; /* Ensure equal height rows */
    width: 100%;
}
.dynamic-shop .shop .products-grid-container{
    display: flex;
    flex-direction: column;
    width: 80%;
}

.dynamic-shop .products-grid.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.dynamic-shop .products-grid.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.dynamic-shop .products-grid.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.product-item {
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    overflow: hidden;
    background: #F3F3F3;
    padding: 16px;
    transition: all 0.3s ease;
    position: relative;
}

/* .product-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
} */

.product-item .product-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
}

.product-item {
    position: relative;
}

.product-item .product-image {
    aspect-ratio: 1/1;
    overflow: hidden;
    background: #FFF;
    border-radius: 8px;
}

.product-item .product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-item .out-of-stock-badge {
    position: absolute;
    top: 24px;
    right: 0;
    background-color: var(--e-global-color-primary);
    color: #fff;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 999px 0 0 999px;
    z-index: 10;
}

.product-item .product-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    justify-content: space-between;
}
.product-item .product-info-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.product-item .product-title {
    /* H6 */
    font-family: var(--theme-font-family);
    font-size: var(--theme-font-size-h6);
    font-weight: var(--theme-font-weight-h6);
    line-height: var(--theme-line-height-h6);
    color: var(--theme-color-text);
    text-transform: uppercase;
}

.product-price {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.price-label {
    color: rgba(0, 0, 0, 0.40);
    font-family: var(--theme-font-family-body-sm);
    font-size: var(--theme-font-size-body-sm);
    font-weight: var(--theme-font-weight-body-sm);
    line-height: var(--theme-line-height-body-sm);
    letter-spacing: var(--theme-letter-spacing-body-sm);
}

.product-item .product-price .price-amount {
    /* H6 */
    font-family: var(--theme-font-family);
    font-size: var(--theme-font-size-h6);
    font-weight: var(--theme-font-weight-h6);
    line-height: var(--theme-line-height-h6);
    color: var(--theme-color-text);
}


.product-item .view-more {
    display: flex;
    padding: 16px;
    justify-content: center;
    align-items: center;
    border-radius: 999px;
    background-color: var(--theme-color-background);
    color: #FFF;
    border: none;
    transition: all 0.3s ease;
}
.product-item:hover .view-more {
    background-color: var(--theme-color-primary);
}
.product-item .view-more svg path {
    fill: var(--theme-color-text);
}
.product-item:hover .view-more svg path {
    fill: var(--theme-color-background);
}
/* Custom Dropdown */
.sort-wrapper {
    position: relative;
}

.custom-dropdown {
    position: relative;
    width: 100%;
}

.dropdown-selected {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    cursor: pointer;
    width: 100%;
}

.dropdown-selected:hover {
    border-color: #DC0039;
}

.selected-text {
    font-family: "Ebony";
    font-size: 14px;
    font-weight: 400;
    color: #000;
    text-decoration: underline;
}

.dropdown-arrow {
    font-size: 12px;
    color: #666;
    transition: transform 0.2s ease;
}

.custom-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-options {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 200px;
    width: max-content;
    background: #FFF;
    border: 1px solid #E0E0E0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.product-grid-sorting-wrapper .custom-dropdown .dropdown-selected {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    cursor: pointer;
    user-select: none;
    border-radius: 0;
    background: transparent;
}

.product-grid-sorting-wrapper .custom-dropdown.open .dropdown-selected {
    border-radius: 16px 16px 0 0;
}

.product-grid-sorting-wrapper .custom-dropdown .selected-text {
    color: #000;
    /* Action */
    font-family: var(--theme-font-family-action);
    font-size: var(--theme-font-size-action);
    font-weight: var(--theme-font-weight-action);
    line-height: var(--theme-line-height-action);
    width: 100%;
    text-decoration: underline;
    text-align: end;
}

.product-grid-sorting-wrapper .custom-dropdown .selected-text.selected {
    color: #333;
}

.product-details .custom-dropdown .dropdown-arrow {
    font-size: 12px;
    color: #666;
    transition: transform 0.2s ease;
    transform: rotate(0deg);
}

.product-grid-sorting-wrapper .custom-dropdown .dropdown-options {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 200px;
    width: max-content;
    background: var(--theme-color-background);
    border-radius: 16px;
    /* box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); */
    box-shadow: none;
    z-index: 1000;
    /* max-height: 200px; */
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.custom-dropdown.open .dropdown-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-dropdown .dropdown-option {
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 16px;
    color: var(--theme-color-text);
}

.custom-dropdown .dropdown-option:hover:not([data-selected="true"]) {
    background-color: var(--theme-color-accent) !important;
}

.custom-dropdown .dropdown-option:last-child {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}
.custom-dropdown.open .dropdown-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-option {
    padding: 12px 16px;
    font-family: var(--theme-font-family-body-sm);
    font-size: var(--theme-font-size-body-sm);
    font-weight: var(--theme-font-weight-body-sm);
    color: var(--theme-color-text);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.dropdown-option:hover:not([data-selected="true"]) {
    background-color: var(--theme-color-accent) !important;
}

.dropdown-option[data-selected="true"] {
    background-color: var(--theme-color-primary);
    color: var(--theme-color-text-inverse);
}

.dropdown-option:first-child {
    border-radius: 8px 8px 0 0;
}

.dropdown-option:last-child {
    border-radius: 0 0 8px 8px;
}

/* Top Bar */
.dynamic-shop .top-bar-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    width: 100%;
}

.dynamic-shop .top-bar {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    width: 100%;
}

.dynamic-shop .sort-label {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    white-space: nowrap;
}



/* Swiper Buttons */
.swiper-button-next {
    right: 0;
}

.swiper-button-prev {
    left: 0;
}

.swiper-button-next,
.swiper-button-prev {
    margin: 0 !important;
    margin-top: 12px !important;
    position: relative !important;
    width: 48px !important;
    height: 48px !important;
    border-radius: 50% !important;
    background-color: #FFF !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: background-color 0.3s ease !important;
    border: 2px solid #DFDFDF !important;
}

.swiper-button-next:hover,
.swiper-button-prev:hover {
    background-color: var(--e-global-color-accent) !important;
}

.swiper-button-next:after,
.swiper-button-prev:after {
    content: "" !important;
    width: 20px !important;
    height: 20px !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
}

.swiper-button-next:after {
    background-image: url("/wp-content/uploads/2025/09/arrow_next.svg") !important;
}

.swiper-button-prev:after {
    background-image: url("/wp-content/uploads/2025/09/arrow_prev.svg") !important;
}
/* End of Elementor Container */
@media (max-width: 1312px) {
    .dynamic-shop .banner-container,
    .dynamic-shop .products, 
    .shop-by-category .title{
        padding-left: 50px;
        padding-right: 50px;
    }
}

/* Tablet */
@media (max-width: 1024px) {
    .dynamic-shop .banner-container,
    .dynamic-shop .products, 
    .shop-by-category .title{
        padding-left: 40px;
        padding-right: 40px;
    }

    .dynamic-shop .banner {
        justify-content: center;
        align-items: center;
    }
    .dynamic-shop .banner .text {
        align-items: center;
    }

    .dynamic-shop .shop-by-category .bottom {
        display: none !important;
    }
    .dynamic-shop .swiper-pagination {
        display: block !important;
    }

    .dynamic-shop .shop .products{
        padding-left: 40px;
        padding-right: 40px;
    }

    .dynamic-shop .shop .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
        width: 100%;
    }
    .dynamic-shop .shop .products-grid-container{
        width: 100%;
    }
}


/* Mobile */
@media (max-width: 768px) {
    .dynamic-shop .banner-container,
    .dynamic-shop .products, 
    .shop-by-category .title{
        padding-left: 12px;
        padding-right: 12px;
    }

    .dynamic-shop .shop .products{
        padding-left: 12px;
        padding-right: 12px;
    }
    .dynamic-shop .shop .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    /* .dynamic-shop .product-info {
        padding: 12px;
    }

    .dynamic-shop .product-title {
        font-size: 14px;
    }

    .dynamic-shop .product-price {
        font-size: 16px;
    } */
}

/* Load More Button */
.load-more-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    /* padding: 40px 0; */
    margin-top: 40px;
}

.load-more-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background-color: #000;
    color: #FFF;
    border: 2px solid #000;
    border-radius: 999px;
    font-family: var(--theme-font-family);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 200px;
}

.load-more-button:hover {
    background-color: #FFF;
    color: #000;
    border-color: #000;
}

.load-more-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.load-more-button .load-more-spinner {
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

/* Matches the Elementor loop grid spinner (fa-spinner, 2s linear) */
.load-more-button .load-more-spinner svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    animation: spin 2s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
    .load-more-button .load-more-spinner svg {
        animation-duration: 6s;
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Back to Top Button */
.back-to-top-button {
    position: fixed;
    bottom: 40px;
    right: 40px;
    width: 56px;
    height: 56px;
    background-color: var(--e-global-color-primary);
    color: var(--theme-color-text-inverse);
    border: 2px solid var(--e-global-color-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.back-to-top-button:hover {
    background-color: #FFF;
    color: #000;
    border-color: #000;
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.back-to-top-button svg {
    width: 24px;
    height: 24px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .load-more-container {
        padding: 24px 0;
        margin-top: 16px;
    }
    
    .load-more-button {
        padding: 12px 24px;
        font-size: 14px;
        min-width: 160px;
    }
    
    .back-to-top-button {
        bottom: 24px;
        right: 24px;
        width: 48px;
        height: 48px;
    }
    
    .back-to-top-button svg {
        width: 20px;
        height: 20px;
    }
}
/* ---------------------------------------------------------------------------
   Shop-by-category carousel

   The swiper is full-bleed, but the design cuts it off at the left edge of the
   1312px content column: cards run in from the right and fade out as they cross
   that line. Nothing is clipped on the right - slides bleed to the viewport.

   `--sbc-edge` is the distance from the viewport to the container's left edge
   and mirrors `getExtraSpace()` in dynamic-shop.php. It drives both the fade and
   the pre-init layout below, so the two can never disagree.

   Percentages resolve against the swiper's own width, which is the full-bleed
   clientWidth that getExtraSpace() measures - so this does not drift by the
   scrollbar width the way 100vw would.
   --------------------------------------------------------------------------- */
.dynamic-shop .shop-by-category .swiper {
    --sbc-gap: 20px;  /* spaceBetween */
    --sbc-spv: 1.5;   /* slidesPerView */
    --sbc-edge: 12px; /* getExtraSpace() */

    /* Small fade, running outward (leftward) from the container edge. Capped to
       the gutter so it can never reach past it and dim the first card, which
       sits flush on that edge at rest. */
    --sbc-fade: min(48px, var(--sbc-edge));
}

@media (min-width: 768px) {
    .dynamic-shop .shop-by-category .swiper { --sbc-spv: 2.5; --sbc-edge: 40px; }
}
@media (min-width: 1024px) {
    .dynamic-shop .shop-by-category .swiper { --sbc-spv: 3.5; --sbc-edge: 50px; }
}
@media (min-width: 1200px) {
    .dynamic-shop .shop-by-category .swiper { --sbc-spv: 4.5; }
}
@media (min-width: 1366px) {
    .dynamic-shop .shop-by-category .swiper { --sbc-spv: 5.5; }
}
@media (min-width: 1400px) {
    .dynamic-shop .shop-by-category .swiper { --sbc-edge: calc((100% - 1312px) / 2); }
}
@media (min-width: 1755px) {
    .dynamic-shop .shop-by-category .swiper { --sbc-spv: 7; }
}
@media (min-width: 2560px) {
    .dynamic-shop .shop-by-category .swiper { --sbc-spv: 8; }
}

/* Left-only cut-off. The ramp reaches fully opaque exactly at the container
   edge and fades out from there going left, so a card at rest is untouched and
   only cards scrolled past the edge fade away. The right side stays at full
   opacity and bleeds off the viewport. */
.dynamic-shop .shop-by-category .swiper {
    -webkit-mask-image: linear-gradient(
        to right,
        transparent 0,
        transparent calc(var(--sbc-edge) - var(--sbc-fade)),
        #000 var(--sbc-edge),
        #000 100%
    );
    mask-image: linear-gradient(
        to right,
        transparent 0,
        transparent calc(var(--sbc-edge) - var(--sbc-fade)),
        #000 var(--sbc-edge),
        #000 100%
    );
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
}

/* ---------------------------------------------------------------------------
   Pre-init layout

   Swiper loads from a CDN and initialises on DOMContentLoaded. Until it does,
   swiper-bundle.css alone applies: every slide is `width: 100%` and the offset
   is not yet applied, so the first paint would be one viewport-wide card flush
   to the screen edge.

   These rules reproduce Swiper's computed layout while `.swiper-initialized` is
   absent. Swiper adds that class itself on init, so they remove themselves at
   exactly the right moment - no teardown code needed.

   Values mirror the Swiper config in dynamic-shop.php (`spaceBetween: 20` and
   the `breakpoints` slidesPerView map). Keep the two in sync.
   --------------------------------------------------------------------------- */
.dynamic-shop .shop-by-category .swiper:not(.swiper-initialized) {
    overflow: hidden;
}

.dynamic-shop .shop-by-category .swiper:not(.swiper-initialized) .swiper-wrapper {
    display: flex;
    gap: var(--sbc-gap);
    margin-left: var(--sbc-edge);
}

.dynamic-shop .shop-by-category .swiper:not(.swiper-initialized) .swiper-slide {
    /* Swiper: (containerWidth - spaceBetween * (slidesPerView - 1)) / slidesPerView */
    width: calc((100% - var(--sbc-gap) * (var(--sbc-spv) - 1)) / var(--sbc-spv));
    flex: 0 0 auto;
    height: auto;
}
