@keyframes blink {
  0% {
    opacity: 0.3;  /* کم رنگ */
  }
  50% {
    opacity: 1;    /* پر رنگ */
  }
  100% {
    opacity: 0.3;  /* کم رنگ */
  }
}
.blinking {
  animation: blink 2s infinite;
}
.special-tag {
      position: absolute;
      bottom: 10px;
      left: 3px;
    }
.filter-content {
    transition: all 0.3s ease;
}

@media (max-width: 767.98px) {
    .filter-content {
        position: fixed;
        top: 0;
        right: -100%;
        width: 85%;
        height: 100vh;
        background: white;
        z-index: 1050;
        overflow-y: hidden;
        padding: 0;
        box-shadow: -5px 0 15px rgba(0,0,0,0.1);
        display: flex;
    }
    
    .filter-content.show {
        right: 0;
    }
    
    .filter-container {
        height: 100%;
        width: 100%;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }
    
    .filter-scroll-area {
        max-height: calc(100vh - 200px);
        overflow-y: auto;
    }
    
    .filter-footer {
        padding: 15px;
        margin-top: auto;
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
    }
}

@media (min-width: 768px) {
    .filter-container {
        height: calc(100vh - 30px);
        position: sticky;
        top: 15px;
        display: flex;
        flex-direction: column;
    }
    
    .filter-scroll-area {
        flex: 1;
        overflow-y: auto;
        max-height: calc(100vh - 210px); /* کاهش ارتفاع برای نمایش بهتر دکمه */
        padding-bottom: 20px; /* افزایش فاصله از پایین */
    }
    
    .filter-footer {
        margin-top: auto;
        margin-bottom: 60px; /* اضافه کردن فاصله از پایین برای منوی ثابت */
    }
    
    .apply-filters {
        transition: all 0.2s ease;
    }
    
    .apply-filters:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    }
}

@media (max-width: 767.98px) {
    .filter-footer {
        position: sticky;
        bottom: 70px; /* اضافه کردن فاصله از پایین برای منوی ثابت */
        left: 0;
        right: 0;
        padding: 15px;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    }
    
    #load_data_message {
        padding-bottom: 70px; /* افزایش فاصله از پایین برای اسپینر لودینگ */
    }
}

/* استایل‌های لودینگ بهبود یافته */
#load_data_message {
    margin-bottom: 70px; /* افزایش فاصله از پایین برای نمایش نشانگر لودینگ */
}

.spinner-border {
    margin-bottom: 70px; /* افزایش فاصله از پایین برای اسپینر */
}

.apply-filters {
    font-weight: bold;
    padding: 10px;
    font-size: 1rem;
}

.hover-shadow:hover {
    transform: translateY(-2px);
    transition: all 0.2s ease;
    box-shadow: 0 .5rem 1rem rgba(0,0,0,.15)!important;
}

.border-special {
    border-right: 3px solid #dc3545 !important;
}

.category-item.active {
    color: #0d6efd !important;
    font-weight: bold;
}

.sticky-md-top {
    position: sticky;
    top: 10px;
}

.filter-header {
    top: 0;
    z-index: 10;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.filter-scroll-area {
    max-height: calc(100vh - 170px);
    overflow-y: auto;
    padding-right: 5px;
    -ms-overflow-style: none;  /* Internet Explorer 10+ */
    scrollbar-width: none;  /* Firefox */
}

.filter-scroll-area::-webkit-scrollbar {
    display: none; /* Safari and Chrome */
}

.filter-label {
    font-size: 0.9rem;
}

.selected-cities .badge,
.selected-categories .badge {
    background-color: #f8f9fa;
    color: #212529;
    border: 1px solid #dee2e6;
    margin-right: 5px;
    margin-bottom: 5px;
    font-weight: normal;
    padding: 8px 12px;
    border-radius: 50px;
    display: inline-block;
}

.selected-cities .badge .close,
.selected-categories .badge .close {
    margin-right: 5px;
    font-size: 10px;
    cursor: pointer;
}

.filter-container {
    height: calc(100vh - 30px);
    position: sticky;
    top: 15px;
    display: flex;
    flex-direction: column;
}

@media (max-width: 767.98px) {
    .filter-container {
        height: 100%;
    }
}

.filter-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1040;
}

