/* استایل‌های پایه و متغیرها */
:root {
    --primary-color: #1AA29A;
    --bg-body: #FFFFFF;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --radius: 12px;
    --white: #ffffff;
    --text-main: #1e293b;
}

h1 {
    font-size: 2rem;
}

.container {
    margin: 0 auto;
    max-width: 960px;
}

/* ساختار کلی (Flexbox) */
.listing-wrapper {
    gap: 24px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    /* این خط بسیار مهم است: از کشیده شدن سایدبار تا انتهای صفحه جلوگیری می‌کند */
}

main.listing-main {
    flex: 1 0;
}

/* نوار ابزار بالا */
.listing-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 20px;
    padding-left: 10px;
}

/* گرید کارت‌ها */
.ads-grid {
    display: grid;
    gap: 15px;
}

.ad-item-horizontal {
    display: flex;
    flex-direction: row;
    background: #FFFFFF;
    box-shadow: 0px 0px 5px 0px #76767614;
    padding: 10px;
    position: relative;
    gap: 14px;
    transition: background 0.2s;
    max-width: 100%;
    overflow: hidden;
    border-radius: 20px;
    /* border: 1px solid #b0cbca1a; */
    box-shadow: 0 1px 3px #1d212b0f, 0 4px 12px #1d212b0a;
    transition: box-shadow 0.28s ease;
}

.ad-item-horizontal:hover {
    box-shadow: 0 4px 12px #1d212b14, 0 8px 24px #1d212b0f;
    transition: box-shadow 0.28s ease;
}

/* تصویر آگهی */
.ad-image-container {
    position: relative;
    width: 210px;
    /* اندازه دقیق درخواستی */
    height: 130px;
    /* اندازه دقیق درخواستی */
    flex-shrink: 0;
    overflow: hidden;
    background-color: #ffffff;
    box-shadow: 0px 0px 4px #0000001f;
    border-radius: 10px;
}

.ad-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* جلوگیری از دفرمه شدن عکس */
    display: block;
    transition: transform 0.4s ease;
}

.ad-item-horizontal:hover .ad-image {
    transform: scale(1.05);
}

