.attribute-filter-container {
    position: relative;
}

.attribute-filter-wrapper {
    position: relative;
}

.attribute-filter-label {
    margin-bottom: 10px;
}

.attribute-filter-search-wrapper {
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

.attribute-filter-search {
    width: 100%;
    box-sizing: border-box;
    outline: none;
    border: none;
}

.attribute-filter-search-icon {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
}

.attribute-filter-search-icon img {
    display: block;
}

.attribute-filter-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 10px;
}

.attribute-filter-group {
    margin-bottom: 15px;
}

.attribute-filter-group-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 0 0 8px 0;
    padding: 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.attribute-filter-item {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.attribute-filter-checkbox {
    margin-left: 10px;
    width: 16px;
    height: 16px;
    border: 1px solid #ddd;
    border-radius: 3px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
}

.attribute-filter-checkbox:checked {
    background-color: #6f4efd;
    border-color: #6f4efd;
    position: relative;
}

.attribute-filter-checkbox:checked::after {
    content: '\2713'; /* علامت تیک */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 12px;
    font-weight: bold;
}

.attribute-filter-apply {
    width: 100%;
    border: none;
    cursor: pointer;
    outline: none;
}

.pym-attribute-filter-desktop-only {
    display: block;
}

.pym-attribute-filter-mobile-only {
    display: none;
}

@media (max-width: 767px) {
    .pym-attribute-filter-desktop-only {
        display: none;
    }
    .pym-attribute-filter-mobile-only {
        display: block;
    }
    
    .attribute-filter-list {
        max-height: 250px;
    }
    
    .attribute-filter-group-title {
        font-size: 13px;
    }
}

/* استایل‌های پاپ‌آپ موبایل */
.attribute-filter-mobile-popup-container {
    position: relative;
}

/* Mobile trigger display fix */
@media (max-width: 767px) {
    .attribute-filter-mobile-trigger {
        display: flex !important;
    }
    
    .attribute-filter-popup-clear {
        align-items: center !important;
        display: flex !important;
    }
    
    .attribute-filter-popup-back {
        display: flex !important;
    }
}

.attribute-filter-mobile-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.attribute-filter-mobile-trigger:hover {
    border-color: #6f4efd;
    box-shadow: 0 2px 8px rgba(111, 78, 253, 0.1);
}

.attribute-filter-mobile-trigger .trigger-text {
    flex: 1;
    text-align: right;
}

.attribute-filter-mobile-trigger .trigger-icon {
    display: flex;
    align-items: center;
    margin-right: 8px;
    transition: transform 0.3s ease;
}

.attribute-filter-mobile-trigger.active .trigger-icon {
    transform: rotate(180deg);
}

.attribute-filter-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.attribute-filter-popup-content {
    background: #ffffff;
    border-radius: 16px 16px 0 0;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUpFromBottom 0.3s ease-out;
}

@keyframes slideUpFromBottom {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.attribute-filter-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #eee;
    background: #ffffff;
}

.attribute-filter-popup-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.attribute-filter-popup-header-right {
    display: flex;
    align-items: center;
}

.attribute-filter-popup-back {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 0;
    border-radius: 0;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
}

.attribute-filter-popup-back:hover {
    background: none;
    color: #333;
}

.attribute-filter-popup-back img {
    width: 20px;
    height: 20px;
}

.attribute-filter-popup-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    flex: 1;
}

.attribute-filter-popup-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #666;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.attribute-filter-popup-close:hover {
    background-color: #f5f5f5;
    color: #333;
}

.attribute-filter-popup-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    max-height: calc(80vh - 140px);
}

.attribute-filter-popup-footer {
    display: flex;
    padding: 20px;
    border-top: 1px solid #eee;
    background: #ffffff;
}

.attribute-filter-popup-clear {
    background: #ff4757 !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 8px 16px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
}

.attribute-filter-popup-clear:hover {
    background: #ff3742 !important;
    box-shadow: 0 6px 12px rgba(255, 71, 87, 0.4) !important;
    transform: translateY(-2px) !important;
}

.attribute-filter-popup-clear:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 4px rgba(255, 71, 87, 0.3) !important;
}

.attribute-filter-popup-clear img {
    width: 18px !important;
    height: 18px !important;
    filter: brightness(0) invert(1) !important;
}

.attribute-filter-popup-clear span,
.attribute-filter-popup-clear .clear-text {
    color: #ffffff !important;
    font-size: 16px;
    font-weight: 700;
}

.attribute-filter-popup-footer .attribute-filter-apply {
    flex: 1;
    margin: 0;
}