.filter-close-btn {
    font-size: 18px;
}

.selected-category .badge {
    background-color: #f8f9fa;
    color: #212529;
    border: 1px solid #dee2e6;
    margin-right: 5px;
    margin-bottom: 5px;
    font-weight: normal;
    padding: 8px 12px;
    border-radius: 50px;
    display: inline-block;
}

.selected-category .badge .close {
    margin-right: 5px;
    font-size: 10px;
    cursor: pointer;
}

.list-group-item {
    padding: 12px 15px;
    border-left: none;
    border-right: none;
}

.category-item i.fa-chevron-left {
    color: #adb5bd;
}

/* تنظیمات برای اسکرول در مودال‌ها */
.modal-body {
    max-height: 70vh;
    overflow-y: auto;
}

.province-list, .category-list {
    max-height: 70vh;
    overflow-y: auto;
}

.cities-list, .subcategory-list {
    max-height: 70vh;
    overflow-y: auto;
}

/* تنظیمات دکمه‌های فیلتر */
.filter-toggle-btn {
    margin-bottom: 5px;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    border-radius: 50px;
    min-width: calc(50% - 5px);
}

.filter-toggle-btn.active {
    background-color: #0d6efd;
    color: white;
    border-color: #0d6efd;
}

/* تنظیمات اسلایدر */
.range-slider {
    margin-top: 10px;
    padding: 0 5px;
}

.noUi-connect {
    background: #0d6efd;
}

.noUi-handle {
    border-radius: 50%;
    background: white;
    box-shadow: 0 0 0 1px #0d6efd, 0 3px 6px rgba(0, 0, 0, 0.15);
    cursor: grab;
}

.noUi-handle:active {
    cursor: grabbing;
}

.noUi-handle:before,
.noUi-handle:after {
    display: none;
}

.noUi-horizontal {
    height: 6px;
}

.noUi-horizontal .noUi-handle {
    width: 18px;
    height: 18px;
    top: -7px;
    right: -9px;
}

.filter-footer {
    border-top: 1px solid #eee;
    padding-top: 10px;
    margin-top: 15px;
    background: white;
    z-index: 10;
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.sticky-bottom {
    position: sticky;
    bottom: 0;
}

/* تنظیمات مربوط به یکسان‌سازی ارتفاع آگهی‌ها */
.card {
    display: flex;
    flex-direction: column;
}

.card-body {
    flex: 1 1 auto;
}

.ad-image-container {
    height: 180px;
    overflow: hidden;
}

.ad-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* تنظیمات برای کارت‌های بدون تصویر */
.ad-placeholder {
    height: 180px;
    background-color: #f8f9fa;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    position: relative;
    display: flex;
    flex-direction: column;
}

.ad-placeholder .card-title {
    font-size: 1.25rem;
    margin-top: 0.5rem;
}

.ad-placeholder + .card-body {
    padding-top: 0.75rem !important;
}

.text-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.card-title {
    line-height: 1.3;
    margin-bottom: 0.5rem;
    word-wrap: break-word;
}

/* تنظیمات برای نمایش موبایل */
@media (max-width: 767.98px) {
    .col-12.col-md-6.col-xl-4 {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    .row.g-3 {
        margin-left: -10px;
        margin-right: -10px;
    }
    
    .card {
        margin-bottom: 5px;
    }
    
    .card-body {
        padding: 12px !important;
    }
    
    .ad-image-container, .ad-placeholder {
        height: 160px;
    }
    
    .btn-sm {
        padding: 0.25rem 0.8rem;
        font-size: 0.75rem;
    }
    
    /* تنظیمات هدر ثابت در موبایل */
    .sticky-top {
        position: sticky;
        top: 0;
        z-index: 1020;
        padding: 10px !important;
        margin-bottom: 10px !important;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }
    
    /* تنظیمات برای نمایش بهتر جستجو و فیلتر شهر */
    .city-filter-container {
        width: auto;
        min-width: 120px;
    }
    
    /* تنظیم فاصله بین فیلدها در موبایل */
    @media (max-width: 576px) {
        .city-filter-container {
            min-width: 90px;
        }
        
        #top-select-city span {
            font-size: 0.75rem;
        }
        
        .input-group .form-control,
        .input-group .btn,
        #top-select-city {
            height: 38px;
        }
    }
    
    /* تنظیمات برای اتصال کامل جستجو و فیلتر شهر */
    .input-group .form-control {
        border-right: 0;
    }
    
    #top-select-city {
        border-left: 0;
    }
    
    /* فاصله‌گذاری برای موبایل */
    .sticky-top .mb-3 {
        margin-bottom: 8px !important;
    }
    
    /* تنظیم سایز فونت عنوان در موبایل */
    .sticky-top .h6 {
        font-size: 14px;
    }
    
    /* افزایش فاصله برای لیست آگهی‌ها از بالای صفحه */
    #ads-container {
        padding-top: 5px;
    }
}

