:root {
  --green: #0F7B4F;
  --green-dark: #0A5C3A;
  --green-soft: #E7F4EC;
  --sand: #F4C55A;
  --sand-soft: #FDF4DD;
  --ink: #1B2420;
  --muted: #66736C;
  --line: #E3E8E4;
  --bg: #F7F8F5;
  --white: #fff;
  --red: #C0392B;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(16, 40, 28, .08);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink); background: var(--bg); line-height: 1.5; font-size: 16px;
  min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; outline: none; }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hidden { display: none !important; }

/* ---------- Top bar ---------- */
.topbar { background: var(--white); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 66px; gap: 12px; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.logo:hover { text-decoration: none; }
.logo img { border-radius: 10px; }
.logo-text { display: flex; flex-direction: column; line-height: 1.05; }
.logo-text strong { font-size: 1.2rem; letter-spacing: -.02em; }
.logo-text small { color: var(--green); font-size: .78rem; }
.nav { display: flex; align-items: center; gap: 6px; }
.nav .navlink { white-space: nowrap; } .nav a.navlink { color: var(--ink); padding: 8px 12px; border-radius: 10px; font-weight: 500; font-size: .95rem; }
.nav a.navlink:hover { background: var(--bg); text-decoration: none; }
.nav .btn { margin-left: 4px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 12px; border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer; transition: .15s;
  background: var(--white); color: var(--ink); border-color: var(--line); text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; border-color: #cfd8d2; }
.btn-primary { background: var(--green); color: #fff; border-color: var(--green); }
.btn-primary:hover { background: var(--green-dark); border-color: var(--green-dark); }
.btn-sand { background: var(--sand); color: #3b2a00; border-color: var(--sand); }
.btn-sand:hover { filter: brightness(.96); }
.btn-whatsapp { background: #25D366; color: #fff; border-color: #25D366; }
.btn-whatsapp:hover { filter: brightness(.95); }
.btn-danger { color: var(--red); }
.btn-danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { padding: 7px 12px; font-size: .85rem; border-radius: 10px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: wait; }

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 6px; }
.field { margin-bottom: 16px; }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=number], input[type=tel], input[type=search], select, textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px;
  font: inherit; background: var(--white); color: var(--ink); transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
textarea { min-height: 140px; resize: vertical; }
.phone-input { display: flex; direction: ltr; }
.phone-input span { padding: 12px 12px; border: 1px solid var(--line); border-right: 0; border-radius: 12px 0 0 12px; background: var(--bg); color: var(--muted); font-weight: 600; }
.phone-input input { border-radius: 0 12px 12px 0; min-width: 0; flex: 1; }
.phone-input select.cc { width: 118px; flex: none; border-radius: 12px 0 0 12px; border-right: 0; background: var(--bg); font-weight: 600; padding: 12px 8px; font-size: .9rem; text-overflow: ellipsis; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: .92rem; margin: 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--green); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.segmented { display: flex; gap: 8px; flex-wrap: wrap; }
.segmented label { margin: 0; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: inline-block; padding: 10px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); font-weight: 600; cursor: pointer; font-size: .9rem; }
.segmented input:checked + span { background: var(--green-soft); border-color: var(--green); color: var(--green-dark); }
.form-error { background: #FDECEA; color: var(--red); padding: 10px 14px; border-radius: 12px; margin-bottom: 14px; font-size: .92rem; }
.form-ok { background: var(--green-soft); color: var(--green-dark); padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; font-size: .95rem; }
.hint { font-size: .82rem; color: var(--muted); margin-top: 6px; }

/* ---------- Hero ---------- */
.hero {
  background:
    radial-gradient(circle at 85% 20%, rgba(244,197,90,.35), transparent 40%),
    linear-gradient(135deg, #0A5C3A 0%, #0F7B4F 55%, #2E9466 100%);
  color: #fff; padding: 64px 0 90px; position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; inset-inline-end: -60px; bottom: -40px; width: 420px; height: 300px; opacity: .12;
  background: url("/favicon.svg") no-repeat center / contain;
}
.hero .badge { display: inline-block; background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.25); padding: 6px 14px; border-radius: 999px; font-size: .85rem; font-weight: 600; margin-bottom: 18px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.3rem); font-weight: 800; letter-spacing: -.03em; max-width: 720px; }
.hero p { font-size: 1.1rem; opacity: .92; max-width: 620px; margin: 0 0 8px; }
.search-card {
  background: var(--white); color: var(--ink); border-radius: 18px; box-shadow: 0 18px 50px rgba(0,0,0,.18);
  padding: 18px; margin-top: -56px; position: relative; z-index: 2;
}
.search-grid { display: grid; grid-template-columns: 1.1fr 1.1fr 1.2fr 1fr 1fr auto; gap: 10px; align-items: end; }
.search-grid label { font-size: .78rem; color: var(--muted); margin-bottom: 4px; }
.search-grid .btn { height: 47px; }

/* ---------- Sections ---------- */
.section { padding: 48px 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.section-head h2 { font-size: 1.6rem; letter-spacing: -.02em; margin: 0; }
.section-head p { margin: 4px 0 0; }
.stats { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 22px; }
.stats div { font-size: .95rem; color: var(--muted); }
.stats strong { color: var(--ink); font-size: 1.15rem; margin-right: 4px; }
.cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.cat { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 12px; text-align: center; color: var(--ink); font-weight: 600; font-size: .92rem; transition: .15s; }
.cat:hover { border-color: var(--green); text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); }
.cat .ico { font-size: 1.7rem; display: block; margin-bottom: 6px; }

/* ---------- Listing cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: var(--ink); display: flex; flex-direction: column; transition: .15s; }
.card:hover { text-decoration: none; box-shadow: var(--shadow); transform: translateY(-2px); }
.card-img { aspect-ratio: 4 / 3; background: var(--green-soft); position: relative; overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-img .noimg { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 2.6rem; }
.tag { position: absolute; top: 10px; inset-inline-start: 10px; background: rgba(255,255,255,.95); color: var(--green-dark); font-size: .75rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.tag-status { inset-inline-start: auto; inset-inline-end: 10px; background: var(--ink); color: #fff; }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.price { font-weight: 800; font-size: 1.15rem; color: var(--green-dark); }
.price small { font-weight: 600; font-size: .8rem; color: var(--muted); }
.card-title { font-weight: 600; font-size: .98rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-loc { color: var(--muted); font-size: .88rem; }
.card-meta { display: flex; gap: 12px; color: var(--muted); font-size: .82rem; margin-top: auto; padding-top: 8px; }

.empty { background: var(--white); border: 1px dashed #cfd8d2; border-radius: var(--radius); padding: 40px 20px; text-align: center; }
.empty .ico { font-size: 2.4rem; }
.empty h3 { margin: 10px 0 6px; }

/* ---------- Results page ---------- */
.results-layout { display: grid; grid-template-columns: 280px 1fr; gap: 24px; align-items: start; padding: 28px 0 48px; }
.filters { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; position: sticky; top: 84px; }
.filters h3 { font-size: 1.05rem; }
.results-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.results-bar select { width: auto; }
.filters-toggle { display: none; }

/* ---------- Detail page ---------- */
.detail { padding: 24px 0 56px; }
.breadcrumb { font-size: .88rem; color: var(--muted); margin-bottom: 14px; }
.detail-layout { display: grid; grid-template-columns: 1fr 360px; gap: 28px; align-items: start; }
.gallery-main { aspect-ratio: 16 / 10; border-radius: var(--radius); overflow: hidden; background: var(--green-soft); position: relative; }
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.gallery-main .noimg { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 4rem; }
.gallery-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,.92); border: 0; width: 40px; height: 40px; border-radius: 50%; font-size: 1.2rem; cursor: pointer; }
.gallery-nav.prev { inset-inline-start: 12px; } .gallery-nav.next { inset-inline-end: 12px; }
.gallery-count { position: absolute; bottom: 12px; inset-inline-end: 12px; background: rgba(0,0,0,.6); color: #fff; padding: 3px 10px; border-radius: 999px; font-size: .8rem; }
.thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; }
.thumbs button { border: 2px solid transparent; padding: 0; border-radius: 10px; overflow: hidden; width: 84px; height: 64px; flex: none; cursor: pointer; background: none; }
.thumbs button.active { border-color: var(--green); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-top: 18px; }
.panel h2 { font-size: 1.15rem; }
.detail h1 { font-size: 1.6rem; letter-spacing: -.02em; margin-top: 18px; }
.detail .price { font-size: 1.6rem; }
.specs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.spec { background: var(--bg); border-radius: 12px; padding: 12px; }
.spec small { display: block; color: var(--muted); font-size: .78rem; }
.spec strong { font-size: 1rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--green-soft); color: var(--green-dark); padding: 6px 12px; border-radius: 999px; font-size: .85rem; font-weight: 600; }
.description { white-space: pre-line; }
.side { position: sticky; top: 84px; }
.side .panel:first-child { margin-top: 0; }
.owner { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--green); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.1rem; flex: none; }
.phone-big { font-size: 1.3rem; font-weight: 800; letter-spacing: .02em; margin: 4px 0 14px; }
.contact-actions { display: grid; gap: 10px; }
.locked { background: var(--sand-soft); border-radius: 12px; padding: 14px; font-size: .92rem; margin-bottom: 12px; }
.mobile-contact { display: none; }