/* تنظیمات عمومی برای موبایل */
@media (max-width: 767px) {
    .attribute-filter-mobile-popup .attribute-filter-list {
        max-height: none;
    }
    
    .attribute-filter-popup-body .attribute-filter-search-wrapper {
        margin-bottom: 16px;
    }
    
    .attribute-filter-popup-body .attribute-filter-item {
        padding: 8px 0;
    }
    
    .attribute-filter-popup-body .attribute-filter-item:last-child {
        border-bottom: none;
    }
    
    .attribute-filter-popup-body .attribute-filter-group {
        margin-bottom: 20px;
    }
    
    .attribute-filter-popup-body .attribute-filter-group-title {
        font-size: 16px;
        font-weight: 600;
        color: #333;
        margin-bottom: 12px;
        padding-bottom: 8px;
    }
    
    /* نمایش خط جداکننده وقتی فعال است */
    .attribute-group-border-yes .attribute-filter-popup-body .attribute-filter-group-title {
        border-bottom-style: solid !important;
    }
    
    /* مخفی کردن خط جداکننده وقتی غیرفعال است */
    .attribute-group-border- .attribute-filter-popup-body .attribute-filter-group-title {
        border-bottom: none !important;
    }
}

/* استایل‌های پاپ‌آپ تبلت */
@media (min-width: 768px) and (max-width: 1024px) {
    .attribute-filter-tablet-trigger {
        display: flex !important;
        width: 100%;
        align-items: center;
        justify-content: space-between;
        background: #ffffff;
        border: 1px solid #ddd;
        border-radius: 8px;
        padding: 12px 16px;
        font-size: 14px;
        font-weight: 500;
        color: #333;
        cursor: pointer;
        transition: all 0.3s ease;
        outline: none;
    }
    
    .attribute-filter-tablet-trigger:hover {
        border-color: #6f4efd;
        box-shadow: 0 2px 8px rgba(111, 78, 253, 0.1);
    }
    
    .attribute-filter-tablet-trigger .trigger-text {
        flex: 1;
        text-align: right;
    }
    
    .attribute-filter-tablet-trigger .trigger-icon {
        display: flex;
        align-items: center;
        margin-right: 8px;
        transition: transform 0.3s ease;
    }
    
    .attribute-filter-tablet-trigger.active .trigger-icon {
        transform: rotate(180deg);
    }
    
    /* پاپ‌آپ تبلت - bottom fixed */
    .pym-attribute-filter-tablet-popup .attribute-filter-popup-overlay {
        align-items: flex-end;
    }
    
    .pym-attribute-filter-tablet-popup .attribute-filter-popup-content {
        width: 100%;
        max-width: 600px;
        margin: 0 auto;
        border-radius: 16px 16px 0 0;
        animation: slideUpFromBottom 0.3s ease-out;
    }
}

/* استایل‌های پاپ‌آپ دسکتاپ */
@media (min-width: 1025px) {
    .attribute-filter-desktop-trigger {
        display: flex !important;
        width: 100%;
        align-items: center;
        justify-content: space-between;
        background: #ffffff;
        border: 1px solid #ddd;
        border-radius: 8px;
        padding: 12px 16px;
        font-size: 14px;
        font-weight: 500;
        color: #333;
        cursor: pointer;
        transition: all 0.3s ease;
        outline: none;
    }
    
    .attribute-filter-desktop-trigger:hover {
        border-color: #6f4efd;
        box-shadow: 0 2px 8px rgba(111, 78, 253, 0.1);
    }
    
    .attribute-filter-desktop-trigger .trigger-text {
        flex: 1;
        text-align: right;
    }
    
    .attribute-filter-desktop-trigger .trigger-icon {
        display: flex;
        align-items: center;
        margin-right: 8px;
        transition: transform 0.3s ease;
    }
    
    .attribute-filter-desktop-trigger.active .trigger-icon {
        transform: rotate(180deg);
    }
    
    /* پاپ‌آپ دسکتاپ - centered modal */
    .pym-attribute-filter-desktop-popup .attribute-filter-popup-overlay {
        align-items: center;
        justify-content: center;
    }
    
    .pym-attribute-filter-desktop-popup .attribute-filter-popup-content {
        width: 90%;
        max-width: 500px;
        max-height: 70vh;
        border-radius: 16px;
        animation: fadeInScale 0.3s ease-out;
    }
}

