/* استایل برای والدها و فرزندها */
.parent-term-container {
    margin-bottom: 5px;
}

.parent-term {
    font-weight: bold;
    padding: 8px 15px;
    color: #333;
    cursor: default;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.parent-term.has-children {
    cursor: pointer;
}

.parent-term.has-children:hover {
    background-color: #e5e5e5;
}

.toggle-children {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

.toggle-children.rotated {
    transform: rotate(90deg);
}

.children-container {
    padding-right: 15px;
    display: none;
}

.child-term {
    padding: 0.5rem 1rem;
    color: #555;
    background-color: #fff;
    font-weight: normal;
}

.child-term:hover {
    background-color: #f9f9f9;
}

.back-button {
    margin-bottom: 0.5rem;
    text-align: right;
    height: 40px; /* ارتفاع ثابت برای دکمه بازگشت */
}

.back-button button {
    background: #f3f4f6;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'IranYekan', sans-serif;
}

.back-button button:hover {
    background: #e5e7eb;
}

/* بقیه استایل‌ها */
.nida-term-search-box {
    display: flex;
    flex-grow: 1;
    min-width: 0;
    gap: 16px;
}

.found-adforest-heading {
    width: 100%;
    display: flex;
    flex-wrap: nowrap;
    gap: 16px;
    align-items: center;
}

.nida-term-search-box svg {
    width: 24px;
    height: auto;
}

/* منوی شهر */
.nav-bar__city-button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    flex-shrink: 0;
    white-space: nowrap;
    height: 100%;
}

.nav-bar__city-button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.dropdown {
    flex-shrink: 0;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    width: 430px !important;
    background: #ffffff;
    color: #1a202c;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 1rem;
    z-index: 100;
    opacity: 0;
    transform: translateY(15px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.dropdown.active .dropdown-content {
    display: block;
    opacity: 1;
    transform: translateY(5px);
}

.city-search, .category-search {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.9rem;
    text-align: right;
    margin-bottom: 0.5rem; /* کاهش فاصله برای هماهنگی با دکمه بازگشت */
    outline: none;
    font-family: 'IranYekan', sans-serif;
    height: 40px; /* ارتفاع ثابت برای فیلد جستجو */
}

.city-search:focus, .category-search:focus {
    border-color: #b81d37;
}

.city-list, .category-list {
    max-height: calc(508px - 80px); /* کسر فضای فیلد جستجو (40px) و دکمه بازگشت (40px) */
    overflow-y: auto;
    padding-right: 0.5rem;
}

.city-list.active-back, .category-list.active-back {
    max-height: calc(508px - 120px); /* کسر فضای فیلد جستجو (40px) و دکمه بازگشت (40px) + فاصله اضافی */
}

.dropdown-item {
    padding: 0.75rem 1rem;
    color: #1a202c;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
    font-family: 'IranYekan', sans-serif;
}

.dropdown-item:hover {
    background-color: #f3f4f6;
}

.dropdown-item i {
    color: #b81d37;
}

.popular-cities h3 {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 0.75rem;
    font-family: 'IranYekan', sans-serif;
}

.popular-cities-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.popular-city {
    background: #f3f4f6;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    font-family: 'IranYekan', sans-serif;
}

.popular-city:hover {
    background: #e5e7eb;
}

/* نوار جستجو - طراحی جدید و زیباتر */
.search-bar {
    flex: 1;
    flex-grow: 1;
    min-width: 0;
    position: relative;
    width: 100%;
    max-width: 600px;
    transition: all 0.3s ease;
}

.search-bar input {
    width: 100%;
    padding: 0.85rem 1rem 0.85rem 45px;
    border-radius: 10px;
    font-size: 0.95rem;
    text-align: right;
    background: rgba(255, 255, 255, 0.95);
    color: #1a202c;
    outline: none;
    font-family: 'IranYekan', sans-serif;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.search-bar input:focus {
    box-shadow: 0 4px 12px rgba(184, 29, 55, 0.2);
    border-color: rgba(184, 29, 55, 0.3);
    background: white;
}

.search-bar i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #b81d37;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.search-bar input:focus + i {
    color: #001c4e;
    transform: translateY(-50%) scale(1.1);
}

/* نتایج جستجوی زنده - طراحی جدید */
.search-suggestions {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    width: 100%;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: 10px 0;
}

.search-suggestions.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.suggestion-item {
    position: relative;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    font-family: 'IranYekan', sans-serif;
    font-size: 0.95rem;
    color: #333;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background-color: #f8f9fa;
}

.suggestion-item i {
    margin-left: 10px;
    color: #b81d37;
    font-size: 0.9rem;
}

.suggestion-item strong {
    color: #b81d37;
    font-weight: bold;
}

.suggestion-item span.count-ad {
    position: absolute;
    left: 16px;
    top: 16px;
    font-size: 12px;
    color: #7c7c7c;
}

.suggestion-category {
    display: block;
    font-size: 0.8rem;
    color: #666;
    margin-top: 3px;
}

.no-results {
    padding: 1rem;
    text-align: center;
    color: #666;
    font-family: 'IranYekan', sans-serif;
}

/* انیمیشن برای پیشنهادات */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1024px) {
    .nav-bar__menu {
        display: none;
    }

    .hamburger-menu {
        display: block;
    }

    .search-bar {
        flex: 1;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .nav-bar__content {
        padding: 0 0.5rem;
        gap: 0.5rem;
    }

    .nav-bar__city-button {
        font-size: 0.85rem;
        padding: 0.4rem 0.6rem;
    }

    .search-bar input {
        font-size: 0.85rem;
        padding: 0.6rem 0.8rem 0.6rem 35px;
    }

    .search-bar i {
        left: 10px;
        font-size: 1rem;
    }

    .dropdown-content {
        width: 100%;
        max-width: 344px;
    }

    .suggestion-item {
        padding: 0.7rem 1rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .nav-bar__content {
        flex-wrap: wrap;
        padding: 0.5rem;
    }

    .search-bar {
        order: 1;
        margin-top: 0.5rem;
        width: 100%;
    }

    .nav-bar__city-button {
        justify-content: center;
    }

    .nav-bar__logo {
        order: 2;
    }

    .hamburger-menu {
        order: 3;
    }

    .dropdown-content {
        width: 100%;
        max-width: 344px;
    }

    .search-suggestions {
        max-height: 300px;
    }
}

/* استایل‌های جدید برای بخش دسته‌بندی */
#categoryDropdown {
    flex-shrink: 0;
}

/* استایل برای دکمه دسته‌بندی */
#categoryButton {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 18px;
    transition: all 0.3s ease;
    flex-shrink: 0;
    white-space: nowrap;
    height: 100%;
}

#categoryButton:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* تنظیمات ریسپانسیو */
@media (max-width: 768px) {
    .nida-term-search-box {
        flex-wrap: wrap;
    }

    #categoryDropdown, #cityDropdown {
        width: 100%;
        margin-bottom: 8px;
    }

    .search-bar {
        order: 3;
        width: 100%;
    }
}

@media (max-width: 480px) {
    #categoryButton, #cityButton {
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
    }

    .category-search, .city-search {
        padding: 0.6rem;
        font-size: 0.8rem;
    }

    .dropdown-content {
        width: 100%;
        max-width: 100%;
    }
}

/* استایل‌های جدید برای چک‌باکس‌ها و آیتم‌های انتخاب شده */
.category-checkbox, .city-checkbox {
    margin-left: 8px;
}

.selected-categories-list, .selected-cities-list {
    max-height: 120px;
    overflow-y: auto;
    margin-bottom: 10px;
}

.selected-item {
    display: inline-flex;
    align-items: center;
    background: #f3f4f6;
    padding: 4px 8px;
    border-radius: 4px;
    margin: 4px;
    font-size: 0.85rem;
}

.remove-selected {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    margin-right: 4px;
    font-size: 1.1rem;
    line-height: 1;
}

.remove-selected:hover {
    color: #dc2626;
}

/* استایل برای دکمه اعمال فیلتر */
#applyFilters {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    margin: 0;
}

#applyFilters:hover {
    background: #9f1d35 !important;
}