/* آگهی‌ها (سبک دیوار) — RTL, mobile-first */

.ads-wrap,
.ads-modal-backdrop {
    --ads-accent: #a62626;
    --ads-accent-dark: #8c1f1f;
    --ads-surface: var(--bale-surface, #fff);
    --ads-surface-alt: var(--bale-surface-alt, #f0f2f5);
    --ads-text: var(--bale-text, #1c2733);
    --ads-text-2: var(--bale-text-secondary, #81858b);
    --ads-border: var(--bale-border, #e0e0e6);
    --ads-link: var(--bale-link, #0c70de);
}

.ads-wrap {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px 16px 96px;
    color: var(--ads-text);
}

.ads-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.ads-head h1 {
    font-size: 18px;
    margin: 0;
    white-space: nowrap;
}

.ads-search {
    flex: 1;
    min-width: 200px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--ads-surface-alt);
    border: 1px solid var(--ads-border);
    border-radius: 10px;
    padding: 9px 12px;
}

.ads-search svg { flex-shrink: 0; color: var(--ads-text-2); }

.ads-search input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    font: inherit;
    color: var(--ads-text);
}

.ads-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid var(--ads-border);
    border-radius: 10px;
    background: var(--ads-surface);
    color: var(--ads-text);
    font: inherit;
    font-size: 14px;
    padding: 9px 14px;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    transition: background .15s;
}

.ads-btn:hover { background: var(--ads-surface-alt); }

.ads-btn-primary {
    background: var(--ads-accent);
    border-color: var(--ads-accent);
    color: #fff;
}

.ads-btn-primary:hover { background: var(--ads-accent-dark); }

.ads-btn-danger { color: #c0392b; border-color: #c0392b40; }

.ads-filter-badge {
    background: var(--ads-accent);
    color: #fff;
    border-radius: 999px;
    min-width: 18px;
    height: 18px;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

/* ---- chips ---- */
.ads-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 6px;
    margin-bottom: 12px;
    scrollbar-width: none;
}

.ads-chips::-webkit-scrollbar { display: none; }

.ads-chip {
    flex-shrink: 0;
    border: 1px solid var(--ads-border);
    border-radius: 999px;
    background: var(--ads-surface);
    color: var(--ads-text);
    font: inherit;
    font-size: 13px;
    padding: 6px 14px;
    cursor: pointer;
}

.ads-chip.active {
    background: var(--ads-accent);
    border-color: var(--ads-accent);
    color: #fff;
}

/* ---- cards ---- */
.ads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}

.ads-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--ads-surface);
    border: 1px solid var(--ads-border);
    border-radius: 12px;
    padding: 14px;
    text-decoration: none;
    color: var(--ads-text);
    transition: box-shadow .15s, transform .15s;
}

.ads-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,.08);
    transform: translateY(-1px);
}

.ads-card-title {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 44px;
}

.ads-card-price { font-size: 14px; font-weight: 700; color: var(--ads-text); }
.ads-card-price.free { color: var(--ads-text-2); font-weight: 400; }

.ads-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    color: var(--ads-text-2);
    margin-top: auto;
}

.ads-card-cat {
    background: var(--ads-surface-alt);
    border-radius: 6px;
    padding: 2px 8px;
    white-space: nowrap;
}

.ads-empty {
    text-align: center;
    color: var(--ads-text-2);
    padding: 60px 16px;
    font-size: 14px;
}

.ads-empty .ads-empty-icon { font-size: 44px; margin-bottom: 12px; }

.ads-loadmore-sentinel { height: 1px; }

.ads-skeleton {
    height: 140px;
    border-radius: 12px;
    background: linear-gradient(90deg, var(--ads-surface-alt) 25%, var(--ads-surface) 50%, var(--ads-surface-alt) 75%);
    background-size: 200% 100%;
    animation: ads-shimmer 1.2s infinite;
}

@keyframes ads-shimmer {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

/* ---- modal / bottom sheet ---- */
.ads-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1200;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.ads-modal-backdrop.open { display: flex; }

.ads-modal {
    background: var(--ads-surface);
    width: 100%;
    max-width: 560px;
    max-height: 86vh;
    border-radius: 16px 16px 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@media (min-width: 640px) {
    .ads-modal-backdrop { align-items: center; padding: 20px; }
    .ads-modal { border-radius: 16px; }
}

.ads-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--ads-border);
    font-weight: 700;
    font-size: 15px;
}

.ads-modal-close {
    border: none;
    background: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--ads-text-2);
    line-height: 1;
}

.ads-modal-body {
    padding: 14px 16px;
    overflow-y: auto;
    flex: 1;
}

.ads-modal-foot {
    padding: 12px 16px;
    border-top: 1px solid var(--ads-border);
    display: flex;
    gap: 10px;
}

.ads-modal-foot .ads-btn { flex: 1; }

/* ---- form ---- */
.ads-field { margin-bottom: 14px; }

.ads-field > label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.ads-field > label .req { color: var(--ads-accent); }

.ads-field input[type="text"],
.ads-field input[type="tel"],
.ads-field input[type="number"],
.ads-field select,
.ads-field textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--ads-border);
    border-radius: 10px;
    background: var(--ads-surface);
    color: var(--ads-text);
    font: inherit;
    font-size: 14px;
    padding: 10px 12px;
    outline: none;
}

.ads-field input:focus,
.ads-field select:focus,
.ads-field textarea:focus { border-color: var(--ads-accent); }

.ads-field .hint { font-size: 12px; color: var(--ads-text-2); margin-top: 4px; }