/* ---------- Auth ---------- */
.auth-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 0; max-width: 980px; margin: 40px auto; background: var(--white); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.auth-form { padding: 36px; }
.auth-form h1 { font-size: 1.7rem; letter-spacing: -.02em; }
.auth-side { background: linear-gradient(160deg, #0A5C3A, #0F7B4F); color: #fff; padding: 36px; }
.auth-side ul { padding: 0; list-style: none; margin: 18px 0 0; display: grid; gap: 14px; }
.auth-side li { display: flex; gap: 10px; }
.auth-single { max-width: 460px; margin: 48px auto; background: var(--white); border: 1px solid var(--line); border-radius: 20px; padding: 32px; }

/* ---------- Post form ---------- */
.form-page { max-width: 860px; margin: 0 auto; padding: 28px 20px 56px; }
.form-section { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; }
.form-section h2 { font-size: 1.1rem; display: flex; align-items: center; gap: 10px; }
.step { width: 28px; height: 28px; border-radius: 50%; background: var(--green); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: .85rem; flex: none; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 12px; }
.photo-item { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--bg); border: 2px solid transparent; }
.photo-item.main { border-color: var(--green); }
.photo-item img { width: 100%; height: 100%; object-fit: cover; }
.photo-item .rm { position: absolute; top: 6px; inset-inline-end: 6px; background: rgba(0,0,0,.65); color: #fff; border: 0; width: 26px; height: 26px; border-radius: 50%; cursor: pointer; }
.photo-item .mk { position: absolute; bottom: 6px; left: 6px; right: 6px; background: rgba(255,255,255,.92); border: 0; border-radius: 8px; font-size: .72rem; font-weight: 700; padding: 4px; cursor: pointer; }
.drop { border: 2px dashed #cfd8d2; border-radius: 14px; padding: 26px; text-align: center; cursor: pointer; background: var(--bg); }
.drop:hover { border-color: var(--green); }
.sticky-submit { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 18px 0 8px; display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- Account ---------- */
.account { padding: 28px 0 56px; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 10px 16px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.active { color: var(--green-dark); border-color: var(--green); }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.my-list { display: grid; gap: 12px; }
.my-item { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: grid; grid-template-columns: 120px 1fr auto; gap: 16px; align-items: center; }
.my-item .thumb { width: 120px; height: 90px; border-radius: 10px; overflow: hidden; background: var(--green-soft); display: flex; align-items: center; justify-content: center; font-size: 2rem; }
.my-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.my-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; align-items: center; }
.my-actions select { width: auto; padding: 7px 10px; font-size: .85rem; border-radius: 10px; }
.status-pill { display: inline-block; font-size: .75rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--green-soft); color: var(--green-dark); }
.status-pill.pause { background: #EEF0EE; color: var(--muted); }
.status-pill.louee, .status-pill.vendue { background: var(--sand-soft); color: #7a5600; }

/* ---------- Misc ---------- */
.cities { display: flex; flex-wrap: wrap; gap: 10px; }
.cities a { background: var(--white); border: 1px solid var(--line); padding: 8px 16px; border-radius: 999px; color: var(--ink); font-weight: 500; }
.cities a:hover { border-color: var(--green); text-decoration: none; }
.faq details { background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin-bottom: 10px; }
.faq summary { font-weight: 600; cursor: pointer; }
.faq p { margin: 10px 0 0; color: var(--muted); }
.cta { background: var(--sand-soft); border-radius: 20px; padding: 36px; display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.cta h2 { margin: 0 0 4px; }
.prose { max-width: 760px; margin: 0 auto; padding: 36px 20px 56px; }
.prose h1 { font-size: 1.9rem; }
.prose h2 { font-size: 1.2rem; margin-top: 1.6em; }
.footer { background: #102219; color: #cfdcd4; margin-top: 40px; }
.footer a { color: #e7efe9; }
.footer .muted { color: #9fb2a7; }
.footer-inner { display: flex; justify-content: space-between; gap: 24px; padding: 36px 20px 20px; flex-wrap: wrap; }
.footer-links { display: flex; flex-direction: column; gap: 8px; }
.logo-footer { color: #fff; margin-bottom: 8px; }
.logo-footer small { color: var(--sand); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.08); padding: 14px 20px 22px; font-size: .85rem; }
.page-loading { padding: 80px 0; display: flex; justify-content: center; }
.spinner { width: 36px; height: 36px; border: 3px solid var(--line); border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 12px; opacity: 0; pointer-events: none; transition: .25s; z-index: 100; max-width: 90vw; font-size: .95rem; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--red); }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .search-grid { grid-template-columns: 1fr 1fr; }
  .search-grid .btn { grid-column: 1 / -1; }
  .detail-layout { grid-template-columns: 1fr; }
  .side { position: static; }
  .results-layout { grid-template-columns: 1fr; }
  .filters { position: static; display: none; }
  .filters.open { display: block; }
  .filters-toggle { display: inline-flex; }
  .auth-wrap { grid-template-columns: 1fr; margin: 20px; }
  .auth-side { display: none; }
}
@media (max-width: 720px) {
  .nav a.navlink.hide-sm { display: none; }
  .nav .btn-label { display: none; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .hero { padding: 40px 0 80px; }
  .my-item { grid-template-columns: 90px 1fr; }
  .my-item .thumb { width: 90px; height: 70px; }
  .my-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .mobile-contact { display: flex; position: fixed; left: 0; right: 0; bottom: 0; gap: 10px; padding: 10px 14px; background: var(--white); border-top: 1px solid var(--line); z-index: 40; }
  .mobile-contact .btn { flex: 1; }
  .detail { padding-bottom: 90px; }
  .auth-form, .auth-single { padding: 24px; }
  .cta { padding: 24px; }
}

/* ---------- Langue / arabe (RTL) ---------- */
.lang-btn { background: var(--green-soft); color: var(--green-dark) !important; border: 0; font: inherit; font-weight: 700; cursor: pointer; }
.lang-btn:hover { background: #d6ecdf !important; }
html[dir=rtl] body, html[dir=rtl] input, html[dir=rtl] select, html[dir=rtl] textarea, html[dir=rtl] button {
  font-family: "IBM Plex Sans Arabic", "Plus Jakarta Sans", system-ui, sans-serif;
}
html[dir=rtl] body { line-height: 1.7; }
html[dir=rtl] .hero h1, html[dir=rtl] .section-head h2, html[dir=rtl] h1 { letter-spacing: 0 !important; }
html[dir=rtl] .logo-text strong { letter-spacing: 0; }
input[type=email], input[type=tel], input[type=password] { direction: ltr; }
html[dir=rtl] input[type=email], html[dir=rtl] input[type=password] { text-align: right; }
html[dir=rtl] input[type=email]::placeholder { text-align: right; }
/* Téléphones : un champ par ligne pour laisser la place au choix du pays */
.grid-2:has(.phone-input) { grid-template-columns: 1fr; }
.phone-input select.cc { width: 150px; }
