.active,
.activeSort {
    font-weight: bold;
    color: var(--primary);
}

.tree {
    font-family: inherit;
    user-select: none;
    padding: 4px 0;
}

.tree .node {
    margin-bottom: 2px;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.tree .node:hover {
    background: rgba(84, 128, 140, 0.04);
}

.tree .node .label {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.tree .node .label:hover {
    background: rgba(84, 128, 140, 0.06);
}

.tree .node .label .category-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border-radius: 8px;
    background: rgba(84, 128, 140, 0.08);
    transition: all 0.2s ease;
}

.tree .node .label:hover .category-icon {
    background: rgba(84, 128, 140, 0.15);
}

.tree .node .label .category-icon svg {
    width: 16px;
    height: 16px;
}

.tree .node .label .category-name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #263238;
    transition: all 0.2s ease;
}

.tree .node .label:hover .category-name {
    color: var(--primary);
}

.tree .node .label .category-name.active {
    color: var(--primary);
    font-weight: 700;
}

.tree .node .label .category-count {
    padding: 0 8px;
    border-radius: 12px;
    background: #f0f2f3;
    color: #9aa4a8;
    font-size: 11px;
    font-weight: 400;
}

.tree .node .label .arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.tree .node .label .arrow.has-children {
    opacity: 1;
}

.tree .node .label .arrow.no-children {
    opacity: 0.3;
    cursor: default;
}

.tree .node .label .arrow svg {
    width: 18px;
    height: 18px;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.tree .node.open .label .arrow svg {
    transform: rotate(90deg);
}

.tree .node .children {
    display: none;
    overflow: hidden;
    padding-right: 12px;
    margin-right: 12px;
    border-right: 2px solid #eef1f2;
}

.tree .node .children.open {
    display: block;
    animation: slideDown 0.3s ease forwards;
}

.tree .node .children .node {
    margin: 2px 0;
}

.tree .node .children .node .sub-category-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 8px;
    border-radius: 8px;
    text-decoration: none;
    color: #566167;
    font-size: 13px;
    transition: all 0.2s ease;
}

.tree .node .children .node .sub-category-link:hover {
    background: rgba(84, 128, 140, 0.08);
    color: var(--primary);
    transform: translateX(-4px);
}

.tree .node .children .node .sub-category-link .sub-category-icon {
    color: #b0b8bd;
    font-size: 12px;
    transition: all 0.2s ease;
}

.tree .node .children .node .sub-category-link:hover .sub-category-icon {
    color: var(--primary);
}

.tree .node .children .node .sub-category-link .sub-category-name {
    font-size: 13px;
    font-weight: 400;
    transition: all 0.2s ease;
}

.tree .node .children .node .sub-category-link:hover .sub-category-name {
    color: var(--primary);
    font-weight: 500;
}

.tree .node .children .node .sub-category-link .sub-category-name.active {
    color: var(--primary);
    font-weight: 700;
}

.tree .node .children .node .sub-category-link.active-sub {
    background: rgba(84, 128, 140, 0.08);
    color: var(--primary);
    font-weight: 600;
}

.tree .node .children .node .sub-category-link.active-sub .sub-category-name {
    font-weight: 600;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }


to {
    opacity: 1;
    transform: translateY(0);
}


}