/* انیمیشن برای پاپ‌آپ دسکتاپ */
@keyframes fadeInScale {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* مخفی کردن دکمه‌های تریگر در دستگاه‌های مختلف */
.attribute-filter-mobile-trigger {
    display: none;
}

.attribute-filter-tablet-trigger {
    display: none;
}

.attribute-filter-desktop-trigger {
    display: none;
}

/* نمایش دکمه‌های تریگر در دستگاه‌های مناسب */
@media (max-width: 767px) {
    .pym-attribute-filter-mobile-popup .attribute-filter-mobile-trigger {
        display: flex !important;
    }
}

@media (min-width: 768px) and (max-width: 1024px) {
    .pym-attribute-filter-tablet-popup .attribute-filter-tablet-trigger {
        display: flex !important;
    }
}

@media (min-width: 1025px) {
    .pym-attribute-filter-desktop-popup .attribute-filter-desktop-trigger {
        display: flex !important;
    }
}

/* استایل‌های عمومی برای همه پاپ‌آپ‌ها */
.attribute-filter-popup-container {
    position: relative;
}

.attribute-filter-trigger {
    outline: none;
    box-sizing: border-box;
}

.attribute-filter-trigger:focus {
    outline: 2px solid #6f4efd;
    outline-offset: 2px;
}

/* بهبود نمایش در حالت RTL */
[dir="rtl"] .attribute-filter-trigger .trigger-text {
    text-align: right;
}

[dir="rtl"] .attribute-filter-trigger .trigger-icon {
    margin-left: 8px;
    margin-right: 0;
}

/* استایل‌های اضافی برای positioning پاپ‌آپ‌های مختلف */
.attribute-filter-popup-overlay.popup-mobile {
    align-items: flex-end;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.attribute-filter-popup-overlay.popup-tablet {
    align-items: flex-end;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.attribute-filter-popup-overlay.popup-desktop {
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.attribute-filter-popup-overlay.popup-mobile .attribute-filter-popup-content {
    border-radius: 16px 16px 0 0;
    animation: slideUpFromBottom 0.3s ease-out;
}

.attribute-filter-popup-overlay.popup-tablet .attribute-filter-popup-content {
    border-radius: 16px 16px 0 0;
    animation: slideUpFromBottom 0.3s ease-out;
    max-width: 600px;
    margin: 0 auto;
}

.attribute-filter-popup-overlay.popup-desktop .attribute-filter-popup-content {
    border-radius: 16px;
    animation: fadeInScale 0.3s ease-out;
    width: 90%;
    max-width: 500px;
    max-height: 70vh;
}

/* استایل‌های کانتینر فیلترهای فعال در دکمه */
.attribute-filter-button-active-filters {
    background-color: #EFF0F5;
    border: none;
    border-radius: 0 0 4px 4px;
    margin-top: -5px;
    padding: 8px 12px;
}

.attribute-filter-button-active-filters-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.attribute-filter-button-active-filter-item {
    display: flex;
    align-items: center;
    background-color: #ffffff;
    border: 1px solid var( --e-global-color-secondary );
    border-radius: 12px;
    padding: 2px 3px 2px 10px;
    font-size: 12px;
    color: var( --e-global-color-secondary );
    transition: all 0.2s ease;
    cursor: pointer;
}

.attribute-filter-button-active-filter-item:hover {
    background-color: #f0f0f0;
    border-color: #cccccc;
    transform: translateY(-1px);
}

.attribute-filter-button-active-filter-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    margin-left: 6px;
    border-radius: 50%;
    background-color: transparent;
    color: #666666;
    cursor: pointer;
    transition: color 0.2s ease;
}

.attribute-filter-button-active-filter-remove:hover {
    color: #ff4444;
}

.attribute-filter-button-active-filter-name {
    font-weight: 500;
    white-space: nowrap;
}

/* استایل‌های فیلترهای فعال در کانتینر دکمه در حالت دارک مود */
.elementor-widget-theme-dark .attribute-filter-button-active-filters {
    background-color: #2a2a2a;
    border-color: #444444;
}

.elementor-widget-theme-dark .attribute-filter-button-active-filter-item {
    background-color: #333333;
    border-color: #555555;
    color: #ffffff;
}

.elementor-widget-theme-dark .attribute-filter-button-active-filter-item:hover {
    background-color: #444444;
    border-color: #666666;
}

.elementor-widget-theme-dark .attribute-filter-button-active-filter-remove {
    color: #aaaaaa;
}

.elementor-widget-theme-dark .attribute-filter-button-active-filter-remove:hover {
    color: #ff6666;
}

/* استایل‌های ریسپانسیو برای فیلترهای فعال در کانتینر دکمه */
@media (max-width: 768px) {
    .attribute-filter-button-active-filters {
        margin-top: 6px;
        padding: 6px 10px;
    }
    
    .attribute-filter-button-active-filters-list {
        gap: 4px;
    }
    
    .attribute-filter-button-active-filter-item {
        font-size: 11px;
        padding: 2px 4px;
    }
    
    .attribute-filter-button-active-filter-remove {
        width: 12px;
        height: 12px;
        margin-right: 3px;
        margin-left: 0;
    }
}

@media (max-width: 480px) {
    .attribute-filter-button-active-filters {
        margin-top: 4px;
        padding: 4px 8px;
    }
    
    .attribute-filter-button-active-filter-item {
        font-size: 10px;
        padding: 1px 3px;
    }
}

/* استایل‌های RTL برای فیلترهای فعال در دکمه‌ها */
[dir="rtl"] .attribute-filter-button-active-filter-remove {
    margin-left: 0;
    margin-right: 6px;
}

[dir="rtl"] .attribute-filter-button-active-filters-list {
    direction: rtl;
}

/* استایل‌های کانتینر فیلترهای انتخاب شده اصلی */
.selected-filters-container {
    margin-top: 16px;
    padding: 12px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.selected-filters-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.selected-filter-item {
    display: inline-flex;
    align-items: center;
    background-color: #007cba;
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.4;
    cursor: pointer;
    transition: all 0.2s ease;
}

.selected-filter-item:hover {
    background-color: #005a87;
    transform: translateY(-1px);
}

.selected-filter-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 6px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.selected-filter-remove:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.selected-filter-remove svg {
    width: 10px;
    height: 10px;
    color: #ffffff;
}

.selected-filter-name {
    font-weight: 500;
}

/* استایل‌های RTL برای فیلترهای انتخاب شده */
[dir="rtl"] .selected-filter-remove {
    margin-left: 0;
    margin-right: 6px;
}

/* استایل‌های موبایل برای فیلترهای انتخاب شده */
@media (max-width: 767px) {
    .selected-filters-container {
        padding: 8px;
        margin-top: 12px;
        background-color: #ffffff;
        border-radius: 8px;
        border: none;
    }
    
    .selected-filter-item {
        display: flex;
        align-items: center;
        background-color: #ffffff;
        border: 1px solid var(--e-global-color-secondary);
        border-radius: 12px;
        padding: 2px 3px 2px 10px;
        font-size: 12px;
        color: var(--e-global-color-secondary);
        transition: all 0.2s ease;
        cursor: pointer;
    }
    
    .selected-filter-item:hover {
        background-color: var(--e-global-color-secondary);
        color: #ffffff;
        transform: translateY(-1px);
    }
    
    .selected-filter-remove {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 16px;
        height: 16px;
        margin-left: 4px !important;
        background-color: transparent;
        border-radius: 50%;
        cursor: pointer;
        transition: all 0.2s ease;
        border:1px solid var(--e-global-color-secondary);
    }
    
    .selected-filter-remove:hover {
        background-color: rgba(0, 0, 0, 0.1);
    }
    
    .selected-filter-remove svg {
        width: 8px;
        height: 8px;
        color: var(--e-global-color-secondary);
    }
    
    .selected-filter-item:hover .selected-filter-remove svg {
        color: #ffffff;
    }
    
    .selected-filter-name {
        font-weight: 500;
    }
}

/* استایل‌های تبلت برای فیلترهای انتخاب شده */
@media (min-width: 768px) and (max-width: 1023px) {
    .selected-filters-container {
        padding: 10px;
        margin-top: 14px;
        background-color: #ffffff;
        border-radius: 8px;
        border: none;
    }
    
    .selected-filter-item {
        display: flex;
        align-items: center;
        background-color: #ffffff;
        border: 1px solid var(--e-global-color-secondary);
        border-radius: 12px;
        padding: 2px 3px 2px 10px;
        font-size: 13px;
        color: var(--e-global-color-secondary);
        transition: all 0.2s ease;
        cursor: pointer;
    }
    
    .selected-filter-item:hover {
        background-color: var(--e-global-color-secondary);
        color: #ffffff;
        transform: translateY(-1px);
    }
    
    .selected-filter-remove {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 17px;
        height: 17px;
        margin-left: 5px;
        background-color: transparent;
        border-radius: 50%;
        cursor: pointer;
        transition: all 0.2s ease;
    }
    
    .selected-filter-remove:hover {
        background-color: rgba(0, 0, 0, 0.1);
    }
    
    .selected-filter-remove svg {
        width: 9px;
        height: 9px;
        color: var(--e-global-color-secondary);
    }
    
    .selected-filter-item:hover .selected-filter-remove svg {
        color: #ffffff;
    }
    
    .selected-filter-name {
        font-weight: 500;
    }
}