.ad-photo-count {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 2px 6px;
    border-radius: 7px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ad-status-badge svg {
    scale: 0.1;
    transform-origin: top left;
}

.ad-video-count {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 2px;
    border-radius: 7px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* محتوای متنی */
.ad-info-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: right;
    max-width: 100%;
    overflow: hidden;
}

.ad-info-top {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    justify-content: flex-start;
    width: 100%;
    overflow: hidden;
}

.ad-title {
    min-width: 0;
    font-size: 18px !important;
    font-weight: 500 !important;
    color: #000000 !important;
    margin: 0;
    overflow: hidden;
    /* اضافه را مخفی می‌کند */
    text-overflow: ellipsis;
    /* ... */
    white-space: nowrap;
    /* تک‌خط */
}

/* پین و زمان نباید کوچک شوند */
.ad-pinned,
.ad-time {
    flex-shrink: 0;
    /* اجازه کوچک شدن ندارند */
}

.ad-pinned {
    color: #8b8b8b;
    font-size: 13px;
    display: none;
    align-items: center;
    gap: 4px;
}

.ad-time {
    color: #8b8b8b;
    font-size: 13px;
    display: none;
    align-items: center;
    gap: 4px;
}

.ad-pinned path {
    fill: #8b8b8b;
}

.ad-specs {
    color: #2b2b2b;
    font-size: 14px;
    margin-top: 8px;
}

.separator {
    margin: 0 3px;
    color: #2b2b2ba6;
    font-weight: bold;
}

.ad-info-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.ad-info {
    display: flex;
    flex-direction: row;
    gap: 6px;
    flex-wrap: wrap;
    margin: 4px 0;
}

.ad-location {
    color: #353535;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ad-price {
    font-size: 17px;
    color: #000;
}

.ad-price span {
    font-size: 13px;
    font-weight: normal;
}

.ad-status-badge {
    position: absolute;
    top: 12px;
    left: 15px;
}


.ad-verified-user,
.ad-expert-paper,
.ad-showroom-name,
.ad-formula-name {
    max-width: fit-content;
    padding: 4px 5px;
    border-radius: 7px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ad-verified-user span,
.ad-expert-paper span,
.ad-showroom-name span,
.ad-formula-name span {
    margin-bottom: -2.5px;
}


.ad-expert-paper {
    background: #a2971a21;
    color: #848200;
}

.ad-showroom-name {
    background: #1a2aa221;
    color: #1a2aa2;
}

.ad-formula-name {
    background: #1aa89a27;
    color: #1AA899;
}

.ad-verified-user {
    background: #1aa23a21;
    color: #1aa23a;
}


.custom-select-wrapper-ad {
    position: relative;
    display: inline-block;
    width: 220px;
    user-select: none;
    cursor: pointer;
    font-size: 14px;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s;
}

.custom-select-trigger:hover {
    border-color: #bbb;
}

.custom-select-wrapper-ad.open .custom-select-trigger {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-color: var(--primary-color);
}

.arrow {
    width: 10px;
    height: 10px;
    border-left: 2px solid #888;
    border-bottom: 2px solid #888;
    transform: rotate(-45deg);
    margin-top: -4px;
    transition: all 0.3s;
    border-radius: 0px 0px 0px 4px;
}

.open .arrow {
    transform: rotate(135deg);
    margin-top: 4px;
}

/* لیست آپشن‌ها */
.custom-options {
    position: absolute;
    display: block;
    top: 100%;
    left: 0;
    right: 0;
    border: 1px solid #e0e0e0;
    border-top: 0;
    background: #fff;
    transition: all 0.3s;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-10px);
    z-index: 100;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

.open .custom-options {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
    transform: translateY(0);
}

.custom-option {
    display: block;
    padding: 12px 15px;
    transition: all 0.3s;
    text-align: right;
    border-bottom: 1px solid #f9f9f9;
}

.custom-option:last-child {
    border-bottom: 0;
}

.custom-option:hover {
    background: #f0f7ff;
    color: var(--primary-color);
}

.custom-option.selected {
    background: #eff6ff;
    color: var(--primary-color);
    font-weight: bold;
}


.rec-title-separator {
    padding: 10px;
    background: white;
    border-radius: 11px;
    display: flex;
    justify-content: center;
}


/* نوار موبایل */
.mobile-filter-bar {
    display: none;
    /* در دسکتاپ مخفی */
    gap: 4px;
    align-items: center;
    padding: 10px;
    padding-left: 0px;
    background: #FFFFFFCC;
    backdrop-filter: blur(14px) !important;
    border: 1px solid #eee;
    position: sticky;
    top: 65px;
    z-index: 90;
    min-width: -webkit-fill-available;
    max-width: -webkit-fill-available;
    margin: 0 10px;
    border-radius: 11px;
}

.filter-main-btn {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    background: #f0f0f0 !important;
    color: #1c1c1c;
    border: none !important;
    padding: 8px 16px !important;
    border-radius: 25px !important;
    font-weight: bold !important;
    white-space: nowrap !important;
    position: relative !important;
}

.breadcrumb-icon svg {
    margin-bottom: -7px;
}

.breadcrumb-link {
    font-weight: bold;
    text-decoration: none;
    color: #666D7C;
}

.breadcrumb-link:hover {
    text-decoration: none;
    color: #1FAB9C;
}

.filter-main-btn:hover {
    color: #1c1c1c;
}

.filter-count-badge {
    background: var(--primary-color);
    color: #fff;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: -5px;
    right: -5px;
}

.active-filters-chips {
    padding-left: 10px !important;
    padding-right: 16%;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin-right: 10px;
    /* فاصله از دکمه فیلتر */
    flex: 1;
    white-space: nowrap;
    scrollbar-width: none;
}

.active-filters-chips::-webkit-scrollbar {
    display: none;
}

/* مخفی کردن اسکرول در کروم */

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #eff6ff;
    color: var(--primary-color);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
    border: 1px solid #dbeafe;
    white-space: nowrap;
}

.filter-chip button {
    border: none !important;
    background: none !important;
    font-size: 16px !important;
    cursor: pointer !important;
    line-height: 1 !important;
    color: #888 !important;
    padding: 0 !important;
}

.filter-chip button:hover {
    color: #595959 !important;
}

#close-filters-btn {
    display: none;
}

span.filter-icon {
    margin-bottom: -4px;
}

/* ظرفیت ردیف سوئیچ */
.switch-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

.switch-row:last-child {
    border-bottom: none;
}

.switch-title {
    font-size: 14px;
    font-weight: 500;
    color: #334155;
}

/* استایل اصلی سوئیچر (iOS Style) */
.modern-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.modern-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e2e8f0;
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 34px;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* حالت فعال */
input:checked+.switch-slider {
    background-color: var(--primary-color);
}

