.mn-product-grid {
    width: 100%;
    row-gap: 20px;
    display: flex;
    flex-direction: column;
}

.product-wrapper {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    row-gap: 50px;
    column-gap: 50px;
    width: 100%;
}

button#mn-modal-filter-toggle {
    border: 1px solid #EBEBEB;
    padding: 5px 21px;
    font-size: 14px;
    line-height: 30px;
    border-radius: 25px;
    background: transparent;
    color: #000;
}

button#mn-modal-filter-toggle:hover {
    background: #EBEBEB;
}

.product-wrapper .product-item {
    width: calc((100%/3) - 34px);
}

.product-wrapper .product-item img {
    width: 100%;
    object-fit: cover;
    aspect-ratio: 1/1;
}

.product-filter-wrapper {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    row-gap: 20px;
    column-gap: 20px;
    width: 100%;
    align-items: center;
}

.product-filter-wrapper .category-filter-wrapper {
    width: 30%;
}

.product-filter-wrapper .product-count-wrapper {
    width: calc(40% - 43px);
}

.product-filter-wrapper .sort-filter-wrapper select,
.product-filter-wrapper .category-filter-wrapper select {
    max-width: 150px;
}

.product-filter-wrapper .sort-filter-wrapper {
    width: 30%;
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
}

.product-count-wrapper .product-total label {
    font-family: 'Figtree';
    font-size: 14px;
    font-weight: 400;
    color: #999999;
    text-align: center;
}

.custom-select-container {
    position: relative;
    display: inline-block;
    border: 1px solid #EBEBEB;
    border-radius: 2px;
    padding-left: 10px;
    padding-right: 10px;
}

.custom-select-container .custom-icon {
    position: absolute;
    top: 50%;
    left: 10px;
    transform: translateY(-50%);
}


select#product-category-filter,
select#product-sort-filter {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    font-family: 'Figtree';
    font-size: 14px;
    border: none;
    background: none;
    text-align: center;
}

select#product-sort-filter {
    padding-left: 15px;
    margin-left: 15px;
}

select#product-category-filter {
    padding-right: 15px;    
}

select#product-category-filter::-ms-expand,
select#product-sort-filter::-ms-expand {
    display: none;
}

.filter-select-container {
    position: relative;
    display: inline-block;
    border: 1px solid #EBEBEB;
    border-radius: 2px;
    padding-left: 10px;
    padding-right: 10px;
}

.filter-select-container .custom-icon {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
}

.flippable {
    transition: transform 0.6s, opacity 0.6s;
    transform-style: preserve-3d;
}

.second-images, .front-images {
    transition: opacity 0.6s;
    display: block;
}

.second-images {
	opacity: 0;
}

.flipped .front-images {
    opacity: 0;
}

.flipped .second-images {
    opacity: 1;
}

a.product-image-link {
    position: relative;
	overflow: hidden;
}

a.product-image-link .second-images {
    position: absolute;
	top: 0;
}

@media (max-width: 478px) {
    .product-wrapper {
        row-gap: 20px;
        column-gap: 20px;
    }

    .product-wrapper .product-item {
        width: 100%;
    }

    .product-filter-wrapper .category-filter-wrapper {
        width: calc(50% - 10px);
        order: 0;
    }
    
    .product-filter-wrapper .product-count-wrapper {
        width: 100%;
        order: 2;
    }
    
    .product-filter-wrapper .sort-filter-wrapper {
        width: calc(50% - 10px);
        order: 1;
    }
}

@media (min-width: 479px) and (max-width: 961px) {
    .product-wrapper {
        row-gap: 20px;
        column-gap: 20px;
    }

    .product-wrapper .product-item {
        width: calc((100%/2) - 10px);
    }
}

.loading-more {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 14px;
    border-radius: 4px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Figtree', sans-serif;
    color: #DACBFB;
    font-weight: 600;
}

/* Add smooth transition for new products */
.product-item {
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.product-item.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Modal Filter Styles */
.modal-filter-wrapper {
    position: relative;
}

.modal-filter-content {
    position: fixed;
    top: 0;
    left: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    border-right: 1px solid #e0e0e0;
    border-top: 1px solid #e0e0e0;
    z-index: 9999;
    transition: left 0.3s ease;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.modal-filter-content.active {
    left: 0;
}

/* Modal Filter Layout: sticky header/footer, scrollable content */
.modal-filter-content-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0;
}

.modal-filter-header {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fff;
    padding: 35px 20px 0 20px;
    display: flex;
    justify-content: space-between;
}

.modal-filter-content-inner-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    max-height: unset;
    padding: 0 20px;
}

