/* Shield web portal. Plain CSS with logical properties so RTL (Arabic) and LTR (English) share one sheet. */
:root {
    --bg: #f6f8f8;
    --surface: #ffffff;
    --text: #15262a;
    --muted: #5b6b70;
    --line: #dde5e6;
    --brand: #0d7377;
    --brand-ink: #ffffff;
    --brand-soft: #e3f2f2;
    --sale: #0d7377;
    --rent: #8a5a00;
    --rent-soft: #fbf0dc;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(16, 38, 42, .06), 0 4px 16px rgba(16, 38, 42, .06);
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f1719;
        --surface: #172326;
        --text: #e6eeef;
        --muted: #9db0b4;
        --line: #26373b;
        --brand: #3fb8b5;
        --brand-ink: #062022;
        --brand-soft: #173a3b;
        --sale: #3fb8b5;
        --rent: #e0b15a;
        --rent-soft: #3a2f1a;
        --shadow: none;
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    overflow-x: clip;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Tahoma, "Noto Sans Arabic", "Noto Sans", sans-serif;
}
a { color: var(--brand); }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .4em; }
h1 { font-size: clamp(1.4rem, 3vw, 2rem); }
h2 { font-size: 1.15rem; margin-top: 1.4em; }
[x-cloak] { display: none !important; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

.wrap { width: 100%; max-width: 1280px; margin-inline: auto; padding-inline: 16px; }
.main { padding-block: 20px 48px; min-height: 70vh; }
.muted { color: var(--muted); font-size: .92rem; }

.topbar { background: var(--surface); border-block-end: 1px solid var(--line); position: sticky; top: 0; z-index: 1000; }
.topbar__inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); text-decoration: none; }
.brand__mark { width: 32px; height: 32px; border-radius: 8px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; }
.lang { border: 1px solid var(--line); border-radius: 999px; padding: 4px 14px; text-decoration: none; color: var(--text); }
.footer { border-block-start: 1px solid var(--line); padding-block: 20px; color: var(--muted); font-size: .9rem; }

/* Form controls */
input, select, button { font: inherit; color: inherit; }
input[type="search"], input[type="number"], select {
    width: 100%; min-width: 0; min-height: 42px; padding: 8px 12px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
}
select:disabled { opacity: .55; }
label, legend { font-size: .9rem; color: var(--muted); }
label > select, label > input { margin-block-start: 4px; color: var(--text); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.btn { background: var(--brand); color: var(--brand-ink); border: 0; border-radius: 999px; padding: 8px 18px; font-weight: 600; cursor: pointer; box-shadow: var(--shadow); }
.link { background: none; border: 0; color: var(--brand); cursor: pointer; padding: 0; text-decoration: underline; }

/* Search */
.hero { margin-block-end: 16px; }
.searchbar { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.segmented { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.segmented label { padding: 6px 14px; border-radius: 8px; cursor: pointer; color: var(--text); white-space: nowrap; }
.segmented label.is-on { background: var(--brand); color: var(--brand-ink); }
.segmented input, .chip input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label:focus-within, .chip:focus-within { outline: 3px solid var(--brand); outline-offset: 1px; }

.filters { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin-block-end: 16px; }
.filters summary { cursor: pointer; font-weight: 600; }
.filters__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr)); gap: 12px; margin-block: 12px; }
.range { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; align-content: start; }
.range legend { grid-column: 1 / -1; margin-block-end: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-block: 8px 12px; padding: 0; list-style: none; }
.chips legend { width: 100%; margin-block-end: 6px; }
.chip { position: relative; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; cursor: pointer; color: var(--text); background: var(--surface); font-size: .9rem; }
.chip.is-on { border-color: var(--brand); background: var(--brand-soft); }
.chips--static .chip { cursor: default; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-block-end: 12px; }
.toolbar .sort { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.toolbar .sort select { width: auto; margin: 0; }
.note { color: var(--muted); font-size: .9rem; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 16px; align-content: start; transition: opacity .15s; }
.results.is-loading { opacity: .5; }
.mapbox { position: relative; order: -1; }
.mapbox__canvas { height: 280px; border-radius: var(--radius); border: 1px solid var(--line); z-index: 0; }
.mapbox__action { position: absolute; top: 12px; inset-inline-start: 50%; transform: translateX(-50%); z-index: 500; }
[dir="rtl"] .mapbox__action { transform: translateX(50%); }
@media (min-width: 960px) {
    .layout { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
    .mapbox { order: 0; }
    .mapbox:not(.mapbox--single) { position: sticky; top: 76px; align-self: start; }
    .mapbox:not(.mapbox--single) .mapbox__canvas { height: calc(100vh - 100px); }
}
.mapbox--single .mapbox__canvas { height: 300px; }
.popup-price { font-weight: 600; margin-block-start: 2px; }

.card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: inherit; text-decoration: none; box-shadow: var(--shadow); transition: transform .15s, border-color .15s; }
.card:hover { transform: translateY(-2px); border-color: var(--brand); }
.card__media { position: relative; aspect-ratio: 4 / 3; background: var(--brand-soft); }
.card__media img { width: 100%; height: 100%; object-fit: cover; }
.card__media .badge { position: absolute; top: 10px; inset-inline-start: 10px; }
.card__body { padding: 12px 14px 14px; }
.card__title { font-size: 1rem; margin-block: 4px 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.price { font-weight: 700; font-size: 1.15rem; color: var(--brand); }
.price small { font-weight: 500; font-size: .8rem; color: var(--muted); }
.price--big { font-size: 1.6rem; margin-block: 8px; }
.specs { display: flex; flex-wrap: wrap; gap: 4px 12px; list-style: none; padding: 0; margin: 8px 0 0; font-size: .88rem; color: var(--muted); }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.badge--sale { background: var(--brand-soft); color: var(--sale); }
.badge--rent { background: var(--rent-soft); color: var(--rent); }

.empty { grid-column: 1 / -1; text-align: center; padding: 48px 16px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.pager { grid-column: 1 / -1; display: flex; justify-content: center; align-items: center; gap: 16px; }
.pager button { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 1.2rem; }
.pager button:disabled { opacity: .4; cursor: default; }
[dir="rtl"] .pager button { transform: scaleX(-1); }
.loading { position: fixed; bottom: 16px; inset-inline: 0; margin-inline: auto; width: max-content; background: var(--text); color: var(--bg); padding: 6px 16px; border-radius: 999px; z-index: 1100; }

/* Property page */
.back { display: inline-block; margin-block-end: 12px; }
.gallery { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; border-radius: var(--radius); margin-block-end: 20px; }
.gallery img { flex: 0 0 min(100%, 720px); aspect-ratio: 4 / 3; max-height: 460px; object-fit: cover; scroll-snap-align: start; border-radius: var(--radius); }
.listing__grid { display: grid; gap: 24px; }
@media (min-width: 960px) { .listing__grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }
.prose { white-space: normal; overflow-wrap: anywhere; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; align-self: start; }
.panel h2 { margin-top: 0; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

@media (max-width: 600px) {
    .searchbar { grid-template-columns: 1fr; }
    .segmented { justify-self: start; }
}
