:root {
  --navy: #0B2A5B;
  --navy-dark: #071B3D;
  --red: #C62828;
  --red-dark: #A81F1F;
  --bg: #EEF1F7;
  --card: #ffffff;
  --text: #1c2540;
  --muted: #7A8599;
  --line: #D5DBE8;
  --wa: #25D366;
  --wa-dark: #1DB954;
  --ok: #1E9E57;
  --warn: #E65100;
  --radius: 20px;
  --shadow: 0 6px 24px rgba(11, 42, 91, .10);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Cairo", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button, input, select, textarea { font-family: inherit; font-size: 1rem; }
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* ===== الهيدر ===== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--navy-dark);
  color: #fff;
  box-shadow: 0 2px 14px rgba(0, 0, 0, .25);
}
.header-inner {
  max-width: 1120px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 14px; position: relative;
}
.brand { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.logo-wrap {
  width: 46px; height: 46px; border-radius: 12px; flex: none; overflow: hidden;
  background: var(--navy-dark); display: block;
}
.brand-logo { width: 100%; height: 100%; object-fit: cover; transform: scale(1.14); display: block; }
.brand-fallback {
  width: 100%; height: 100%;
}
.brand-fallback {
  display: grid; place-items: center; background: #0f3a8a; color: #4aa3ff;
  font-weight: 800; font-size: 1.6rem; border-top: 5px solid var(--red);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 1.3rem; font-weight: 800; }
.brand-text small { color: #B8C4DA; font-size: .74rem; }

.nav { display: flex; align-items: center; gap: 6px; }
.nav a, .linklike {
  background: none; border: 0; color: #dfe6f5; cursor: pointer;
  padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: .95rem;
  transition: background .15s;
}
.nav a:hover, .linklike:hover { background: rgba(255, 255, 255, .1); }
.nav a.active { background: rgba(255, 255, 255, .14); color: #fff; }
.nav a.nav-cta { background: var(--red); color: #fff; }
.nav a.nav-cta:hover { background: var(--red-dark); }
.nav-toggle {
  display: none; background: rgba(255, 255, 255, .1); border: 0; color: #fff;
  width: 44px; height: 44px; border-radius: 12px; font-size: 1.4rem; cursor: pointer;
}

@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav {
    display: none; position: absolute; top: 100%; inset-inline: 0;
    flex-direction: column; align-items: stretch; background: var(--navy-dark);
    padding: 8px 12px 14px; border-top: 1px solid rgba(255, 255, 255, .08);
  }
  .nav.open { display: flex; }
  .nav a, .linklike { text-align: start; border-radius: 12px; padding: 12px 14px; }
}

/* ===== شريط العمولة ===== */
.strip {
  background: var(--navy); color: #fff; text-align: center;
  padding: 10px 16px; font-size: .88rem; line-height: 1.9;
}
.strip b { color: #ffd2d2; }

/* ===== أزرار ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; cursor: pointer; border-radius: 14px; padding: 12px 20px;
  font-weight: 700; color: #fff; transition: transform .1s, filter .15s;
  text-align: center;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .6; cursor: not-allowed; }
.btn-red { background: var(--red); }
.btn-navy { background: var(--navy); }
.btn-wa { background: var(--wa); }
.btn-danger { background: #B71C1C; }
.btn-ok { background: var(--ok); }
.btn-ghost { background: #fff; color: var(--navy); border: 1px solid var(--line); }
.btn-block { width: 100%; }
.btn-lg { padding: 15px 22px; font-size: 1.05rem; }

/* ===== البحث والفلاتر ===== */
.searchbox { margin: 18px 0 10px; }
.searchbox input {
  width: 100%; border: 0; background: #fff; border-radius: 18px;
  padding: 16px 52px 16px 18px; box-shadow: var(--shadow); color: var(--text);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 24 24' fill='none' stroke='%23C62828' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 18px center;
  outline: none; border: 2px solid transparent;
}
.searchbox input:focus { border-color: var(--navy); }
.chips { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--navy); cursor: pointer;
  padding: 8px 22px; border-radius: 999px; font-weight: 700;
}
.chip.on { background: var(--red); color: #fff; border-color: var(--red); }
.section-title {
  display: flex; align-items: baseline; gap: 10px;
  color: var(--navy); font-size: 1.35rem; margin: 22px 0 10px; font-weight: 800;
}
.section-title small { color: var(--muted); font-weight: 600; font-size: .9rem; }

/* ===== كروت العقارات ===== */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; padding-bottom: 28px; }
.card {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(11, 42, 91, .16); }
.gwrap { position: relative; }
.gallery {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
  height: 230px; background: #dfe5f1; scrollbar-width: none;
}
.gallery::-webkit-scrollbar { display: none; }
.gallery.noimg { align-items: center; justify-content: center; color: var(--muted); }
.slide { flex: 0 0 100%; scroll-snap-align: center; display: block; }
.slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.counter {
  position: absolute; bottom: 10px; inset-inline-start: 10px; pointer-events: none;
  background: rgba(7, 27, 61, .75); color: #fff; font-size: .78rem;
  padding: 2px 10px; border-radius: 999px;
}
.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.badges { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.badge {
  display: inline-block; color: #fff; font-size: .78rem; font-weight: 700;
  padding: 2px 12px; border-radius: 8px;
}
.b-sale { background: var(--navy); }
.b-rent { background: var(--red); }
.b-ok { background: var(--ok); }
.b-pending { background: var(--warn); }
.price { color: var(--red); font-size: 1.5rem; font-weight: 800; line-height: 1.3; }
.card h3 { margin: 2px 0 0; font-size: 1.1rem; color: var(--navy); }
.loc { color: var(--muted); font-size: .88rem; }
.desc { color: #4a5470; font-size: .93rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 4px; }
.card-actions { display: flex; gap: 10px; margin-top: auto; padding-top: 14px; flex-wrap: wrap; }
.card-actions .btn { flex: 1; padding: 11px 12px; min-width: 110px; }
.sellerbox {
  background: #FFF3CD; border-radius: 12px; padding: 10px 12px; margin-top: 10px;
  font-size: .86rem; white-space: pre-line; color: #4a3d00;
}

.empty, .loading, .errorbox {
  text-align: center; color: var(--muted); padding: 50px 16px; grid-column: 1 / -1;
}
.errorbox { color: #a31515; }
.spinner {
  display: inline-block; width: 34px; height: 34px; border-radius: 50%;
  border: 4px solid var(--line); border-top-color: var(--red); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== صفحات داخلية ===== */
.page-head { background: var(--navy-dark); color: #fff; padding: 26px 0 42px; }
.page-head h1 { margin: 0; font-size: 1.6rem; font-weight: 800; }
.page-head p { margin: 4px 0 0; color: #B8C4DA; font-size: .95rem; }
.pull-up { margin-top: -22px; }

.panel {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px; margin-bottom: 24px;
}
.narrow { max-width: 760px; margin-inline: auto; }
.tiny { max-width: 460px; margin-inline: auto; }

/* ===== نماذج ===== */
label.lbl { display: block; font-weight: 700; color: var(--navy); margin: 14px 0 6px; }
.form-card input[type=text], .form-card input[type=email], .form-card input[type=password],
.form-card input[type=tel], .form-card input[type=number], .form-card select, .form-card textarea,
.panel input[type=text], .panel input[type=email], .panel input[type=password], .panel input[type=tel] {
  width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 14px;
  padding: 13px 14px; color: var(--text); outline: none;
}
.form-card textarea { resize: vertical; min-height: 110px; }
.form-card input:focus, .form-card select:focus, .form-card textarea:focus,
.panel input:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(11, 42, 91, .1); }
.deal-switch { display: flex; gap: 12px; }
.radio {
  flex: 1; border: 2px solid var(--line); border-radius: 14px; padding: 12px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  font-weight: 800; color: var(--navy);
}
.radio { position: relative; }
.radio input { position: absolute; opacity: 0; pointer-events: none; }
.radio:has(input:focus-visible) { box-shadow: 0 0 0 3px rgba(11,42,91,.25); }
.radio:has(input:checked) { border-color: var(--red); background: #fff3f3; color: var(--red); }
.hint { color: var(--muted); font-size: .84rem; margin-top: 8px; }
.ferr { color: #b3261e; background: #fdecea; border-radius: 12px; padding: 10px 14px; margin-top: 14px; font-weight: 600; }
.ferr:empty { display: none; }
.previews { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.previews img { width: 92px; height: 92px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }
.form-actions { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.form-actions .btn { flex: 1; }

.tabs { display: flex; gap: 8px; background: #E2E7F2; padding: 5px; border-radius: 14px; margin-bottom: 14px; }
.tab {
  flex: 1; border: 0; background: transparent; color: var(--navy); padding: 10px;
  border-radius: 10px; font-weight: 800; cursor: pointer;
}
.tab.on { background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .1); color: var(--red); }

/* ===== تفاصيل العقار ===== */
.detail { max-width: 880px; margin: 18px auto 30px; }
.detail .main-img { width: 100%; height: min(60vw, 460px); object-fit: cover; border-radius: var(--radius); display: block; background: #dfe5f1; }
.thumbs { display: flex; gap: 10px; margin-top: 10px; overflow-x: auto; padding-bottom: 4px; }
.thumbs img {
  width: 96px; height: 72px; object-fit: cover; border-radius: 12px; cursor: pointer;
  border: 3px solid transparent; flex: none;
}
.thumbs img.on { border-color: var(--red); }
.detail h1 { margin: 14px 0 0; font-size: 1.5rem; color: var(--navy); font-weight: 800; }
.detail .price { font-size: 1.9rem; margin-top: 6px; }
.detail .box { background: #fff; border-radius: 16px; padding: 16px 18px; margin-top: 14px; box-shadow: var(--shadow); white-space: pre-wrap; }
.detail .box h2 { margin: 0 0 6px; font-size: 1.05rem; color: var(--navy); }
.note { color: var(--muted); font-size: .86rem; margin-top: 16px; }
.banner { background: #FFF3CD; color: #5c4600; padding: 12px 16px; border-radius: 14px; margin-top: 14px; font-weight: 600; }
.back { display: inline-block; color: var(--navy); font-weight: 700; margin-top: 16px; }

/* ===== صفحات نصية ===== */
.prose h2 { color: var(--navy); font-size: 1.15rem; margin: 22px 0 4px; }
.prose p, .prose li { color: #3a4560; }
.prose ul { padding-inline-start: 22px; }
.prose .upd { color: var(--muted); font-size: .88rem; }

/* ===== الفوتر ===== */
.site-footer { background: var(--navy-dark); color: #B8C4DA; padding: 24px 0 18px; margin-top: 20px; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.footer-links a { color: #dfe6f5; font-size: .92rem; }
.footer-links a:hover { text-decoration: underline; }
.copy { text-align: center; font-size: .82rem; margin: 14px 0 0; }
.ad-slot {
  max-width: 728px; min-height: 60px; margin: 18px auto 0; text-align: center;
  background: rgba(255, 255, 255, .04); border-radius: 12px; padding: 6px; overflow: hidden;
}
.ad-slot small { display: block; color: #8d9bb8; font-size: .7rem; margin-bottom: 2px; }

/* ===== توست ===== */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 30px);
  background: var(--navy-dark); color: #fff; padding: 12px 22px; border-radius: 14px;
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 100; max-width: 90vw; text-align: center;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .3);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ===== بلاطات الأنواع + بانر ===== */
.hero {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 60%, #3a1018 140%);
  color: #fff; border-radius: 20px; padding: 18px 20px; margin: 4px 0 16px;
  box-shadow: var(--shadow);
}
.hero div { display: flex; flex-direction: column; line-height: 1.5; }
.hero strong { font-size: 1.25rem; font-weight: 800; }
.hero span { color: #c9d4ea; font-size: .86rem; }
.hero b { background: var(--red); padding: 8px 16px; border-radius: 999px; white-space: nowrap; font-size: .92rem; }
.tiles { display: flex; gap: 10px; overflow-x: auto; padding: 2px 0 12px; scrollbar-width: none; }
.tiles::-webkit-scrollbar { display: none; }
.tile {
  flex: 1 0 60px; border: 2px solid transparent; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 0; color: var(--text);
}
.tile i {
  width: 100%; max-width: 66px; aspect-ratio: 1; border-radius: 16px; background: #fff; display: grid; place-items: center;
  box-shadow: var(--shadow); border: 2px solid transparent;
}
.tile svg, .tabbar svg { width: 30px; height: 30px; fill: none; stroke: var(--red); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tile span { font-size: .82rem; font-weight: 700; color: var(--navy); }
.tile.on i { background: var(--navy); border-color: var(--navy); }
.tile.on svg { stroke: #fff; }

/* ===== صفحة حسابي ===== */
.menu { margin-top: 18px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.acc-card { display: flex; align-items: center; gap: 14px; padding: 18px; border-bottom: 1px solid var(--line); }
.acc-card.col { flex-direction: column; align-items: stretch; text-align: center; }
.acc-card strong { color: var(--navy); font-size: 1.1rem; display: block; }
.acc-card small { color: var(--muted); }
.acc-av { width: 52px; height: 52px; border-radius: 50%; background: var(--navy); display: grid; place-items: center; flex: none; }
.acc-av svg { width: 28px; height: 28px; fill: none; stroke: #fff; stroke-width: 1.8; }
.menu-row {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  padding: 16px 18px; border: 0; border-bottom: 1px solid var(--line); background: #fff;
  color: var(--navy); font-weight: 700; font-size: 1rem; cursor: pointer; text-align: start;
}
.menu-row:last-child { border-bottom: 0; }
.menu-row b { color: var(--muted); font-size: 1.4rem; }
.menu-row.out { color: var(--red); }

/* ===== الشريط السفلي (موبايل) ===== */
.tabbar { display: none; }
@media (max-width: 760px) {
  .nav-toggle, .nav { display: none !important; }
  .brand-text small { display: none; }
  body { padding-bottom: 76px; }
  .site-footer { margin-bottom: 0; }
  .tabbar {
    display: flex; position: fixed; bottom: 0; inset-inline: 0; z-index: 60;
    background: #fff; border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 18px rgba(11, 42, 91, .08);
  }
  .tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px;
    color: var(--muted); font-size: .72rem; font-weight: 700; padding: 4px 0;
  }
  .tabbar svg { width: 24px; height: 24px; stroke: var(--muted); }
  .tabbar a.on { color: var(--navy); }
  .tabbar a.on svg { stroke: var(--navy); }
  .tabbar .tab-add { margin-top: -26px; color: var(--red); }
  .tabbar .tab-add i {
    width: 56px; height: 56px; border-radius: 50%; background: var(--red); display: grid; place-items: center;
    box-shadow: 0 6px 16px rgba(198, 40, 40, .45); border: 4px solid #fff;
  }
  .tabbar .tab-add svg { stroke: #fff; stroke-width: 2.4; width: 26px; height: 26px; }
  .toast { bottom: 96px; }
}

/* ===== الشريط المتحرك ===== */
.ticker { background: var(--red); color: #fff; overflow: hidden; white-space: nowrap; font-weight: 700; font-size: .9rem; direction: ltr; }
.ticker-track { display: inline-flex; padding: 8px 0; animation: tick 45s linear infinite; }
.ticker-track span { padding: 0 34px; }
.ticker-track span::before { content: "\2022"; margin-inline-end: 34px; opacity: .7; }
.ticker-track span { unicode-bidi: plaintext; }
@keyframes tick { from { transform: translateX(-25%); } to { transform: translateX(0); } }
@media (prefers-reduced-motion: reduce) { .ticker-track { animation: none; } }
.ticker-track span { direction: rtl; }
html[dir="ltr"] .ticker-track span { direction: ltr; }

/* ===== اللغة / الأدوار / التواصل ===== */
.lang-btn { background: rgba(255,255,255,.12); border: 0; color: #fff; font-weight: 800; border-radius: 10px; padding: 8px 12px; cursor: pointer; }
.badge.b-role { background: #5b6b8c; }
.role-switch .radio { padding: 10px 6px; font-size: .95rem; }
.check { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; font-size: .9rem; color: #3a4560; cursor: pointer; }
.check input { margin-top: 5px; width: 18px; height: 18px; flex: none; }
.contact-box { white-space: normal !important; }
.lister { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; color: var(--navy); font-size: 1.05rem; }
.contact-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.contact-actions .btn { flex: 1; min-width: 130px; }
html[dir="ltr"] .back { direction: ltr; }
[hidden] { display: none !important; }

/* ===== ضبط الهيدر على الشاشات المتوسطة ===== */
.brand { flex: none; }
.brand-text { white-space: nowrap; }
@media (min-width: 761px) {
  .nav { flex: 1; flex-wrap: wrap; justify-content: flex-end; gap: 2px; }
  .nav a, .linklike { padding: 6px 10px; font-size: .88rem; }
  .header-inner { gap: 10px; }
}
@media (min-width: 761px) and (max-width: 1250px) { .brand-text small { display: none; } }

/* ===== زرار جوجل ===== */
.btn-google {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  background: #fff; color: #1c2540; border: 1px solid var(--line); border-radius: 14px;
  padding: 13px 16px; font-weight: 700; cursor: pointer; box-shadow: 0 2px 8px rgba(11,42,91,.08);
}
.btn-google:hover { background: #f6f8fc; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .85rem; margin: 16px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.counter { direction: ltr; unicode-bidi: isolate; }

/* ===== تصفح المناطق ===== */
.browse { margin: 8px 0 30px; }
.browse h3 { margin: 14px 0 8px; font-size: 1.05rem; }
.browse h3 a { color: var(--navy); }
.browse-links { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.browse-links a { background: #fff; border: 1px solid var(--line); color: var(--navy); border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: .88rem; }
.browse-links a:hover { background: var(--navy); color: #fff; }

.forgot { margin: 10px 0 0; text-align: start; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--red); font-weight: 700; cursor: pointer; text-decoration: underline; font-size: .92rem; }
