/* ═══════════════════════════════════════════════════
   گالری تصاویر آگهی — نسخه نهایی با Dots
   ═══════════════════════════════════════════════════ */

.gallery {
    width: 100%;
    max-width: 640px;
    margin: 0 auto 16px;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

/* ─── ناحیه اسلایدر: LTR صریح ─── */
.gallery__main {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    max-height: 480px;
    overflow: hidden;
    background: #f3f4f6;
    touch-action: pan-y pinch-zoom;
    overscroll-behavior: contain;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    cursor: grab;
    direction: ltr;
}

.gallery__main:active { cursor: grabbing; }

/* ─── Track: row-reverse برای RTL feel ─── */
.gallery__track {
    display: flex;
    flex-direction: row-reverse;
    flex-wrap: nowrap;
    height: 100%;
    width: 100%;
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.gallery__slide {
    flex: 0 0 100%;
    min-width: 100%;
    max-width: 100%;
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
}

.gallery__slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

/* ─── دکمه‌های شناور (قلب + اشتراک) ─── */
.gallery__actions {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

.gallery__action-btn {
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: background 0.15s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
    padding: 0;
}

.gallery__action-btn:active {
    transform: scale(0.92);
    background: rgba(0, 0, 0, 0.7);
}

.gallery__action-btn.is-favorited {
    color: #ef4444;
}

.gallery__action-btn.is-favorited svg {
    fill: #ef4444;
    stroke: #ef4444;
}

/* ─── شمارنده (گوشه) ─── */
.gallery__counter {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    pointer-events: none;
    z-index: 3;
    direction: rtl;
}

/* ─── Dots (نقطه‌های ناوبری روی تصویر) ─── */
.gallery__dots {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 7px;
    z-index: 5;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 100px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    pointer-events: auto;
}

.gallery__dot {
    width: 7px;
    height: 7px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.55);
    cursor: pointer;
    transition: background 0.2s ease, width 0.2s ease, border-radius 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}

.gallery__dot:hover {
    background: rgba(255, 255, 255, 0.85);
}

.gallery__dot.is-active {
    background: #ffffff;
    width: 20px;
    border-radius: 4px;
}

/* ─── فلش‌های چپ/راست (دسکتاپ) ─── */
.gallery__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 50%;
    cursor: pointer;
    z-index: 4;
    display: none;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, opacity 0.2s;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 20px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    opacity: 0;
}

.gallery__nav:hover { background-color: #fff; }

.gallery__nav--prev {
    left: 12px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 18l-6-6 6-6'/%3E%3C/svg%3E");
}

.gallery__nav--next {
    right: 12px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 18l6-6-6-6'/%3E%3C/svg%3E");
}

@media (min-width: 768px) {
    .gallery__nav { display: flex; }
    .gallery:hover .gallery__nav { opacity: 1; }
}

/* ─── موبایل ─── */
@media (max-width: 767px) {
    .gallery { border-radius: 8px; max-width: 100%; }
    .gallery__main { aspect-ratio: 1 / 1; max-height: none; }
    .gallery__counter { bottom: 8px; left: 8px; font-size: 11px; }
    .gallery__dots { bottom: 10px; padding: 5px 10px; gap: 6px; }
    .gallery__dot { width: 6px; height: 6px; }
    .gallery__dot.is-active { width: 18px; }
    .gallery__actions { top: 10px; right: 10px; gap: 6px; }
    .gallery__action-btn { width: 36px; height: 36px; }
}
/* ═══════════════════════════════════════════════════
   دسکتاپ — چیدمان منظم و حرفه‌ای
   (فقط روی صفحه‌های بزرگ‌تر از 860px اعمال می‌شود)
   ═══════════════════════════════════════════════════ */
@media (min-width: 861px) {

    /* ─── Container ─── */
    .ad-detail {
        padding: var(--space-7) 0 var(--space-8);
    }

    /* ─── Grid: فاصله بهتر بین دو ستون ─── */
    .ad-detail__grid {
        grid-template-columns: 1fr 340px;
        gap: var(--space-7);
        align-items: start;
    }

    /* ═══════════════════════════════════════════════
       ستون اصلی (گالری) — مثل یه کارت
       ═══════════════════════════════════════════════ */
    .ad-detail__gallery {
        background: var(--color-surface);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-lg);
        padding: var(--space-6);
        box-shadow: var(--shadow-sm);
    }

    /* ─── Category chip — نمایش در دسکتاپ هم ─── */
    .ad-detail__cat-chip--mobile {
        display: inline-flex !important;
        align-items: center;
        gap: 6px;
        padding: 6px 14px;
        background: var(--color-primary-tint);
        color: var(--color-primary-dark);
        border-radius: 100px;
        font-size: .82rem;
        font-weight: 600;
        text-decoration: none;
        margin-top: var(--space-5);
        margin-bottom: var(--space-3);
        transition: background 0.15s, color 0.15s;
    }
    .ad-detail__cat-chip--mobile:hover {
        background: var(--color-primary);
        color: #fff;
    }

    /* ─── عنوان بزرگ‌تر ─── */
    .ad-detail__title {
        margin-top: 0;
        font-size: 1.55rem;
        font-weight: 700;
        line-height: 1.55;
        color: var(--color-text);
        margin-bottom: var(--space-3);
    }

    /* ─── متادیتا با خط جداکننده زیرش ─── */
    .ad-detail__meta {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
    gap: var(--space-2) var(--space-4);   /* 8px 16px */
        padding-bottom: var(--space-4);
        margin-bottom: var(--space-5);
        border-bottom: 1px solid var(--color-border);
        font-size: .86rem;
        color: var(--color-text-muted);
    }

    .ad-detail__meta-item {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        position: relative;
    }

    /* نقطه جداکننده بین آیتم‌های متا */
    .ad-detail__meta-item + .ad-detail__meta-item::before {
        content: '';
        display: inline-block;
        width: 4px;
        height: 4px;
        border-radius: 50%;
        background: var(--color-border);
        margin-left: 8px;
        position: absolute;
        right: -14px;
        top: 50%;
        transform: translateY(-50%);
    }

    .ad-detail__meta-item svg {
        opacity: .7;
        flex-shrink: 0;
    }

    /* ─── توضیحات با خط جداکننده بالا ─── */
    .ad-detail__description {
        padding-top: var(--space-5);
        border-top: 1px solid var(--color-border);
        margin-top: var(--space-5);
    }

    .ad-detail__description h3 {
        font-size: 1.02rem;
        font-weight: 700;
        color: var(--color-text);
        margin-bottom: var(--space-4);
        display: flex;
        align-items: center;
        gap: 10px;
    }

    /* نوار سبز کنار عنوان بخش */
    .ad-detail__description h3::before {
        content: '';
        width: 3px;
        height: 18px;
        background: var(--color-primary);
        border-radius: 2px;
        flex-shrink: 0;
    }

    .ad-detail__description p {
        font-size: .95rem;
    line-height: 1.7;          /* ← از 2 به 1.9 */
        color: var(--color-text);
    }

    /* ─── نقشه با خط جداکننده ─── */
    .ad-detail__map {
        margin-top: var(--space-6);
        padding-top: var(--space-5);
        border-top: 1px solid var(--color-border);
    }

    .ad-detail__map h3 {
        font-size: 1.02rem;
        font-weight: 700;
        color: var(--color-text);
        margin-bottom: var(--space-4);
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .ad-detail__map h3::before {
        content: '';
        width: 3px;
        height: 18px;
        background: var(--color-primary);
        border-radius: 2px;
        flex-shrink: 0;
    }

    /* ═══════════════════════════════════════════════
       Sidebar — کارت قیمت و دکمه‌ها
       ═══════════════════════════════════════════════ */
    .ad-detail__sidebar {
        position: sticky;
        top: 90px;
    }

    .price-box {
        position: static;
        background: var(--color-surface);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-lg);
        padding: var(--space-6);
        box-shadow: var(--shadow-sm);
    }

    /* ─── قیمت با خط جداکننده زیرش ─── */
    .price-box .price {
        font-size: 1.5rem;
        font-weight: 800;
        color: var(--color-primary);
        text-align: center;
        padding-bottom: var(--space-5);
        margin-bottom: var(--space-5);
        border-bottom: 1px solid var(--color-border);
    }

    /* ─── دکمه‌ها یکنواخت ─── */
    .price-box .btn {
        padding: 14px 20px;
        font-size: .95rem;
    }

    /* ─── لینک گزارش با خط جداکننده بالا ─── */
    .price-box .report-link {
        display: block;
        margin-top: var(--space-5);
        padding-top: var(--space-4);
        border-top: 1px solid var(--color-border);
        font-size: .82rem;
        text-align: center;
        color: var(--color-text-muted);
        transition: color 0.15s;
        margin-top: 10px !important;

    }
    .price-box .report-link:hover {
        color: var(--color-error);
    }

    /* ═══════════════════════════════════════════════
       آگهی‌های مشابه — بخش جدا با خط بالا
       ═══════════════════════════════════════════════ */
    .similar-ads {
        margin-top: var(--space-8);
        padding-top: var(--space-7);
        border-top: 1px solid var(--color-border);
    }

    .similar-ads h2 {
        font-size: 1.25rem;
        margin-bottom: var(--space-5);
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .similar-ads h2::before {
        content: '';
        width: 3px;
        height: 22px;
        background: var(--color-primary);
        border-radius: 2px;
    }
}
/* ═══════════════════════════════════════════════════
   دسکتاپ — گالری تمام عرض کارت
   ═══════════════════════════════════════════════════ */
@media (min-width: 861px) {

    /* کارت گالری بدون padding */
    .ad-detail__gallery {
        padding: 0 !important;
        overflow: hidden;
    }

    /* گالری چسبیده به لبه‌های کارت */
    .ad-detail__gallery .gallery {
        margin: 0 !important;
        max-width: 100% !important;
        border: none !important;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
    }

    /* ارتفاع بیشتر برای گالری در دسکتاپ */
    .ad-detail__gallery .gallery__main {
        aspect-ratio: 16 / 10 !important;
        max-height: none !important;
    }

    /* برگرداندن فاصله داخلی به محتوای زیر گالری */
    .ad-detail__gallery .ad-detail__cat-chip--mobile,
    .ad-detail__gallery .ad-detail__title,
    .ad-detail__gallery .ad-detail__meta,
    .ad-detail__gallery .ad-detail__description,
    .ad-detail__gallery .ad-detail__map,
    .ad-detail__gallery .report-link--mobile,
    .ad-detail__gallery .ad-detail__no-image {
        padding-left: var(--space-6);
        padding-right: var(--space-6);
    }

    /* فاصله‌های مناسب */
    .ad-detail__gallery .ad-detail__cat-chip--mobile {
        margin-top: var(--space-5);
    }

    .ad-detail__gallery .report-link--mobile {
        padding-bottom: var(--space-5);
        margin-bottom: 0 !important;
    }
}
/* ═══════════════════════════════════════════════════
   Lightbox — نمایش تمام‌صفحه تصاویر گالری
   ═══════════════════════════════════════════════════ */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    direction: rtl;
    font-family: var(--font-ui, inherit);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0s 0.25s;
    -webkit-tap-highlight-color: transparent;
}

.lightbox.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 0.25s ease, visibility 0s;
}

