/* ---------- فیلتر دسته‌بندی ---------- */
.category-filter {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 4px 2px 14px;
    margin-bottom: 18px;
    scrollbar-width: thin;
}
.category-filter a {
    flex-shrink: 0;
    text-decoration: none;
    padding: 8px 18px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--primary-color);
    transition: 0.25s;
}
.category-filter a:hover { border-color: var(--gold-solid); }
.category-filter a.active { background: var(--primary-color); color: var(--gold-solid); border-color: var(--primary-color); }

/* ---------- لیست آگهی‌ها ---------- */
.listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 24px;
    margin-bottom: 60px;
}

.listing-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(15, 23, 42, 0.05);
    transition: transform 0.3s, box-shadow 0.3s;
}
.listing-card:hover { transform: translateY(-4px); box-shadow: 0 14px 28px rgba(15, 23, 42, 0.14); }

.card-media { position: relative; }
.card-media .carousel { height: 210px; }
.card-category {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 11;
    background: rgba(15, 23, 42, 0.85);
    color: var(--gold-solid);
    font-size: 0.78rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
}

/* کل کارت قابل‌کلیک است (لینک نامرئی روی کارت)؛ دکمه‌ها و فلش‌های اسلایدر بالاتر از آن‌اند */
.card-link { position: absolute; inset: 0; z-index: 5; }
.card-body { padding: 14px 16px 12px; display: flex; flex: 1; flex-direction: column; width: 100%; }
.card-category { pointer-events: none; }

/* ---------- قیمت (همیشه مشکی) ---------- */
.price-block { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px dashed #D5DEE8; }
.price-line { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; color: #000; }
.pl-label { font-size: 0.82rem; color: #000; opacity: 0.7; font-weight: 500; }
.pl-value { font-size: 1.05rem; font-weight: 800; color: #000; }

.card-title { font-size: 1rem; line-height: 1.6; color: var(--primary-color); font-weight: 700; margin-bottom: 4px; }
.card-location { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 10px; }

.card-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.card-chips span { background: #EEF4FA; color: var(--primary-light); border-radius: 6px; padding: 2px 10px; font-size: 0.78rem; font-weight: 600; }

.card-footer {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid #EEF2F6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ---------- صفحه‌ی جزئیات ---------- */
.detail-container {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 30px;
    margin-top: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
}
.detail-container > .flash { margin-bottom: 20px; }

.detail-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 30px; margin-bottom: 30px; align-items: start; }
.detail-carousel { height: 400px; border-radius: var(--radius); }

.detail-price-panel {
    margin-top: 14px;
    padding: 16px 18px 8px;
    border: 1px solid #D5DEE8;
    border-radius: var(--radius);
    background: #FAFCFE;
}
.detail-price-panel .price-block { border-bottom: none; margin-bottom: 0; padding-bottom: 0; gap: 10px; }
.detail-price-panel .pl-value { font-size: 1.3rem; }
.detail-price-panel .price-line { padding-bottom: 8px; border-bottom: 1px solid #EEF2F6; }
.detail-price-panel .price-line:last-child { border-bottom: none; }

.badge-category { text-decoration: none; background: var(--primary-color); color: var(--gold-solid); padding: 4px 14px; font-size: 0.82rem; }
.detail-title { font-size: 1.7rem; color: var(--primary-color); margin: 12px 0 8px; }
.detail-location { color: var(--text-muted); margin-bottom: 18px; }

.owner-box { margin: 0 0 18px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.owner-actions { margin: 15px 0; }
.detail-info .small { margin-top: 15px; }
.phone-revealed { background: var(--primary-color); background-image: none; color: var(--gold-solid) !important; }

.detail-specs { margin-bottom: 30px; }
.spec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.spec-item { display: flex; justify-content: space-between; gap: 10px; background: #F4F8FC; padding: 10px 14px; border-radius: 8px; }
.spec-item dt { color: var(--text-muted); font-size: 0.9rem; }
.spec-item dd { font-weight: 700; color: #000; text-align: left; }

.description-text { white-space: pre-wrap; line-height: 2; }

/* ====== اسلایدر عکس داخل کارت (کشیدن انگشت / فلش) ====== */
.card-slider { position: absolute; inset: 0; z-index: 7; }
.slider-track { display: flex; width: 100%; height: 100%; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory;
    scrollbar-width: none; -ms-overflow-style: none; touch-action: pan-y pinch-zoom; overscroll-behavior-x: contain; cursor: pointer; }
.slider-track::-webkit-scrollbar { display: none; }
.slider-track .card-img { flex: 0 0 100%; width: 100%; height: 100%; object-fit: cover; scroll-snap-align: center; scroll-snap-stop: always; background: #E2E8F0; }
.slider-btn { position: absolute; top: 50%; transform: translateY(-50%); z-index: 8; width: 32px; height: 32px; border: none; border-radius: 50%;
    background: rgba(15, 23, 42, 0.62); color: #fff; font-size: 0.85rem; line-height: 1; cursor: pointer; opacity: 0; transition: opacity 0.2s, background 0.2s; display: flex; align-items: center; justify-content: center; }
.slider-btn.prev { right: 8px; }
.slider-btn.next { left: 8px; }
.slider-btn:hover { background: rgba(15, 23, 42, 0.85); }
.card-media:hover .slider-btn, .slider-btn:focus-visible { opacity: 1; }
.card-photos { z-index: 9; pointer-events: none; }
@media (hover: none) {
    .slider-btn { opacity: 0.8; width: 24px; height: 24px; font-size: 0.7rem; }
    .slider-btn.prev { right: 3px; }
    .slider-btn.next { left: 3px; }
}