input:focus+.switch-slider {
    box-shadow: 0 0 1px var(--primary-color);
}

input:checked+.switch-slider:before {
    transform: translateX(20px);
    /* حرکت دایره به سمت راست */
}

/* افکت هاور */
.switch-row:hover .switch-title {
    color: var(--primary-color);
    transition: color 0.2s;
}

.sidebar-footer {
    display: none;
}


.header-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 15px 20px;
    border-bottom: 1px solid #f1f5f9;
}

.header-title-row span {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
}

.reset-all-btn {
    background: none !important;
    border: none !important;
    color: #ef4444 !important;
    /* رنگ قرمز */
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    padding: 5px 10px !important;
    border-radius: 6px !important;
    transition: background 0.2s !important;
}

.reset-all-btn:hover {
    background: #fef2f2 !important;
}

div#veh-internal-chips {
    padding-right: 0px;
}

.archive-header-box {
    margin: 0 auto;
    max-width: 960px;
    padding: 10px;
}

/* ریسپانسیو کردن سایدبار */
@media (max-width: 900px) {
    .rec-title-separator {
        margin: 8px;
    }

    .ads-grid {
        display: grid;
        gap: 0;
    }

    .ad-item-horizontal {
        border-radius: 0px;
    }

    .header-title-row {
        gap: 25px;
        padding: 10px;
        border-bottom: none;
    }

    .active-filters-chips {
        padding-right: 15%;
    }

    .listing-main {
        min-width: 100%;
    }

    .listing-wrapper {
        gap: 11px;
        display: flex;
        flex-direction: column;
    }

    .mobile-filter-bar {
        display: flex;
    }

    #close-filters-btn {
        display: block;
    }

    .listing-sidebar {
        position: fixed;
        top: 0 !important;
        right: -100%;
        /* مخفی در سمت راست */
        width: 100%;
        height: 100%;
        background: #fff;
        z-index: 1000;
        transition: right 0.3s ease;
        display: flex;
        flex-direction: column;
        height: -webkit-fill-available !important;
        position: fixed !important;
        margin-bottom: 0px !important;
        overflow: auto !important;
    }

    .listing-sidebar.open {
        right: 0;
    }

    .sidebar-header.mobile-only {
        display: flex;
        justify-content: space-between;
        padding: 15px;
        border-bottom: 1px solid #eee;
        font-weight: bold;
        font-size: 18px;
    }

    .sidebar-footer.mobile-only {
        padding: 15px;
        border-top: 1px solid #eee;
        display: block;
        position: sticky;
        bottom: 0px;
        background: white;
    }

    .btn-apply {
        width: 100%;
        background: var(--primary-color);
        color: #fff;
        border: none;
        padding: 12px;
        border-radius: 8px;
        font-weight: bold;
    }
}

/* کارت اسکلتی */
.skeleton-card {
    height: 128px;
    border-bottom: 1px solid #eee;
    padding: 15px;
    padding-top: 5px;
    display: flex;
    gap: 16px;
}

.skeleton-image {
    width: 210px;
    height: 110px !important;
    background: #f2f2f2;
    border-radius: 8px;
}

.skeleton-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.skeleton-line {
    height: 15px;
    background: #f2f2f2;
    border-radius: 4px;
}

.skeleton-line.title {
    width: 40%;
    height: 20px;
}

.skeleton-line.text {
    width: 70%;
}

.skeleton-line.price {
    width: 30%;
    margin-top: auto;
}

/* انیمیشن درخشش (Shimmer) */
.shim {
    position: relative;
    overflow: hidden;
}

.shim::after {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background-image: linear-gradient(90deg, rgba(255, 255, 255, 0) 0, rgba(255, 255, 255, 0.4) 50%, rgba(255, 255, 255, 0));
    animation: shimmer 1.5s infinite;
    content: '';
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}


/* کلاس مخفی کردن عمومی */
.hidden {
    display: none !important;
}

/* استایل گروه فیلترها در سایدبار */
.filter-group {
    margin-bottom: 20px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 15px;
}

.filter-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #475569;
}

.filter-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    outline: none;
}

.filter-input:focus {
    border-color: var(--primary-color);
}

/* ظرفیت کلی سایدبار در دسکتاپ */
.listing-sidebar {
    flex: 0 0 280px;
    background: #ffffff;
    /* border: 1px solid #e5e7eb; */
    border-radius: 20px;
    height: fit-content;
    overflow: hidden;
    margin-bottom: 20px;
    transition: top 0.3s ease;
    box-shadow: 0 1px 3px #1d212b0f, 0 4px 12px #1d212b0a;
}