/* ─── Backdrop ─── */
.lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 14, 14, 0.94);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: zoom-out;
}

/* ─── Stage (نگهدارنده تصویر) ─── */
.lightbox__stage {
    position: relative;
    z-index: 1;
    max-width: 95vw;
    max-height: 88vh;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0.9);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1),
                opacity 0.3s ease;
    will-change: transform, opacity;
}

.lightbox.is-open .lightbox__stage {
    transform: scale(1);
    opacity: 1;
}

.lightbox__image {
    max-width: 95vw;
    max-height: 88vh;
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
    border-radius: 12px;
    box-shadow:
        0 24px 60px -12px rgba(0, 0, 0, 0.7),
        0 8px 20px -8px rgba(0, 0, 0, 0.5);
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
    transition: opacity 0.2s ease;
}

/* ─── دکمه‌ی بستن ─── */
.lightbox__close {
    position: absolute;
    top: max(16px, env(safe-area-inset-top, 0px));
    left: 16px;
    z-index: 3;

    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: background 0.15s, transform 0.1s, opacity 0.2s;

    opacity: 0;
    transition-delay: 0s;
    -webkit-tap-highlight-color: transparent;
    padding: 0;
}

.lightbox.is-open .lightbox__close {
    opacity: 1;
    transition-delay: 0.15s;
}