.ads-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
    user-select: none;
}

.ads-check input { width: 18px; height: 18px; accent-color: var(--ads-accent); }

.ads-form-card {
    background: var(--ads-surface);
    border: 1px solid var(--ads-border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 14px;
}

.ads-form-card h2 {
    font-size: 15px;
    margin: 0 0 14px;
}

.ads-cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
}

.ads-cat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--ads-border);
    border-radius: 12px;
    background: var(--ads-surface);
    color: var(--ads-text);
    font: inherit;
    font-size: 13px;
    padding: 14px 8px;
    cursor: pointer;
    text-align: center;
}

.ads-cat-item .ads-cat-icon { font-size: 26px; }

.ads-cat-fee {
    font-size: 11px;
    color: var(--ads-accent);
    font-weight: 600;
}

.ads-cat-fee.free { color: var(--ads-text-2); font-weight: 400; }

.ads-fee-note {
    margin-top: 12px;
    background: color-mix(in srgb, var(--ads-accent) 8%, var(--ads-surface));
    border: 1px solid color-mix(in srgb, var(--ads-accent) 30%, var(--ads-border));
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.9;
}

.ads-fee-note.free {
    background: color-mix(in srgb, #00a049 8%, var(--ads-surface));
    border-color: color-mix(in srgb, #00a049 30%, var(--ads-border));
}

.ads-cat-item.active {
    border-color: var(--ads-accent);
    background: color-mix(in srgb, var(--ads-accent) 7%, var(--ads-surface));
    font-weight: 700;
}

/* ---- تصاویر آگهی (فرم ثبت) ---- */
.ads-img-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 10px;
}

.ads-img-add,
.ads-img-item {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    overflow: hidden;
}

.ads-img-add {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: 1.5px dashed var(--ads-border);
    background: var(--ads-surface-alt);
    color: var(--ads-text-2);
    font-size: 11px;
    text-align: center;
    cursor: pointer;
    padding: 6px;
}

.ads-img-add span { font-size: 22px; line-height: 1; color: var(--ads-accent); }
.ads-img-add:hover { border-color: var(--ads-accent); }

.ads-img-item {
    border: 1px solid var(--ads-border);
}

.ads-img-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ads-img-remove {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: rgba(0,0,0,.55);
    color: #fff;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---- گالری تصاویر (صفحه جزئیات) ---- */
.ads-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}

.ads-gallery-item {
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--ads-border);
    cursor: pointer;
    background: var(--ads-surface-alt);
}

.ads-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ads-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.9);
    z-index: 1600;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.ads-lightbox.open { display: flex; }

.ads-lightbox img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    object-fit: contain;
}

.ads-lightbox-close {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,.15);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
}

/* ---- thumbnail روی کارت لیست ---- */
.ads-card-thumb {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    overflow: hidden;
    background: var(--ads-surface-alt);
}

.ads-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* map */
.ads-map {
    height: 260px;
    border-radius: 12px;
    border: 1px solid var(--ads-border);
    overflow: hidden;
}

.ads-map-hint { font-size: 12px; color: var(--ads-text-2); margin-top: 6px; }

/* filter sheet parts */
.ads-filter-group { margin-bottom: 18px; }

.ads-filter-group > .ads-filter-title {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 8px;
}

.ads-opt-chips { display: flex; flex-wrap: wrap; gap: 8px; }

.ads-opt-chip {
    border: 1px solid var(--ads-border);
    border-radius: 999px;
    background: var(--ads-surface);
    color: var(--ads-text);
    font: inherit;
    font-size: 13px;
    padding: 5px 12px;
    cursor: pointer;
}

.ads-opt-chip.active {
    background: var(--ads-accent);
    border-color: var(--ads-accent);
    color: #fff;
}

.ads-range-row { display: flex; gap: 8px; }
.ads-range-row input {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--ads-border);
    border-radius: 10px;
    background: var(--ads-surface);
    color: var(--ads-text);
    font: inherit;
    font-size: 13px;
    padding: 8px 10px;
    outline: none;
}

/* ---- details ---- */
.ads-details {
    max-width: 760px;
    margin: 0 auto;
}

.ads-details h1 {
    font-size: 19px;
    margin: 0 0 6px;
    line-height: 1.7;
}

.ads-details-meta { font-size: 13px; color: var(--ads-text-2); margin-bottom: 14px; }

.ads-owner-link { color: var(--ads-accent, #2aabee); text-decoration: none; font-weight: 600; }
.ads-owner-link:hover { text-decoration: underline; }

.ads-details-price {
    font-size: 18px;
    font-weight: 800;
    margin: 10px 0 16px;
}

.ads-attrs {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.ads-attrs tr { border-bottom: 1px solid var(--ads-border); }
.ads-attrs tr:last-child { border-bottom: none; }
.ads-attrs td { padding: 10px 4px; }
.ads-attrs td:first-child { color: var(--ads-text-2); width: 40%; }
.ads-attrs td:last-child { font-weight: 600; }

.ads-desc {
    white-space: pre-wrap;
    line-height: 2;
    font-size: 14px;
}

/* ---- my ads ---- */
.ads-my-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--ads-surface);
    border: 1px solid var(--ads-border);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 10px;
}

.ads-my-row .grow { flex: 1; min-width: 0; }

.ads-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #323232;
    color: #fff;
    border-radius: 10px;
    padding: 10px 18px;
    font-size: 13px;
    z-index: 1500;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
}

.ads-toast.show { opacity: 1; }