.modal-filter-header h3 {
    margin: 0;
    color: #000;
    font-family: 'Figtree';
    font-weight: 600;
    font-size: 20px;
    line-height: 30px;
    letter-spacing: 3%;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close-btn:hover {
    color: #333;
}

.filter-section {
    border-bottom: 1px solid #f0f0f0;
    padding-top: 15px;
    padding-bottom: 15px;
}

.filter-section:last-of-type {
    border-bottom: none;
}

.filter-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.filter-section-header h4 {
    margin: 0;
    font-family: 'Figtree';
    font-weight: 400;
    font-size: 15px;
    line-height: 30px;
    letter-spacing: 3%;
}

.section-toggle {
    font-size: 18px;
    color: #666;
    font-weight: bold;
    transition: transform 0.2s ease;
}

.filter-section-content {
    padding: 10px 0;
}

.filter-option {
    display: flex;
    align-items: center;
    padding: 3px 0;
}

.filter-option:last-child {
    margin-bottom: 0;
}

.filter-option input[type="radio"],
.filter-option input[type="checkbox"] {
    margin-right: 10px;
    width: 16px;
    height: 16px;
    accent-color: #DACBFB;
}

.filter-option label {
    font-family: 'Figtree';
    font-weight: 400;
    font-size: 14px;
    line-height: 30px;
    letter-spacing: 3%;
    cursor: pointer;
    flex: 1;
    color: #000;
    text-align: left;
    margin-bottom: 0;
}

.filter-option label:hover {
    color: #DACBFB;
}

.filter-actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
    background: #fff;
    padding: 10px 20px 20px 20px;
    display: flex;
    gap: 10px;
    /* border-top: 1px solid #e0e0e0; */
}

.clear-filters-btn {
    flex: 1;
    padding: 8px 20px;
    background: #EBEBEB;
    border: 1px solid #EBEBEB;
    border-radius: 24px;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Figtree';
    font-weight: 500;
    font-size: 14px;
    line-height: 30px;
    text-align: center;
}

.clear-filters-btn:hover {
    background: #e8e8e8;
    color: #333;
}

.view-items-btn {
    flex: 1;
    padding: 8px 20px;
    background: #DACBFB;
    border: 1px solid #DACBFB;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Figtree';
    font-weight: 500;
    font-size: 14px;
    line-height: 30px;
    text-align: center;

}

.view-items-btn:hover {
    background: #DACBFB;
    border-color: #DACBFB;
}

/* Modal overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Modal and overlay hidden by default */
.modal-filter-content,
.modal-overlay {
  display: none;
}
.modal-filter-content.active,
.modal-overlay.active {
  display: block;
}

body:has(.modal-filter-content.active),
html:has(.modal-filter-content.active){
  overflow: hidden;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .modal-filter-content {
        width: 95vw;
        max-width: 420px;
        left: 50%;
        top: 5vw;
        transform: translateX(-50%);
        border-radius: 16px;
        box-shadow: 0 8px 32px rgba(0,0,0,0.18);
        margin: 0 auto;
        height: auto;
        min-height: 80vh;
        max-height: 90vh;
        background: #fff;
        overflow: hidden;
    }
    .modal-filter-content-inner {
        border-radius: 16px;
        height: 100%;
        padding: 0;
        max-height: 90vh;
    }
    .modal-filter-header {
        padding: 24px 16px 0 16px;
        border-radius: 16px 16px 0 0;
    }
    .modal-filter-content-inner-scroll {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        max-height: unset;
        padding: 0 16px;
    }
    .filter-actions {
        padding: 10px 16px 16px 16px;
        border-radius: 0 0 16px 16px;
    }
    .clear-filters-btn, .view-items-btn {
        min-width: 0;
        width: 48%;
        font-size: 15px;
        padding-left: 5px;
        padding-right: 5px;
    }

    .modal-filter-content.active {
        left: 50%;
    }
}

/* No products found message */
.no-products-found {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 16px;
    font-family: 'Figtree', sans-serif;
    width: 100%;
    grid-column: 1 / -1;
}

/* Body modal open state */
body.modal-open {
    overflow: hidden;
}

@media (max-width: 768px) {
  .mobile-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border: 1px solid #EBEBEB;
    border-radius: 999px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    padding: 4px 8px 4px 8px;
    margin: 12px auto 18px auto;
    width: 100%;
    max-width: 420px;
    position: sticky;
    top: 0;
    z-index: 10000;
  }
  .mobile-filter-btn {
    background: none;
    border: none;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    min-width: 40px;
    border-radius: 12px;
    font-family: inherit;
    font-size: 15px;
    color: #222;
    gap: 6px;
    cursor: pointer;
    transition: background 0.15s;
  }
  .mobile-filter-btn svg {
    display: block;
  }
  .filter-btn span {
    display: inline-block;
    margin-left: 6px;
    font-weight: 500;
  }
  .mobile-filter-btn:focus,
  .mobile-filter-btn:active {
    background: #F3F3F3;
    outline: 2px solid #DACBFB;
  }
  .mobile-filter-btn:hover {
    background: #F3F3F3;
  }
  .mobile-filter-bar {
    /* Only show on mobile */
    display: flex;
  }
  @media (min-width: 769px) {
    .mobile-filter-bar {
      display: none !important;
    }
  }
}