.lightbox__close:hover {
    background: rgba(255, 255, 255, 0.25);
}
.lightbox__close:active {
    transform: scale(0.92);
}

/* ─── شمارنده ─── */
.lightbox__counter {
    position: absolute;
    top: max(24px, calc(env(safe-area-inset-top, 0px) + 8px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;

    padding: 6px 16px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 100px;
    font-variant-numeric: tabular-nums;
    pointer-events: none;

    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);

    opacity: 0;
    transition: opacity 0.2s ease;
    transition-delay: 0s;
}

.lightbox.is-open .lightbox__counter {
    opacity: 1;
    transition-delay: 0.2s;
}

/* ─── دکمه‌های ناوبری (قبلی/بعدی) ─── */
.lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;

    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: background 0.15s, transform 0.1s, opacity 0.2s;

    opacity: 0;
    transition-delay: 0s;
    -webkit-tap-highlight-color: transparent;
    padding: 0;
}

.lightbox.is-open .lightbox__nav {
    opacity: 1;
    transition-delay: 0.2s;
}

.lightbox__nav:hover {
    background: rgba(255, 255, 255, 0.25);
}
.lightbox__nav:active {
    transform: translateY(-50%) scale(0.92);
}

.lightbox__nav--prev {
    left: 16px;
}