.listing-sidebar::-webkit-scrollbar {
    width: 6px;
}

.listing-sidebar::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

/* محتوای داخلی سایدبار */
.sidebar-content {
    padding: 20px;
    max-height: none;
    /* برای اسکرول داخلی اگر فیلترها زیاد بود */
    overflow-y: visible;
}

/* هر گروه فیلتر (مثلا گروه برند، گروه قیمت) */
.filter-group {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f1f5f9;
}

.filter-group:last-child {
    border-bottom: none;
}

/* عنوان هر فیلتر */
.filter-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #334155;
}


/* استایل آکاردئون */
.filter-accordion {
    border-bottom: 1px solid #f1f5f9;
}

.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    color: #334155;
}

.arrow-icon {
    width: 10px;
    height: 10px;
    border-left: 2px solid #64748b;
    border-bottom: 2px solid #64748b;
    transform: rotate(-45deg);
    /* فلش رو به پایین */
    transition: transform 0.3s ease;
    border-radius: 0px 0px 0px 4px;
    margin-left: 8px;
}

.filter-accordion.open .arrow-icon {
    transform: rotate(135deg);
    /* فلش رو به بالا */
}

.accordion-content {
    max-height: 0;
    /* در حالت بسته ارتفاع صفر */
    overflow: hidden;
    /* مخفی کردن محتوای بیرون زده */
    transition: max-height 0.3s ease-out, opacity 0.3s ease;
    /* انیمیشن نرم */
    opacity: 0;
    padding-bottom: 0;
}

.filter-accordion.open .accordion-content {
    opacity: 1;
    /* ارتفاع در جاوااسکریپت به صورت داینامیک تنظیم می‌شود */
}


/* استایل دکمه‌های چک‌باکس مدرن */
.custom-checkbox-btn {
    display: flex;
    justify-content: flex-end;
    flex-direction: row-reverse;
    gap: 10px;
    align-items: center;
    padding: 10px;
    margin-bottom: 6px;
    background: #f8fafc;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
    border: 1px solid transparent;
}

.custom-checkbox-btn:hover {
    background: #f1f5f9;
}

.custom-checkbox-btn input {
    display: none;
    /* مخفی کردن چک‌باکس زشت مرورگر */
}

.check-label {
    font-size: 13px;
    color: #475569;
}

.check-mark {
    width: 17px;
    height: 17px;
    border: 2px solid #cbd5e1;
    border-radius: 4px;
    position: relative;
    transition: 0.2s;
}

/* حالت انتخاب شده */
.custom-checkbox-btn input:checked+.check-label {
    color: var(--primary-color);
    font-weight: 600;
}

.custom-checkbox-btn input:checked~.check-mark {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.custom-checkbox-btn input:checked~.check-mark::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* دکمه نمایش بیشتر */
.more-items {
    display: none;
    /* پیش‌فرض مخفی */
}

.show-more-link {
    max-width: fit-content;
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 0;
    width: 100%;
    text-align: right;
}

.show-more-link:hover {
    max-width: fit-content;
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 0;
    width: 100%;
    text-align: right;
}

/* ظرفیت دایره رنگ و متن */
.color-preview-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* دایره رنگی */
.color-circle {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1);
}

/* اصلاح استایل چک‌باکس برای هماهنگی با دایره رنگ */
.custom-checkbox-btn {
    padding: 8px 12px;
    /* کمی جمع‌وجورتر */
}


.button-open-filters {
    padding-left: 32px !important;
    margin-left: -20% !important;
    background: linear-gradient(269deg, #ffffff 80%, transparent 100%) !important;
    z-index: 10 !important;
}

/* استایل تریگر */
.custom-select-wrapper {
    direction: rtl;
    text-align: right;
}

.custom-select-wrapper label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    font-size: 14px;
    color: #444;
}

.custom-select {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 15px;
    background: #fff;
    border: 2px solid #eee;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.select-display {
    display: flex;
    flex-direction: column;
}

.select-label {
    font-size: 13px;
    color: #888;
}

.select-value {
    font-size: 15px;
    font-weight: bold;
    color: #333;
    margin-top: 2px;
}

.arrow-icon {
    color: #ccc;
    font-size: 12px;
}

/* حالت انتخاب شده */
.custom-select.has-selection {
    background-color: #eef6ff;
    border-color: #1AA29A;
}

.custom-select.has-selection .select-label,
.custom-select.has-selection .select-value,
.custom-select.has-selection .arrow-icon {
    color: #1AA29A;
}