/* ... existing styles ... */

.selected-cities .badge,
.selected-categories .badge {
    background-color: #f8f9fa;
    color: #212529;
    border: 1px solid #dee2e6;
    margin-right: 5px;
    margin-bottom: 5px;
    font-weight: normal;
    padding: 8px 12px;
    border-radius: 50px;
    display: inline-block;
}

.selected-cities .badge .close,
.selected-categories .badge .close {
    margin-right: 5px;
    font-size: 10px;
    cursor: pointer;
}

/* Hide checkboxes but keep functionality */
.form-check-input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.city-item, 
.subcategory-item {
    cursor: pointer;
}

.city-item.selected,
.subcategory-item.selected {
    background-color: rgba(13, 110, 253, 0.1);
    font-weight: bold;
    color: #0d6efd;
}

.city-item.selected::after,
.subcategory-item.selected::after {
    content: "\f00c";
    font-family: FontAwesome;
    display: inline-block;
    margin-left: 8px;
    float: left;
    color: #0d6efd;
}

.select-all-cities,
.select-all-subcategories {
    cursor: pointer;
    font-weight: bold;
    padding: 8px 12px;
    border-bottom: 1px solid #dee2e6;
    display: block;
    background-color: #f8f9fa;
}

.select-all-cities.selected,
.select-all-subcategories.selected {
    color: #0d6efd;
    background-color: rgba(13, 110, 253, 0.1);
}

.select-all-cities.selected::after,
.select-all-subcategories.selected::after {
    content: "\f00c";
    font-family: FontAwesome;
    display: inline-block;
    margin-left: 8px;
    float: left;
    color: #0d6efd;
}

/* Lazy loading styles */
.lazy-load {
    opacity: 0;
    transition: opacity 0.3s;
    background-color: #f8f9fa;
    min-height: 100px;
    position: relative;
}

.lazy-loaded {
    opacity: 1;
}

.lazy-loading-indicator {
    position: absolute;
    top: 50%;
    left: 10%;
    width: 80%;
    transform: translateY(-50%);
    z-index: 5;
}