.lightbox__nav--next {
    right: 16px;
}

/* وقتی فقط یک عکس وجود دارد */
.lightbox.is-single .lightbox__nav {
    display: none;
}

/* ─── Thumbs پایین صفحه ─── */
.lightbox__thumbs {
    position: absolute;
    bottom: max(20px, calc(env(safe-area-inset-bottom, 0px) + 12px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;

    display: flex;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 14px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

    max-width: 90vw;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;

    opacity: 0;
    transition: opacity 0.2s ease;
    transition-delay: 0s;
}

.lightbox__thumbs::-webkit-scrollbar {
    display: none;
}

.lightbox.is-open .lightbox__thumbs {
    opacity: 1;
    transition-delay: 0.25s;
}

.lightbox.is-single .lightbox__thumbs {
    display: none;
}

.lightbox__thumb {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid transparent;
    background: transparent;
    cursor: pointer;
    opacity: 0.55;
    transition: opacity 0.15s, border-color 0.15s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
}

.lightbox__thumb:hover {
    opacity: 0.85;
}

.lightbox__thumb.is-active {
    opacity: 1;
    border-color: #fff;
    transform: scale(1.05);
}

.lightbox__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

/* ─── دسکتاپ: hover روی اسلایدها نشان‌گر zoom ─── */
@media (hover: hover) and (min-width: 769px) {
    .gallery__slide img {
        cursor: zoom-in;
    }
}

/* ─── موبایل ─── */
@media (max-width: 768px) {
    /* thumbs در موبایل مخفی — swipe کافی است */
    .lightbox__thumbs {
        display: none !important;
    }

    /* دکمه‌های ناوبری کوچک‌تر */
    .lightbox__nav {
        width: 40px;
        height: 40px;
    }
    .lightbox__nav--prev { left: 10px; }
    .lightbox__nav--next { right: 10px; }

    .lightbox__image {
        max-width: 100vw;
        max-height: 82vh;
        border-radius: 0;
        box-shadow: none;
    }

    .lightbox__stage {
        max-width: 100vw;
        max-height: 82vh;
    }
}

/* ─── موبایل خیلی کوچک ─── */
@media (max-width: 380px) {
    .lightbox__close {
        width: 40px;
        height: 40px;
        top: 12px;
        left: 12px;
    }
    .lightbox__counter {
        font-size: 0.76rem;
        padding: 5px 12px;
    }
}