/* استایل پاپ‌آپ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    padding: 20px;
    box-sizing: border-box;
    animation: fadeIn 0.3s ease forwards;
}

.modal-content {
    background: #fff;
    width: 100%;
    max-width: 450px;
    max-height: 85vh;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    animation: slideUpIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.modal-header {
    padding: 15px 20px;
    background: #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
}

.modal-search {
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    box-sizing: border-box;
}

.modal-search input {
    width: 100%;
    padding: 12px;
    border: 2px solid #eee;
    border-radius: 8px;
    box-sizing: border-box;
    outline: none;
}

.modal-body {
    flex-grow: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.modal-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 1px solid #fafafa;
}

.modal-option:hover {
    background: #f0f7ff;
}

/* انیمیشن‌ها */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUpIn {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideDownOut {
    from {
        transform: translateY(0);
        opacity: 1;
    }

    to {
        transform: translateY(30px);
        opacity: 0;
    }
}

/* آیکون رنگ (اگر نیاز داشتید) */
.color-circle {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid #ddd;
}

.year-select-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f1f5f9;
}

.price-select-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 145px;
}

.close-modal path,
.close-modal svg,
.input-unit {
    pointer-events: none !important;
    color: #000000 !important;
}

.close-modal {
    background: #ffffff00 !important;
    border: none !important;
}

button.close-modal {
    cursor: pointer !important;
    background: 0 0 !important;
    border: none !important;
    margin-top: 1px !important;
}

.close-custom-select {
    font-size: 20px;
    color: #000000;
    /* قرمز */
    cursor: pointer;
    padding: 5px;
    line-height: 1;
    z-index: 10;
}

.arrow-custom-select {
    font-size: 12px;
    color: #64748b;
    transition: transform 0.3s;
}

/* حالت انتخاب شده برای تریگر */
.custom-select.has-selection .select-value {
    color: var(--primary-color);
}

/* وضعیت پایه مـودال */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    /* شروع از شفافیت صفر */
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
    /* انیمیشن نرم برای پس‌زمینه */
    backdrop-filter: blur(0px);
    /* افکت بلور اختیاری */
}

/* وقتی مـودال باز است */
.modal-overlay.active {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

/* استایل محتوای مـودال */
.modal-content {
    background: #fff;
    transform: translateY(50px);
    /* شروع کمی پایین‌تر برای انیمیشن ورود */
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}


/* انیمیشن خروج (وقتی کلاس closing اضافه می‌شود) */
.modal-overlay.closing {
    background: rgba(0, 0, 0, 0) !important;
    backdrop-filter: blur(0px) !important;
}

.modal-overlay.closing .modal-content {
    animation: slideDownOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}


.price-range-section {
    max-height: 500px;
    /* مقدار تقریبی برای انیمیشن */
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, margin 0.3s ease;
    opacity: 1;
}

.price-range-section.hidden-price {
    max-height: 0;
    opacity: 0;
    /* margin-top: -20px; */
    pointer-events: none;
}

/* استایل دکمه انتخاب در مودال */
.btn-apply {
    width: 100%;
    background: var(--primary-color);
    color: #fff;
    border: none;
    padding: 15px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
}


.custom-price-area {
    position: sticky;
    bottom: 0;
    display: none;
    /* پیش‌فرض مخفی */
    background: #fff;
    padding: 15px;
    border-top: 2px solid var(--primary-color);
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.05);
    animation: slideUp 0.3s ease-out;
}

.custom-price-inner label {
    display: block;
    font-size: 11px;
    color: #64748b;
    margin-bottom: 8px;
}

.input-row {
    display: flex;
    gap: 10px;
}

.input-row input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
    font-size: 16px;
    outline: none;
}

.input-row input:focus {
    border-color: var(--primary-color);
}

.input-row button {
    background: var(--primary-color) !important;
    color: #fff !important;
    border: none !important;
    padding: 0 20px !important;
    border-radius: 8px !important;
    font-weight: bold !important;
    cursor: pointer !important;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}


/* استایل تب سوییچ (Segmented Control) */
.segmented-control {
    display: flex;
    background: #e2e8f0;
    padding: 4px;
    border-radius: 8px;
    margin-bottom: 3px;
    position: relative;
    user-select: none;
}

.mileage-status-container {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-bottom: 10px;
    margin-top: 5px;
    border-bottom: 1px solid #f1f5f9;
}