@media (max-width: 991px) {


    .filters-mobile-container {
    display: flex !important;
    position: sticky;
    top: 0;
    z-index: 1000;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-height: 64px;
    padding: 10px 16px;
    margin: 0;
    background: rgba(255, 255, 255, 0.97);
    border-bottom: 1px solid #edf0f2;
    box-shadow: 0 3px 16px rgba(30, 45, 50, 0.05);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

    .filter-black {
        display: flex;
        align-items: center;
        gap: 8px;
        flex: 1;
        margin: 0 !important;
    }

    .icon-filter {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 9px;
        width: auto;
        min-width: 112px;
        height: 42px;
        padding: 0 15px;
        border: 1px solid rgba(84, 128, 140, 0.22);
        border-radius: 12px;
        background: #ffffff;
        color: var(--primary);
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(30, 45, 50, 0.04);
        transition:
                background-color 0.2s ease,
                border-color 0.2s ease,
                box-shadow 0.2s ease,
                transform 0.2s ease;
    }

    .icon-filter:hover {
        background: #f8fbfc;
        border-color: rgba(84, 128, 140, 0.4);
        box-shadow: 0 5px 16px rgba(30, 45, 50, 0.08);
    }

    .icon-filter:active {
        transform: scale(0.97);
    }

    .icon-filter .aside-toggler-m {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 18px;
        height: 18px;
        margin: 0 !important;
        flex-shrink: 0;
    }

    .icon-filter .aside-toggler-m path {
        fill: var(--primary);
    }

    .icon-filter .title-filters {
        margin: 0;
        color: #263238 !important;
        font-size: 13px !important;
        font-weight: 600 !important;
        line-height: 1;
        white-space: nowrap;
    }

    .icon-filter:hover .title-filters {
        color: var(--primary) !important;
    }

    .delete-filters {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
        flex: 0 0 42px;
        margin: 0 !important;
        border: 1px solid #eceff1;
        border-radius: 12px;
        background: #ffffff;
        color: #8d989d;
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(30, 45, 50, 0.03);
        transition:
                background-color 0.2s ease,
                border-color 0.2s ease,
                color 0.2s ease,
                transform 0.2s ease,
                box-shadow 0.2s ease;
    }

    .delete-filters:hover {
        color: #d64545;
        border-color: rgba(214, 69, 69, 0.25);
        background: #fff8f8;
        box-shadow: 0 4px 12px rgba(214, 69, 69, 0.08);
    }

    .delete-filters:active {
        transform: scale(0.95);
    }

    .delete-filters svg {
        width: 18px !important;
        height: 18px !important;
    }

    .delete-filters svg path {
        fill: currentColor;
    }

    .sort-container-mobile {
        display: flex !important;
        align-items: center;
        justify-content: flex-end;
        gap: 0;
        flex-shrink: 0;
        margin: 0 !important;
    }

    .filter-mostAds {
        display: none !important;
    }

    .sorting-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: auto;
        min-width: 108px;
        height: 42px;
        padding: 0 13px;
        border: 1px solid #eceff1;
        border-radius: 12px;
        background: #ffffff;
        color: var(--primary);
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(30, 45, 50, 0.03);
        transition:
                background-color 0.2s ease,
                border-color 0.2s ease,
                color 0.2s ease,
                transform 0.2s ease,
                box-shadow 0.2s ease;
    }

    .sorting-icon::after {
        content: "مرتب‌سازی";
        display: inline-block;
        color: #263238;
        font-size: 13px;
        font-weight: 600;
        line-height: 1;
        white-space: nowrap;
    }

    .sorting-icon:hover {
        background: #f8fbfc;
        border-color: rgba(84, 128, 140, 0.35);
        box-shadow: 0 4px 14px rgba(30, 45, 50, 0.07);
    }

    .sorting-icon:hover::after {
        color: var(--primary);
    }

    .sorting-icon:active {
        transform: scale(0.97);
    }

    .sorting-icon svg {
        width: 17px;
        height: 18px;
        flex-shrink: 0;
    }

    .sorting-icon svg path {
        fill: var(--primary);
    }

    .aside-container {
        position: fixed;
        right: 0;
        left: 0;
        top: auto;
        bottom: 0;
        z-index: 99999;
        display: none;
        width: 100%;
        max-height: 86vh;
        padding: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        background: #ffffff;
        border-radius: 22px 22px 0 0;
        box-shadow: 0 -8px 35px rgba(20, 35, 40, 0.13);
    }

    .aside-container::before {
        content: "";
        display: block;
        width: 42px;
        height: 4px;
        margin: 10px auto 4px;
        border-radius: 10px;
        background: #dfe4e6;
    }

    .aside-container.active {
        display: block !important;
        animation: filterSheetIn 0.25s ease-out forwards;
    }

    @keyframes filterSheetIn {
        from {
            opacity: 0;
            transform: translateY(18px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .aside-container .sidebar {
        width: 100%;
    }

    #filterAccordion {
        position: static;
        display: block;
        max-height: none;
        padding: 14px 16px 24px;
        border-radius: 0;
        box-shadow: none;
    }

    #filterAccordion .accordion-header {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 12px;
        color: #263238;
    }

    #filterAccordion > hr {
        margin-top: 14px !important;
        margin-bottom: 14px !important;
        border-color: #edf0f2;
        opacity: 1;
    }

    #filterAccordion .tree {
        margin: 0.5rem 0 !important;
    }

    #filterAccordion .tree .node .label {
        padding: 9px 10px;
    }

    #submitFilters {
        width: 100%;
        min-height: 46px;
        margin-top: 4px;
        border-radius: 12px;
    }

    .empty-filters {
        display: none;
    }

    .displayNon {
        display: none !important;
    }

    .sort-bar {
        display: flex;
        align-items: center;
        flex-wrap: nowrap;
        gap: 4px;
        width: 100%;
        padding: 8px 4px;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .sort-bar::-webkit-scrollbar {
        display: none;
    }

    .sort-bar > svg {
        flex: 0 0 auto;
    }

    .sort-bar .sort {
        flex: 0 0 auto;
        margin-left: 0 !important;
        padding: 6px 9px;
        border-radius: 8px;
        font-size: 0.78rem !important;
        line-height: 1;
        white-space: nowrap;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .sort-bar .sort.activeSort {
        background: rgba(84, 128, 140, 0.1);
        color: var(--primary);
        font-weight: 700;
    }

    .product-grid-mobile {
        margin-right: -4px;
        margin-left: -4px;
    }

    .product-grid-mobile > .col-6 {
        padding-right: 6px;
        padding-left: 6px;
    }

    .product-card .card-img {
        border-radius: 12px !important;
    }

    .product-card .col-12.align-items-end {
        padding: 10px !important;
    }

    .product-title {
        display: -webkit-box;
        overflow: hidden;
        font-size: 0.8rem;
        line-height: 1.4;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    .installment-badge span {
        padding: 2px 6px;
        font-size: 0.65rem;
    }

    .color-dot {
        width: 12px !important;
        height: 12px !important;
    }

    .mony {
        font-size: 0.9rem;
        font-weight: 700;
    }

    .pageNumber {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border-radius: 8px;
        font-size: 13px;
    }

    .pageNumber svg {
        width: 18px;
        height: 18px;
    }

    .container.my-3 {
        padding-right: 8px;
        padding-left: 8px;
    }


}

@media (min-width: 992px) {


    .filters-mobile-container {
    display: none !important;
}

    .sort-container-mobile {
        display: none !important;
    }

    .aside-container {
        display: block;
        padding-top: 8px;
    }

    .aside-container .sidebar {
        border-radius: 18px;
    }

    #filterAccordion {
        padding-top: 10px;
    }


}

@media (max-width: 767px) {


    .filters-mobile-container {
    min-height: 60px;
    padding: 9px 12px;
}

    .filter-black {
        gap: 6px;
    }

    .icon-filter {
        min-width: 104px;
        height: 41px;
        padding: 0 13px;
    }

    .delete-filters {
        width: 41px;
        height: 41px;
        flex-basis: 41px;
    }

    .sorting-icon {
        min-width: 104px;
        height: 41px;
    }

    .sort-bar {
        padding-right: 2px;
        padding-left: 2px;
    }


}

@media (max-width: 480px) {


    .filters-mobile-container {
    min-height: 58px;
    padding: 8px 10px;
    gap: 8px;
}

    .filter-black {
        gap: 6px;
    }

    .icon-filter {
        min-width: 98px;
        height: 40px;
        padding: 0 12px;
        gap: 7px;
        border-radius: 11px;
    }

    .icon-filter .title-filters {
        font-size: 12px !important;
    }

    .icon-filter .aside-toggler-m {
        width: 17px;
        height: 17px;
    }

    .delete-filters {
        width: 40px;
        height: 40px;
        flex-basis: 40px;
        border-radius: 11px;
    }

    .delete-filters svg {
        width: 17px !important;
        height: 17px !important;
    }

    .sorting-icon {
        min-width: 98px;
        height: 40px;
        padding: 0 11px;
        gap: 7px;
        border-radius: 11px;
    }

    .sorting-icon::after {
        font-size: 12px;
    }

    .sorting-icon svg {
        width: 16px;
        height: 17px;
    }

    .aside-container {
        max-height: 88vh;
        border-radius: 20px 20px 0 0;
    }

    #filterAccordion {
        padding-right: 12px;
        padding-left: 12px;
    }

    .sort-bar .sort {
        padding: 6px 7px;
        font-size: 0.72rem !important;
    }

    .product-grid-mobile {
        margin-right: -3px;
        margin-left: -3px;
    }

    .product-grid-mobile > .col-6 {
        padding-right: 5px;
        padding-left: 5px;
    }

    .product-card .col-12.align-items-end {
        padding: 8px !important;
    }

    .installment-badge span {
        padding: 1px 5px;
        font-size: 0.6rem;
    }

    .mony {
        font-size: 0.8rem;
    }

    .pageNumber {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .container.my-3 {
        padding-right: 6px !important;
        padding-left: 6px !important;
    }

}


/* ===== Sort Bar ===== */
.sort-bar {
    gap: 12px;
    padding: 8px 0;
}

.sort-label {
    gap: 6px;
    color: #6b7280;
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
}

.sort-options {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.sort-option {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 6px 14px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    line-height: 1.4;
}

.sort-option:hover {
    background: #f3f4f6;
    color: #111827;
}

.sort-option.active {
    background: var(--primary, #54808C);
    color: #fff;
    border-color: var(--primary, #54808C);
    box-shadow: 0 2px 8px rgba(84, 128, 140, 0.25);
}

.sort-option.active:hover {
    background: var(--primary, #54808C);
    color: #fff;
    filter: brightness(1.05);
}

/* موبایل */
@media (max-width: 576px) {
    .sort-bar {
        gap: 8px;
    }
    .sort-label {
        font-size: 0.85rem;
        width: 100%;
        margin-bottom: 4px;
    }
    .sort-options {
        width: 100%;
        gap: 6px;
    }
    .sort-option {
        flex: 1;
        text-align: center;
        padding: 8px 6px;
        font-size: 0.82rem;
    }
}
