/* board/static/board/css/board.css — public board, card tab and board dashboard.
   Logical properties (inline-start/end) so RTL (fa/ar) needs no overrides. */

/* ---------- Listing tile ---------- */
.board-card { border-radius: 1rem; overflow: hidden; transition: transform .15s ease, box-shadow .15s ease; }
.board-card:hover { transform: translateY(-2px); box-shadow: 0 .5rem 1.25rem rgba(0, 0, 0, .08) !important; }
.board-card-media { position: relative; aspect-ratio: 4 / 3; background: var(--bs-tertiary-bg, #f3f4f6); }
.board-card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.board-card-placeholder { display: flex; align-items: center; justify-content: center; height: 100%; min-height: 160px;
    color: var(--bs-secondary-color, #9ca3af); font-size: 2.5rem; background: var(--bs-tertiary-bg, #f3f4f6); }
.board-card-badges { position: absolute; inset-block-start: .5rem; inset-inline-start: .5rem; display: flex; flex-wrap: wrap; gap: .25rem; }
.board-card-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.4em; line-height: 1.2; }
.board-facts { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .25rem .75rem; font-size: .8rem; color: var(--bs-secondary-color, #6b7280); }
.board-facts i { margin-inline-end: .15rem; }
.board-price { font-weight: 700; color: var(--bs-primary, #0d6efd); white-space: nowrap; }

/* ---------- List page ---------- */
.board-hero-logo { width: 64px; height: 64px; border-radius: 1rem; object-fit: cover; flex-shrink: 0; }
.board-category-pills { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .25rem; scrollbar-width: thin; }
.board-category-pills .btn { white-space: nowrap; }
.board-filters .form-control, .board-filters .form-select { font-size: .875rem; }
.board-filter-group { border-top: 1px dashed var(--bs-border-color, #e5e7eb); padding-top: .75rem; }
.board-chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.board-chip { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem; border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 2rem; font-size: .8rem; cursor: pointer; user-select: none; }
.board-chip input { margin: 0; }
.board-chip:has(input:checked) { border-color: var(--bs-primary, #0d6efd); background: var(--bs-primary-bg-subtle, #e7f1ff); }
.board-empty i { opacity: .5; }
[dir="rtl"] .rtl-flip::before { display: inline-block; transform: scaleX(-1); }  /* glyph only, see core/css/l10n.css */
.min-w-0 { min-width: 0; }

/* ---------- Detail page ---------- */
.board-gallery { display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: 90px; gap: .5rem; }
.board-gallery a { position: relative; display: block; border-radius: .75rem; overflow: hidden; }
.board-gallery img { width: 100%; height: 100%; object-fit: cover; }
.board-gallery-main { grid-column: 1 / -1; grid-row: span 4; }
.board-gallery-more { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, .45); color: #fff; font-weight: 700; font-size: 1.25rem; }
.board-keyfacts { display: flex; flex-wrap: wrap; gap: .75rem; }
.board-keyfacts > div { flex: 1 1 110px; padding: .75rem 1rem; border-radius: .75rem; background: var(--bs-tertiary-bg, #f8f9fa); }
.board-keyfacts strong { display: block; font-size: 1.05rem; }
.board-keyfacts span { font-size: .78rem; color: var(--bs-secondary-color, #6b7280); }
.board-description { line-height: 1.8; }
.board-details dt, .board-details dd { padding: .4rem 0; border-bottom: 1px solid var(--bs-border-color-translucent, #eee); margin: 0; }
.board-price-lg { font-size: 1.6rem; font-weight: 800; color: var(--bs-primary, #0d6efd); }
.board-costs th { font-weight: 400; color: var(--bs-secondary-color, #6b7280); }
.board-costs td { text-align: end; }
.board-seller-logo { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.board-seller-initial { display: inline-flex; align-items: center; justify-content: center; background: var(--bs-primary, #0d6efd); color: #fff; font-weight: 700; }
@media (min-width: 992px) { .board-sticky { position: sticky; top: 90px; } }
@media (min-width: 768px) { .board-gallery { grid-auto-rows: 110px; } }

/* Card tab (the board inside its business card): board/css/card_board.css */

/* ---------- Dashboard ---------- */
.board-dp-nav .nav-link { padding: .35rem .75rem; font-size: .875rem; }
.board-dp-thumb { width: 52px; height: 52px; object-fit: cover; flex-shrink: 0; }
.board-dp-title { max-width: 320px; }
.board-dp-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .75rem; }
.board-dp-image { border: 1px solid var(--bs-border-color, #dee2e6); border-radius: .5rem; padding: .35rem; display: flex; flex-direction: column; gap: .2rem; }
.board-dp-image img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: .35rem; }
.board-check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .35rem 1rem; }
.board-inquiry-message { white-space: normal; background: var(--bs-tertiary-bg, #f8f9fa); border-radius: .5rem; padding: .75rem; }
.is-invalid-wrap .form-control, .is-invalid-wrap .form-select { border-color: var(--bs-danger, #dc3545); }
details.card > summary { cursor: pointer; list-style: none; }
@media (min-width: 992px) { .board-dp-actions { position: sticky; top: 90px; } }

/* ---------- Map (results, listing, picker) ---------- */
.board-results .board-list-col { flex: 0 0 100%; max-width: 100%; }
.board-results .board-map-col { display: none; flex: 0 0 100%; max-width: 100%; }
.board-results[data-view="map"] .board-list-col { display: none; }
.board-results[data-view="map"] .board-map-col { display: block; }
.board-results[data-view="map"] .board-map { height: 72vh; }
@media (min-width: 1200px) {
    .board-results[data-view="split"] .board-list-col { flex: 0 0 56%; max-width: 56%; }
    .board-results[data-view="split"] .board-list-col .row > [data-listing-ref] { flex: 0 0 50%; max-width: 50%; }
    .board-results[data-view="split"] .board-map-col { display: block; flex: 0 0 44%; max-width: 44%; }
    .board-results[data-view="split"] .board-map-box { position: sticky; top: 90px; }
    .board-results[data-view="split"] .board-map { height: calc(100vh - 130px); }
}
.board-map-box { position: relative; }
.board-map { height: 60vh; min-height: 320px; border-radius: 1rem; overflow: hidden; background: var(--bs-tertiary-bg, #eef1f4); z-index: 0; }
.board-map-error::after { content: '⚠'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 2rem; }
.board-map-area-btn { position: absolute; top: .75rem; left: 50%; transform: translateX(-50%); z-index: 500; border-radius: 2rem; }
.board-map-note { position: absolute; bottom: .5rem; left: .5rem; z-index: 500; background: rgba(255, 255, 255, .92);
    color: #333; padding: .2rem .6rem; border-radius: 1rem; }
.board-pin-wrap { background: none; border: 0; }
.board-pin { display: inline-block; transform: translate(-50%, -100%); white-space: nowrap; padding: .2rem .55rem; border-radius: 1rem;
    background: #fff; color: #111; font: 600 12px/1.4 system-ui, sans-serif; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); position: relative; }
.board-pin::after { content: ''; position: absolute; left: 50%; bottom: -5px; margin-left: -5px; border: 5px solid transparent;
    border-top-color: #fff; border-bottom: 0; }
.board-pin.is-featured { background: #ffc107; }
.board-pin.is-featured::after { border-top-color: #ffc107; }
.leaflet-marker-icon.is-active .board-pin, .board-pin:hover { background: var(--bs-primary, #0d6efd); color: #fff; z-index: 1000; }
.leaflet-marker-icon.is-active .board-pin::after, .board-pin:hover::after { border-top-color: var(--bs-primary, #0d6efd); }
.board-cluster { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; transform: translate(-50%, -50%);
    border-radius: 50%; background: var(--bs-primary, #0d6efd); color: #fff; font: 700 13px system-ui, sans-serif;
    box-shadow: 0 0 0 6px rgba(13, 110, 253, .25); cursor: pointer; }
.board-dot { display: block; width: 18px; height: 18px; transform: translate(-50%, -50%); border-radius: 50%;
    background: var(--bs-primary, #0d6efd); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .4); }
.board-pop { display: flex; gap: .6rem; text-decoration: none; color: inherit; width: 240px; }
.board-pop img { width: 72px; height: 60px; object-fit: cover; border-radius: .4rem; flex-shrink: 0; }
.board-pop-body { display: flex; flex-direction: column; gap: .1rem; min-width: 0; font-size: 12px; }
.board-pop-body strong { font-size: 13px; line-height: 1.25; }
.board-pop-price { color: var(--bs-primary, #0d6efd); font-weight: 700; }
.board-pop-body small { color: #6b7280; }
.board-pop-list { display: flex; flex-direction: column; gap: .5rem; max-height: 260px; overflow-y: auto; }
.board-pop-list .board-pop + .board-pop { border-top: 1px solid #eee; padding-top: .5rem; }
.board-map-sm { height: 260px; border-radius: .75rem; overflow: hidden; z-index: 0; }
.board-picker { height: 340px; border-radius: .75rem; overflow: hidden; z-index: 0; cursor: crosshair; }
.board-picker-search { position: relative; }
.board-picker-search .list-group { position: absolute; top: 100%; left: 0; right: 0; z-index: 1000; max-height: 240px; overflow-y: auto; }
[dir="rtl"] .leaflet-container { direction: ltr; }

/* ---------- Insights ---------- */
.board-funnel-bar { height: 28px; border-radius: .4rem; background: var(--bs-primary, #0d6efd); opacity: .85; min-width: 2px; }
.board-heat { border-collapse: separate; border-spacing: 3px; font-size: .75rem; }
.board-heat td { width: 2.6rem; height: 1.6rem; border-radius: .3rem; text-align: center; }
.board-heat .l0 { background: var(--bs-tertiary-bg, #f1f3f5); }
.board-heat .l1 { background: rgba(13, 110, 253, .18); }
.board-heat .l2 { background: rgba(13, 110, 253, .38); }
.board-heat .l3 { background: rgba(13, 110, 253, .6); color: #fff; }
.board-heat .l4 { background: rgba(13, 110, 253, .85); color: #fff; }
.board-kpi-change.up { color: var(--bs-success, #198754); }
.board-kpi-change.down { color: var(--bs-danger, #dc3545); }
.board-bar-row { display: grid; grid-template-columns: 9rem 1fr 3.5rem; gap: .5rem; align-items: center; font-size: .85rem; }
.board-bar { height: 8px; border-radius: 4px; background: var(--bs-primary, #0d6efd); }
.board-pick { display: block; transform: translate(-50%, -100%); font-size: 2.4rem; line-height: 1; color: var(--bs-danger, #dc3545);
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .35)); cursor: grab; }

/* =====================================================================
   Public board pages: phone + laptop polish (same treatment as the card directory)
   ===================================================================== */

/* The theme pads every <section>; board sections are content groups, not page bands */
.board-page section { padding-top: 0; padding-bottom: 0; }

/* RTL arrows: rtl.css mirrors the glyph (::before) and rtl.js also mirrors the <i> inline. That second flip
   only bites when the <i> is a block or grid item, and would turn the arrow back; keep the glyph flip alone. */
[dir="rtl"] .board-page .board-pg--nav .bi, [dir="rtl"] .board-actionbar .bi { transform: none !important; }

/* Breadcrumbs: Bootstrap spaces the separator with physical left/right; mirror it for RTL */
[dir="rtl"] .board-page .breadcrumb-item + .breadcrumb-item { padding-left: 0; padding-right: var(--bs-breadcrumb-item-padding-x, .5rem); }
[dir="rtl"] .board-page .breadcrumb-item + .breadcrumb-item::before { float: right; padding-right: 0; padding-left: var(--bs-breadcrumb-item-padding-x, .5rem); }

/* ---------- Search bar ---------- */
.board-searchbar {
    display: flex; align-items: center; gap: .25rem; height: 3.5rem; padding-inline: 1rem .375rem;
    background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-radius: 1rem;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08); transition: border-color .15s, box-shadow .15s;
}
.board-searchbar:focus-within { border-color: rgba(var(--bs-primary-rgb), .5); box-shadow: 0 0 0 .2rem rgba(var(--bs-primary-rgb), .2); }
.board-searchbar__icon { color: var(--bs-secondary-color); font-size: 1.1rem; }
.board-searchbar .form-control {
    flex: 1; min-width: 0; height: 100%; padding-inline: .5rem; border: 0; border-radius: 0;
    background: transparent; box-shadow: none; font-size: 1rem;
}
.board-searchbar__btn { flex: none; align-self: center; height: 2.75rem; margin: 0; padding: 0 1.5rem; border-radius: .75rem; font-weight: 600; line-height: 1; }

/* ---------- Category pills: never squeezed, scroll sideways ---------- */
.board-category-pills { padding-bottom: .375rem; scroll-snap-type: x proximity; }
.board-category-pills .btn {
    flex: none; display: inline-flex; align-items: center; gap: .35rem; height: 2.25rem;
    padding-inline: .9rem; font-size: .875rem; font-weight: 500; scroll-snap-align: start;
}

/* ---------- Toolbar controls (Filters, view switch, sort): one shared look ---------- */
.board-page .board-ctl {
    display: inline-flex; align-items: center; gap: .35rem; height: 2.25rem; margin: 0; padding-block: 0; padding-inline: .8rem;
    background-color: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-radius: .6rem;
    color: var(--bs-body-color); font-size: .875rem; font-weight: 500; line-height: 1; box-shadow: none;
    transition: border-color .15s, background-color .15s, color .15s;
}
.board-page .board-ctl:hover { border-color: rgba(var(--bs-primary-rgb), .45); background-color: var(--bs-body-bg); color: var(--bs-body-color); }
.board-page .board-ctl:focus-visible { outline: 0; box-shadow: 0 0 0 .2rem rgba(var(--bs-primary-rgb), .2); }
.board-page .board-ctl.active { background-color: var(--bs-primary-bg-subtle); border-color: rgba(var(--bs-primary-rgb), .5); color: var(--bs-primary-text-emphasis); z-index: 1; }
.board-page .btn-group > .board-ctl:not(:first-child) { margin-inline-start: -1px; }
/* Joined corners with logical radii: the LTR Bootstrap build squares the physical right side, wrong in RTL */
.board-page .board-toolbar .btn-group > .btn.board-ctl { border-radius: 0; }
.board-page .board-toolbar .btn-group > .btn.board-ctl:first-child { border-start-start-radius: .6rem; border-end-start-radius: .6rem; }
.board-page .board-toolbar .btn-group > .btn.board-ctl:last-child { border-start-end-radius: .6rem; border-end-end-radius: .6rem; }
.board-page .board-ctl .bi { font-size: .95rem; }
.board-page .board-ctl .badge { font-size: .7rem; }

.board-sort { position: relative; }
.board-sort > .bi { position: absolute; top: 50%; inset-inline-start: .7rem; transform: translateY(-50%); z-index: 2; color: var(--bs-secondary-color); font-size: .85rem; pointer-events: none; }
.board-page select.board-ctl { display: block; width: auto; padding-inline-start: 2rem; padding-inline-end: 2.25rem; background-position: right .75rem center; }
[dir="rtl"] .board-page select.board-ctl { background-position: left .75rem center; }

/* ---------- Pagination (numbered, like the directory) ---------- */
.board-pg-nav-wrap { display: flex; justify-content: center; margin-top: 2rem; }
.board-pg-list { display: flex; flex-wrap: wrap; gap: .35rem; margin: 0; padding: 0; list-style: none; }
.board-pg {
    display: inline-grid; place-items: center; min-width: 2.5rem; height: 2.5rem; padding-inline: .6rem;
    background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-radius: .75rem;
    color: var(--bs-body-color); font-size: .9rem; font-weight: 500; text-decoration: none; font-variant-numeric: tabular-nums;
    transition: border-color .15s, color .15s;
}
a.board-pg:hover { border-color: var(--bs-primary); color: var(--bs-primary); }
.board-pg.is-active { background: var(--bs-primary); border-color: var(--bs-primary); color: #fff; box-shadow: 0 .25rem .75rem rgba(var(--bs-primary-rgb), .3); }
.board-pg--nav { color: var(--bs-primary); }
.board-pg.is-disabled { color: var(--bs-secondary-color); opacity: .45; }
.board-pg--gap { border-color: transparent; background: transparent; }

/* ---------- Phones: listings as compact rows (thumbnail | title, facts, price, place), like Divar ---------- */
@media (max-width: 575.98px) {
    .board-rows-sm { --bs-gutter-y: .6rem; }
    /* The thumbnail is pinned in the padding, outside row sizing, so the text stack is only as tall as it needs
       and sits centred beside the image whatever its length */
    .board-rows-sm .board-card {
        --row-thumb: 6.75rem;
        display: grid; grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "title" "facts" "price" "place";
        align-content: center; row-gap: .2rem;
        min-height: calc(var(--row-thumb) + 1.2rem); padding: .6rem; padding-inline-start: calc(var(--row-thumb) + 1.45rem);
        border-radius: .9rem;
    }

    /* Toolbar: the count on its own line, then all controls in one row with the sort taking the rest */
    .board-toolbar { flex-wrap: nowrap !important; width: 100%; }
    .board-toolbar .board-sort { flex: 1 1 auto; min-width: 0; }
    .board-page .board-toolbar select.board-ctl { width: 100%; }
    .board-rows-sm .board-card:hover { transform: none; }
    /* !important: the footer carries Bootstrap's d-flex, itself !important */
    .board-rows-sm .board-card > .card-body,
    .board-rows-sm .board-card > .card-footer { display: contents !important; }
    .board-rows-sm .board-card-media {
        position: absolute; top: 50%; inset-inline-start: .6rem; transform: translateY(-50%);
        width: var(--row-thumb); height: var(--row-thumb); aspect-ratio: auto; overflow: hidden; border-radius: .75rem;
    }
    .board-rows-sm .board-card-placeholder { min-height: 0; font-size: 1.75rem; }
    .board-rows-sm .board-card-badges { inset-block-start: .3rem; inset-inline-start: .3rem; gap: .2rem; }
    .board-rows-sm .board-card-badges .badge { padding: .2em .45em; font-size: .62rem; }
    .board-rows-sm .board-card-badges .badge.bg-dark { display: none; }   /* sale / rent: the title says it */
    .board-rows-sm .board-card-title { grid-area: title; min-height: 0; margin: 0 !important; font-size: .9rem; line-height: 1.4; }
    .board-rows-sm .board-facts { grid-area: facts; flex-wrap: nowrap; overflow: hidden; font-size: .72rem; }
    .board-rows-sm .board-facts li { flex: none; white-space: nowrap; }
    .board-rows-sm .board-card .board-price { grid-area: price; font-size: .95rem; }
    .board-rows-sm .board-card .card-body > p { grid-area: place; margin: 0 !important; font-size: .72rem; }
    .board-rows-sm .board-card .card-footer > span:not(.board-price) { display: none; }   /* seller: shown on the detail page */
}

/* ---------- Detail page layout ---------- */
.board-detail { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "gallery" "aside" "body"; gap: 1.5rem; }
.board-detail__gallery { grid-area: gallery; }
.board-detail__gallery .board-gallery { margin-bottom: 0 !important; }
.board-detail__aside { grid-area: aside; }
.board-detail__body { grid-area: body; }
@media (min-width: 992px) {
    .board-detail { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); grid-template-areas: "gallery aside" "body aside"; column-gap: 3rem; row-gap: 1.5rem; }
    .board-detail__aside { align-self: stretch; }
}

/* Specs as a two-column grid: labels cannot be clipped by row gutters */
.board-details { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
@media (min-width: 768px) { .board-details { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); } }
.board-details dt, .board-details dd { padding-inline: 0; }
.board-details dd { padding-inline-start: .75rem; }

/* Phones: price and the main actions stay in reach at the bottom */
.board-actionbar {
    position: fixed; inset-inline: 0; bottom: 0; z-index: 1030;
    display: flex; align-items: center; gap: .75rem; padding: .65rem 1rem calc(.65rem + env(safe-area-inset-bottom));
    background: var(--bs-body-bg); border-top: 1px solid var(--bs-border-color); box-shadow: 0 -.5rem 1.5rem rgba(16, 24, 40, .08);
}
/* Long prices (۱٬۱۵۰٬۰۰۰٬۰۰۰ تومان) wrap before the currency instead of being cut */
.board-actionbar__price { flex: 1; min-width: 0; color: var(--bs-primary); font-weight: 800; font-size: .95rem; line-height: 1.25; overflow-wrap: anywhere; }
.board-actionbar__price small { font-size: .7rem; }
.board-actionbar__actions { display: flex; flex: none; gap: .5rem; }
.board-actionbar .btn { display: inline-flex; align-items: center; gap: .35rem; height: 2.75rem; margin: 0; padding-inline: .85rem; border-radius: .75rem; font-weight: 600; white-space: nowrap; }

/* Favourite: a true circle */
.board-page .board-fav { display: inline-grid; place-items: center; flex: none; width: 2.5rem; height: 2.5rem; padding: 0; margin: 0; }
@media (max-width: 991.98px) {
    .board-page:has(.board-actionbar) { padding-bottom: 6rem !important; }
    body:has(.board-actionbar) .back-top { bottom: 5.5rem; }
}

/* VIP listing (board/vip.py): gold mark on the tile */
.board-vip-badge { background: linear-gradient(135deg, #f3dc9b, #d4af5a); color: #1b1712; font-weight: 800; letter-spacing: .04em; }
.board-card--vip { box-shadow: 0 0 0 1.5px #d4af5a, 0 6px 18px rgba(154, 116, 40, .18) !important; }

/* VIP in the board dashboard: listing form card, settings card, the code */
.board-vip-card { border-color: #ead9ab !important; background: linear-gradient(180deg, #fffdf6, transparent 60%); }
.board-vip-card__icon {
    display: inline-grid; place-items: center; width: 1.75rem; height: 1.75rem; margin-inline-end: .25rem; border-radius: .5rem;
    background: linear-gradient(145deg, #f3dc9b, #d4af5a); color: #1b1712; font-size: .9rem; vertical-align: middle;
}
.board-vip-card .form-check-input:checked { background-color: #b8913a; border-color: #b8913a; }
.board-vip-code-box { padding: .6rem .75rem; border: 1px dashed #d4af5a; border-radius: .6rem; background: #fbf5e6; }
.board-vip-code { font-size: 1.15rem; font-weight: 800; letter-spacing: .15em; color: #1b1712; background: none; padding: 0; }
.board-vip-card:not(:has(input[name="is_vip"]:checked)) .board-vip-extra { display: none; }
.board-vip-card .text-uppercase::placeholder { text-transform: none; }