.mileage-select-container {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.segmented-control input {
    display: none;
}

.segmented-control label {
    flex: 1;
    text-align: center;
    padding: 8px 0;
    font-size: 13px;
    color: #64748b;
    cursor: pointer;
    z-index: 2;
    transition: color 0.3s;
}

/* وقتی انتخاب شد */
.segmented-control input:checked+label {
    color: var(--primary-color);
    font-weight: bold;
}

/* نوار متحرک زیر تب */
.selection-indicator {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 4px;
    width: calc(33.33% - 3px);
    /* تقسیم بر ۳ منهای پدینگ */
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

/* حرکت نوار بر اساس انتخاب */
#mileage-all:checked~.selection-indicator {
    transform: translateX(200%);
}

/* راست‌ترین */
#mileage-zero:checked~.selection-indicator {
    transform: translateX(100%);
}

/* وسط */
#mileage-used:checked~.selection-indicator {
    transform: translateX(0);
}

/* چپ‌ترین */

/* انیمیشن باز شدن بخش کیلومتر */
.mileage-range-section {
    max-height: 200px;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease;
    opacity: 1;
}

.hidden-mileage {
    max-height: 0;
    opacity: 0;
    margin-top: -10px;
    pointer-events: none;
}

.location-modal .full-screen-mobile {
    max-width: 550px;
    height: 85vh;
    display: flex;
    flex-direction: column;
}


.modal-info-bar {
    padding: 15px;
    padding-top: 5px;
    padding-bottom: 5px;
    background: #f8f9fa;
    min-height: 35px;
}

#loc-instruction,
#veh-instruction {
    font-size: 15px;
    color: #64748b;
    margin: 0;
}

/* استایل لیست شهرها با چک‌باکس */
.loc-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    /* flex-direction: row-reverse; */
}

.loc-item.all-cities {
    font-weight: bold;
}

.modal-text-bar {
    padding: 15px;
    padding-bottom: 0px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    max-height: 65px !important;
    background: #f8f9fa;
}


.loc-item .checkbox {
    width: 17px;
    height: 17px;
    border: 2px solid #cbd5e1;
    border-radius: 4px;
    position: relative;
    transition: 0.2s;
}

.loc-item.selected .checkbox {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.loc-item.selected .checkbox::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.modal-footer {
    padding: 15px;
    display: flex;
    gap: 10px;
    background: #fff;
    border-top: 1px solid #eee;
}

.btn-primary:disabled {
    background: #1aa29a73 !important;
    cursor: not-allowed !important
}

.brand-logo-wrapper img {
    min-width: 25px;
}

.brand-logo-wrapper img {
    min-width: 25px;
    margin-bottom: -10px;
}

button#loc-confirm-btn,
button#veh-confirm-btn {
    padding: 15px 25px !important;
    width: 100% !important;
    background: #1AA29A !important;
    color: white !important;
    border-radius: 10px !important;
    border: 0px solid #e2e2e2 !important;
    cursor: pointer !important;
}

button.btn-secondary {
    padding: 15px 25px !important;
    width: 100% !important;
    background: #eee !important;
    border-radius: 10px !important;
    border: 0px solid #e2e2e2 !important;
    cursor: pointer !important;
    color: #000000 !important;
}

button.btn-secondary:hover {
    padding: 15px 25px !important;
    width: 100% !important;
    background: #e6e6e6 !important;
    border-radius: 10px !important;
    border: 0px solid #e2e2e2 !important;
    cursor: pointer !important;
    color: #000000 !important;
}

.header-main {
    display: flex;
    align-items: center;
}

.back-btn,
.back-btn:hover {
    background-color: #00000000 !important;
    color: #000000 !important;
    height: 36px !important;
    margin-bottom: 5px !important;
    border: none !important;
    cursor: pointer !important;
}

h3#loc-modal-title,
h3#veh-modal-title {
    color: black;
}

div#loc-internal-chips {
    padding: 0;
    margin: 0;
}

button#close-filters-btn {
    padding: 0px !important;
    background: none !important;
    border: none !important;
    cursor: pointer !important;
}

button#close-filters-btn svg {
    margin-bottom: -5px !important;
}

/* حالت فعال محتوا (بالا آمدن) */
.location-modal.modal-overlay.close .modal-content {
    animation: slideDownOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.ad-item-horizontal {
    position: relative;
}

.ad-card-link-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    cursor: pointer;
}