/* Fix for image container sizing */
.agahi-box img.img-fluid {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

/* Fix for placeholder during loading */
.img-thumbnail {
    border: 1px solid #dee2e6;
    border-radius: .25rem;
    background-color: #f8f9fa;
}

/* ... existing styles ... */

.agahi-box {
    margin-bottom: 20px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    border-radius: 5px;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.agahi-box:hover {
    transform: translateY(-5px);
}

.agahi-box a {
    color: inherit;
    text-decoration: none;
}

.agahi-box .card-header {
    background-color: #f8f9fa;
    padding: 12px 15px;
    border-bottom: 1px solid rgba(0,0,0,0.125);
}

.agahi-box .card-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.agahi-box .card-body {
    padding: 15px;
}

.agahi-box .card-body p {
    margin-bottom: 10px;
    font-size: 14px;
}

.ads-bookmark {
    cursor: pointer;
    font-size: 18px;
}

/* ادامه استایل‌های موجود */

/* استایل لودینگ خطی */
.loading-dots {
    display: inline-block;
    position: relative;
    text-align: center;
    padding: 10px 15px;
    color: #495057;
}

.loading-dots:after {
    content: "در حال بارگیری";
}

.loading-dots:before {
    content: "";
    animation: dots 1.5s infinite;
    display: inline-block;
    width: 20px;
    text-align: left;
}

@keyframes dots {
    0% { content: ""; }
    25% { content: "."; }
    50% { content: ".."; }
    75% { content: "..."; }
    100% { content: ""; }
}

/* لودینگ خطی برای اسکرول بیشتر */
.loading-line {
    height: 4px;
    width: 100%;
    background-color: #e9ecef;
    overflow: hidden;
    position: relative;
    margin: 20px 0;
    border-radius: 4px;
}

.loading-line:before {
    content: "";
    position: absolute;
    height: 100%;
    width: 30%;
    background-color: #007bff;
    animation: loading-line 1.5s infinite ease-in-out;
    border-radius: 4px;
}

@keyframes loading-line {
    0% { left: -30%; }
    100% { left: 100%; }
}
 .badge-filter {
        background-color: #f8f9fa;
        color: #212529;
        border: 1px solid #dee2e6;
        padding: 5px 10px;
        border-radius: 20px;
        margin-right: 5px;
        margin-bottom: 5px;
        display: inline-flex;
        align-items: center;
        white-space: nowrap;
    }
    
    .badge-filter .close {
        margin-right: 5px;
        cursor: pointer;
        color: #6c757d;
        padding: 5px; /* افزایش ناحیه کلیک برای موبایل */
    }
    
    .badge-filter:hover {
        background-color: #e9ecef;
    }
    
    .filter-summary-btn {
        background-color: #e9ecef;
        border-color: #dee2e6;
        white-space: nowrap;
        display: block !important;
        margin-right: 5px;
    }
    
    @media (max-width: 767px) {
        .filter-summary-btn {
            cursor: pointer;
            display: inline-block !important;
            margin-bottom: 10px;
            font-weight: bold;
            background-color: #f8f9fa;
            border-color: #0d6efd;
            color: #0d6efd;
        }
        
        .filter-summary {
            display: block !important;
        }
        
        .filter-footer {
            padding-bottom: 30px;
            margin-bottom: 20px;
        }
        
        .filter-content.show .apply-filters {
            margin-bottom: 30px;
            position: relative;
            z-index: 1030;
        }
    }
    
    .filter-summary {
        margin-bottom: 10px;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }
    
    /* اسکرول افقی برای فیلترها */
    #active-filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 5px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        max-width: 100%;
    }
    
    /* نمایش اسکرول‌بار باریک در مرورگرهای مدرن */
    #active-filters::-webkit-scrollbar {
        height: 4px;
    }
    
    #active-filters::-webkit-scrollbar-track {
        background: #f1f1f1;
    }
    
    #active-filters::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 4px;
    }
    
    /* بهبود رابط کاربری در موبایل */
    @media (max-width: 767px) {
        .filter-toggle-btn {
            padding: 8px 12px; /* افزایش اندازه دکمه‌ها در موبایل */
            margin-bottom: 5px;
        }
        
        .badge-filter .close {
            padding: 8px; /* افزایش بیشتر ناحیه کلیک در موبایل */
        }
        
        .filter-buttons {
            margin-bottom: 10px;
        }
        
        .filter-scroll-area {
            padding-bottom: 20px;
            max-height: calc(100vh - 180px);
            overflow-y: auto;
        }
        
        .filter-footer {
            position: sticky;
            bottom: 0;
            background: white;
            padding: 15px 0 35px;
            margin-top: 15px;
            box-shadow: 0 -5px 10px rgba(0,0,0,0.05);
            z-index: 1030;
        }
    }