/* استایل سطر لودینگ در مودال */
.skeleton-list-item {
    height: 45px;
    width: 98%;
    margin-right: 1%;
    margin-bottom: 8px;
    margin-top: 8px;
    border-radius: 10px;
    background: #f1f5f9;
    position: relative;
    overflow: hidden;
}

/* انیمیشن شیمر (Shimmer) */
.shim::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

.ad-info a,
.ad-info button {
    z-index: 11 !important;
    position: relative !important;
}

/* برای اینکه دکمه‌های داخلی از کار نیفتند */


/* حالت موبایل تمام‌صفحه */
@media (max-width: 768px) {
    .location-modal .full-screen-mobile {
        width: 100%;
    }

    .modal-overlay {
        align-items: flex-end;
        padding: 0px;
    }

    .modal-content {
        transform: translateY(100%);
        /* از پایین صفحه وارد شود */
        border-radius: 20px 20px 0 0;
        width: 100%;
    }

    .location-modal .modal-content {
        height: 100%;
        /* در موبایل تمام صفحه شود */
        max-height: 100%;
        max-width: 100%;
        border-radius: 0;
    }
}





@media (max-width: 480px) {

    div#location-modal,
    div#vehicle-modal {
        padding: 0 !important;
    }

    .modal-overlay {
        padding: 0px 10px;
        align-items: flex-end;
        /* در موبایل پاپ‌آپ از پایین باز شود (مثل Bottom Sheet) */
    }

    .modal-content {
        max-height: 50vh;
        /* در موبایل فضای بیشتری بگیرد */
        border-radius: 20px 20px 0 0;
        /* گرد کردن فقط گوشه‌های بالا */
    }

    .modal-list {
        padding: 0px 0px 10px 0px;
    }

}

/* ریسپانسیو برای موبایل */
@media (max-width: 600px) {
    h1 {
        font-size: 20px;
    }

    .active-filters-chips {
        padding-right: 12%;
    }

    body {
        padding: 0px;
    }

    .ads-grid {
        gap: 0px;
    }

    .ad-item-horizontal {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        padding: 10px;
        gap: 10px;
        border-radius: 0px;
        border: none;
        border-bottom: 1px solid #43a19c1a;
    }

    .ad-image-container {
        width: 120px;
        min-height: 120px;
        height: auto;
        aspect-ratio: 270 / 150;
        /* حفظ نسبت ابعاد در هر عرضی */
    }

    .skeleton-card {
        height: 120px;
        padding: 10px;
    }

    .skeleton-image {
        width: 120px;
        height: 100px !important;
    }

    .ad-title {
        font-size: 14px !important;
        flex: 1;
        /* فضا را پر می‌کند */
    }

    .ad-price {
        font-size: 15px;
    }

    .ad-specs {
        font-size: 12px;
        margin-top: 2px;
    }

    .listing-toolbar {
        justify-content: flex-start;
        margin-right: 10px;
    }

    .ad-status-badge {
        top: 17px;
        right: 17px;
    }

    .ad-status-badge svg {
        transform-origin: top right !important;
        scale: 0.1 !important;
    }

    .ad-info-bottom {
        flex-wrap: wrap;
        flex-direction: row;
        gap: 5px;
    }

    .ad-time,
    .ad-pinned {
        font-size: 10px;
    }

}


/* برای حذف سنجاق یا زمان انتشار آگهی در لیستینگ */
.ad-p-t-flex {
    display: flex !important;
}

/* برای حذف تعداد تصاویر وقتی تصویری برای آگهی وجود نداره */
.display-none {
    display: none !important;
}


.user-ad-wrapper {
    background: #fff;
    border-radius: 21px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    border: 1px solid #eee;
}

.ad-dashboard-controls {
    display: flex;
    padding: 12px;
    gap: 10px;
    background: #fdfdfd;
}

.ad-dashboard-controls a,
.ad-dashboard-controls button {
    flex: 1;
    padding: 8px;
    border-radius: 8px;
    font-size: 12px;
    text-align: center;
    cursor: pointer;
    border: 1px solid #ddd;
    background: #fff;
    text-decoration: none;
    color: #333;
    transition: all 0.3s;
}

.ad-dashboard-controls .btn-dash-boost {
    border-color: #19A29A;
    color: #19A29A;
}

.ad-dashboard-controls .btn-dash-boost:hover {
    background: #19A29A;
    color: #fff;
}

.ad-dashboard-controls .btn-dash-delete:hover {
    background: #e74c3c;
    color: #fff;
    border-color: #e74c3c;
}

.ad-stats-bar {
    display: flex;
    justify-content: center;
    background: #FDFDFD;
    padding: 5px;
    font-size: 12px;
    color: #666;
    width: 335px;
    margin: 0 auto;
    gap: 8px;
}

.stat-item strong {
    color: #0F172A;
}

.stat-item span {
    color: #eefffa;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    text-align: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2px;
    border-radius: 10px;
    background-color: #19A199;
    gap: 3px;
    min-width: 70px;
    min-height: 70px;
}

.user-ad-card-wrapper {
    background: #fff;
    border-radius: 21px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 25px;
    border: 1px solid #eee;
}


/* --- سیستم نوتیفیکیشن (Toast) فرمولا --- */

#notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none
}

.input-wrapper,
.modal-option,
.toast,
.toast-content {
    display: flex;
    align-items: center
}

.toast {
    pointer-events: auto;
    min-width: 280px;
    padding: 15px 20px;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    justify-content: space-between;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .049);
    animation: .3s forwards slideInLeft;
    position: relative;
    border-right: 5px solid rgba(0, 0, 0, .049)
}

.close-modal path,
.close-modal svg,
.input-unit {
    pointer-events: none
}

.toast-content {
    gap: 10px
}

.toast-close {
    background: 0 0;
    border: none;
    color: #3c3c3c;
    font-size: 22px;
    margin-top: 5px;
    cursor: pointer;
    opacity: .7;
    transition: .2s;
    line-height: 1
}

.media-card:hover .overlay-actions,
.toast-close:hover {
    opacity: 1
}

.toast-close:hover {
    background-color: #158a8200;
}

div#notification-container {
    margin-top: 20px;
}

.toast-warning {
    background-color: #ffefbe;
    color: #333;
    border: 1px solid #ffc107
}

.toast-error {
    background-color: #ffced3;
    color: #333;
    border: 1px solid #dc3545
}

.toast-success {
    background-color: #cdffd8;
    color: #333;
    border: 1px solid #28a745
}

.toast-info {
    background-color: #cdf8ff;
    color: #333;
    border: 1px solid #17a2b8
}

@keyframes fadeInOverlay {
    from {
        opacity: 0
    }

    to {
        opacity: 1
    }
}

@keyframes fadeOutOverlay {
    from {
        opacity: 1
    }

    to {
        opacity: 0
    }
}

@keyframes slideUpIn {
    from {
        transform: translateY(30px);
        opacity: 0
    }

    to {
        transform: translateY(0);
        opacity: 1
    }
}

@keyframes slideDownOut {
    from {
        transform: translateY(0);
        opacity: 1
    }

    to {
        transform: translateY(30px);
        opacity: 0
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(100%);
        opacity: 0
    }

    to {
        transform: translateX(0);
        opacity: 1
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(-10px)
    }
}

.toast.hide {
    animation: .5s forwards fadeOut
}


.fap-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    direction: rtl;
    text-align: right;
    font-family: inherit;
}

.fap-modal.hidden {
    display: none;
}

.fap-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(3px);
    animation: fapFadeIn 0.2s ease;
}

.fap-modal-box {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    animation: fapSlideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.fap-modal-title {
    padding: 16px 18px 8px 18px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
}

.fap-modal-message {
    padding: 14px 18px 18px 18px;
    font-size: 14px;
    color: #475569;
    line-height: 1.7;
}

.fap-modal-actions {
    display: flex;
    gap: 10px;
    padding: 14px 18px 18px 18px;
    border-top: 1px solid #f1f5f9;
    background: #fff;
}

.fap-btn {
    flex: 1;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 13px;
    cursor: pointer;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.fap-btn-cancel {
    background: #f8fafc;
    color: #475569;
}

.fap-btn-cancel:hover {
    background: #f1f5f9;
    color: #152328;
}

.fap-btn-confirm {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.fap-btn-confirm:hover {
    background: #14857e;
}

@keyframes fapFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fapSlideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ریسپانسیو موبایل */
@media (max-width: 600px) {
    .fap-modal {
        align-items: flex-end;
        padding: 0 12px 12px;
    }

    .fap-modal-box {
        max-width: 100%;
        border-radius: 16px 16px 0 0;
    }
}

.fap-modal.closing .fap-modal-backdrop {
    animation: fapFadeOut 0.2s ease forwards;
}

.fap-modal.closing .fap-modal-box {
    animation: fapSlideDown 0.22s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fapFadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes fapSlideDown {
    from {
        transform: translateY(0);
        opacity: 1;
    }

    to {
        transform: translateY(20px);
        opacity: 0;
    }
}