@font-face { font-family: 'Cairo Black'; src: url('assets/Cairo-Black.ttf') format('truetype'); font-weight: 900; }
:root, [data-theme="rouge"] {
  --primary: #6E1423; --primary-dark: #4d0d18; --accent: #a31630; --gold: #b08a3c;
  --bg: #faf5ef; --surface: #ffffff; --sand: #f1e6d8; --ink: #2b2320; --muted: #7a6a63;
  --border: #e3d5c6; --ok: #1e7d46; --danger: #b3261e;
}
[data-theme="nuit"] {
  --primary: #12284b; --primary-dark: #0a1a33; --accent: #1f4e8c; --gold: #c9a227;
  --bg: #f2f5fa; --surface: #ffffff; --sand: #e3eaf4; --ink: #1d2735; --muted: #5f7089;
  --border: #cfdaea; --ok: #1e7d46; --danger: #b3261e;
}
[data-theme="olive"] {
  --primary: #44551f; --primary-dark: #2e3a14; --accent: #5d742c; --gold: #b08a3c;
  --bg: #f7f7ef; --surface: #ffffff; --sand: #e9ecd9; --ink: #2a2c20; --muted: #71755f;
  --border: #d8dcc2; --ok: #1e7d46; --danger: #b3261e;
}
[data-theme="sable"] {
  --primary: #8a5a2b; --primary-dark: #5f3d1b; --accent: #b07a3c; --gold: #8a5a2b;
  --bg: #faf6ef; --surface: #ffffff; --sand: #efe3cf; --ink: #33291d; --muted: #857257;
  --border: #e2d2b4; --ok: #1e7d46; --danger: #b3261e;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--ink); }
[dir="rtl"] body, body.rtl { font-family: 'Segoe UI', system-ui, sans-serif; }
a { color: var(--primary); text-decoration: none; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--ink); }
label { display: block; font-size: .85rem; color: var(--muted); margin: 8px 0 4px; }
h1, h2, h3 { color: var(--primary-dark); }

/* ---------- nombres / téléphones en contexte RTL ---------- */
.ltr-num { direction: ltr; unicode-bidi: isolate; display: inline-block; }
a[href^="tel:"], a[href^="mailto:"] { unicode-bidi: isolate; }
.price { direction: ltr; unicode-bidi: isolate; }

/* ---------- en-tête ---------- */
#site-header { background: var(--surface); border-bottom: 3px solid var(--primary); position: sticky; top: 0; z-index: 500; }
.topbar { background: var(--primary-dark); }
.topbar-inner { max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 10px 18px; flex-wrap: wrap; padding: 5px 16px; }
.topbar .main-nav { margin-inline-start: 0; gap: 14px; }
.topbar .main-nav a { color: #fff; font-size: .9rem; }
.topbar .main-nav a:hover { color: #f7d774; }
.topbar .lang-switch button { background: transparent; color: #fff; border-color: rgba(255,255,255,.45); }
.topbar .lang-switch button.active { background: #fff; color: var(--primary-dark); border-color: #fff; font-weight: 700; }
.header-inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; gap: 18px; padding: 8px 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { height: 74px; width: auto; }
.brand-names { display: flex; flex-direction: column; line-height: 1.15; }
.brand-ar { font-family: 'Cairo Black', sans-serif; font-size: 1.45rem; color: var(--primary); }
.brand-lat { font-weight: 700; font-size: 1.05rem; color: var(--primary-dark); letter-spacing: .04em; }
.brand-tag1 { color: var(--gold); font-size: .82rem; font-weight: 600; }
.brand-tag2 { color: var(--primary); font-size: .82rem; }
.main-nav { display: flex; gap: 16px; margin-inline-start: auto; flex-wrap: wrap; }
.main-nav a { font-weight: 600; color: var(--primary-dark); }
.main-nav a:hover { color: var(--accent); }
.lang-switch { display: flex; gap: 4px; }
.lang-switch button { border: 1px solid var(--border); background: var(--sand); border-radius: 999px; padding: 4px 10px; font-size: .8rem; }
.lang-switch button.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- pied de page ---------- */
#site-footer { background: var(--primary-dark); color: #f5e9e2; margin-top: 48px; }
.footer-inner { max-width: 1200px; margin: 0 auto; padding: 26px 16px; display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.footer-logo { height: 64px; background: #fdfaf6; border-radius: 10px; padding: 4px; }
.footer-names { display: flex; flex-direction: column; }
.footer-names .brand-ar { color: #f7d774; }
.footer-names .brand-lat { color: #fff; }
.footer-contact { margin-inline-start: auto; font-size: .9rem; line-height: 1.7; }
.footer-contact a { color: #f7d774; }

/* ---------- bannière ---------- */
.banner { position: relative; max-width: 1200px; margin: 18px auto 0; border-radius: 16px; overflow: hidden; box-shadow: 0 8px 28px rgba(0,0,0,.18); }
.banner-slide { display: none; }
.banner-slide.active { display: block; }
.banner-slide img { width: 100%; height: 380px; object-fit: cover; display: block; }
.banner-slide.emblem { background: #3d0a13; }
.banner-slide.emblem img { object-fit: contain; background: #3d0a13; }
.banner-dots { position: absolute; bottom: 12px; left: 0; right: 0; display: flex; justify-content: center; gap: 7px; }
.banner-dots button { width: 11px; height: 11px; border-radius: 50%; border: 2px solid #fff; background: transparent; padding: 0; }
.banner-dots button.active { background: #fff; }
.banner-arrow { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,.35); color: #fff; border: 0; width: 38px; height: 38px; border-radius: 50%; font-size: 1.2rem; }
.banner-arrow.prev { inset-inline-start: 10px; } .banner-arrow.next { inset-inline-end: 10px; }

/* ---------- disposition générale ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px; box-shadow: 0 2px 10px rgba(0,0,0,.04); }
.btn { display: inline-block; border: 0; border-radius: 10px; padding: 9px 16px; background: var(--primary); color: #fff; font-weight: 600; }
.btn:hover { background: var(--accent); }
.btn.secondary { background: var(--sand); color: var(--primary-dark); }
.btn.ghost { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn.danger { background: var(--danger); }
.btn.small { padding: 5px 10px; font-size: .85rem; border-radius: 8px; }
.btn.whatsapp { background: #1faa57; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- recherche ---------- */
.tabs { display: flex; gap: 8px; margin: 22px 0 0; }
.tabs button { border: 1px solid var(--border); border-bottom: 0; background: var(--sand); padding: 10px 22px; border-radius: 12px 12px 0 0; font-weight: 700; color: var(--primary-dark); }
.tabs button:hover { background: var(--border); }
.tabs button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.tabs button.active:hover { background: var(--accent); }
.search-card { border-radius: 0 14px 14px 14px; }
[dir="rtl"] .search-card { border-radius: 14px 0 14px 14px; }
.mgmt-panel .page-title:first-child { margin-top: 0; }
.search-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px 14px; }
.search-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; align-items: center; }
.checks { display: flex; gap: 12px; flex-wrap: wrap; }
.checks label { display: flex; gap: 5px; align-items: center; color: var(--ink); margin: 0; font-size: .9rem; }
.toolbar { display: flex; gap: 10px; align-items: center; margin: 18px 0 12px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 7px 14px; font-weight: 600; }
.seg button.active { background: var(--primary); color: #fff; }

/* ---------- résultats ---------- */
table.results { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
table.results th { background: var(--primary); color: #fff; text-align: start; padding: 10px; font-size: .88rem; }
table.results td { padding: 10px; border-top: 1px solid var(--border); vertical-align: middle; }
table.results tr:hover td { background: var(--bg); }
table.results img.thumb { width: 92px; height: 62px; object-fit: cover; border-radius: 8px; }
.price { font-weight: 800; color: var(--primary); white-space: nowrap; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.prop-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; cursor: pointer; }
.prop-card img { width: 100%; height: 170px; object-fit: cover; display: block; }
.prop-card .pc-body { padding: 12px 14px; }
.prop-card .price { font-size: 1.05rem; margin: 2px 0 4px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 12px; }
.chip { background: var(--sand); border-radius: 999px; padding: 2px 9px; font-size: .78rem; color: var(--primary-dark); }
.prop-card h3 { margin: 0 0 6px; font-size: 1rem; }
#map { height: 480px; border-radius: 14px; border: 1px solid var(--border); }
.empty { text-align: center; padding: 34px 10px; color: var(--muted); }

/* ---------- demande personnalisée (accueil) ---------- */
.cta-perso { border: 2px solid var(--accent); background: #f9ecea; border-radius: 18px; padding: 28px 30px; margin-top: 30px; }
[data-theme="nuit"] .cta-perso, [data-theme="olive"] .cta-perso, [data-theme="sable"] .cta-perso { background: var(--sand); }
.cta-perso h2 { font-family: Georgia, 'Times New Roman', serif; font-weight: 500; font-size: 1.7rem; color: var(--ink); margin: 0 0 14px; }
.cta-perso p { color: var(--muted); font-size: 1.08rem; line-height: 1.65; margin: 0 0 22px; max-width: 640px; }
.cta-perso-btn { display: block; width: 100%; padding: 16px; font-size: 1.15rem; border-radius: 14px; }

/* ---------- fiche bien ---------- */
.detail-head { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; margin: 20px 0 10px; }
.gallery { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }
.gallery img.main { width: 100%; height: 420px; object-fit: cover; border-radius: 14px; }
.gallery .thumbs { display: flex; flex-direction: column; gap: 10px; }
.gallery .thumbs img { width: 100%; height: 132px; object-fit: cover; border-radius: 10px; cursor: pointer; opacity: .85; }
.gallery .thumbs img.active { opacity: 1; outline: 3px solid var(--primary); }
.spec-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 16px 0; }
.spec { background: var(--sand); border-radius: 10px; padding: 10px 12px; }
.spec b { display: block; color: var(--primary-dark); }
.contact-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

/* ---------- formulaires / pages ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px 16px; }
textarea { width: 100%; min-height: 90px; }
.page-title { margin: 26px 0 12px; }
.page-section { margin-top: 36px; scroll-margin-top: 150px; }
.about-band { width: 100%; border-radius: 14px; margin: 14px 0; }
.pre-line { white-space: pre-line; line-height: 1.75; }

/* ---------- modale / toast ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(20,8,10,.55); z-index: 900; display: flex; align-items: flex-start; justify-content: center; overflow: auto; padding: 26px 10px; }
.modal { background: var(--surface); border-radius: 16px; max-width: 760px; width: 100%; padding: 22px; }
.modal.wide { max-width: 1000px; }
.modal-head { display: flex; align-items: center; gap: 10px; }
.modal-head h2 { margin: 0; flex: 1; }
#toast { position: fixed; bottom: 18px; inset-inline-start: 50%; transform: translateX(-50%); background: var(--primary-dark); color: #fff; padding: 10px 18px; border-radius: 999px; opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 1200; max-width: 92vw; text-align: center; }
[dir="rtl"] #toast { transform: translateX(50%); }
#toast.show { opacity: 1; }

/* ---------- administration ---------- */
.admin-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 18px 0; }
.admin-tabs button { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 7px 14px; font-weight: 600; }
.admin-tabs button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
table.admin { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; font-size: .92rem; }
table.admin th { background: var(--sand); color: var(--primary-dark); text-align: start; padding: 8px 10px; }
table.admin td { padding: 8px 10px; border-top: 1px solid var(--border); vertical-align: top; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--sand); color: var(--primary-dark); }
.badge.ok { background: #dff2e4; color: var(--ok); }
.badge.warn { background: #fdeeda; color: #9a6206; }
.badge.ko { background: #fbe3e1; color: var(--danger); }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.mini { font-size: .82rem; color: var(--muted); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.calendar-cell { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; min-height: 96px; padding: 6px; font-size: .8rem; }
.calendar-cell.today { outline: 2px solid var(--primary); }
.calendar-cell .appt { background: var(--sand); border-radius: 6px; padding: 2px 5px; margin-top: 4px; cursor: pointer; }
.photo-strip { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.photo-strip figure { margin: 0; position: relative; }
.photo-strip img { width: 110px; height: 76px; object-fit: cover; border-radius: 8px; }
.photo-strip figcaption { display: flex; gap: 3px; margin-top: 3px; }
.photo-strip figcaption button { padding: 2px 6px; font-size: .72rem; }
@media (max-width: 720px) {
  .banner-slide img { height: 230px; }
  .gallery { grid-template-columns: 1fr; }
  .gallery img.main { height: 260px; }
  .brand-ar { font-size: 1.15rem; }
  .brand-logo { height: 58px; }
  table.results th:nth-child(4), table.results td:nth-child(4) { display: none; }
}

/* ---------- notifications admin (cloche + enveloppe) ---------- */
.bell-wrap { position: relative; }
.bell-btn { position: relative; border: 1px solid var(--border); background: var(--surface); border-radius: 999px; width: 40px; height: 40px; font-size: 1.05rem; line-height: 1; }
.bell-badge { position: absolute; top: -6px; inset-inline-end: -6px; background: var(--danger); color: #fff; font-size: .68rem; font-weight: 800; min-width: 19px; height: 19px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; border: 2px solid var(--bg); }
.bell-drop { position: absolute; top: 48px; inset-inline-end: 0; width: 360px; max-width: 92vw; max-height: 70vh; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 14px 40px rgba(0,0,0,.22); z-index: 950; text-align: start; }
.bell-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.notif-item { padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: .9rem; }
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: #fdf3f2; }
.notif-item .notif-top { display: flex; gap: 6px; align-items: center; margin-bottom: 3px; }
.tab-count { font-weight: 800; }

/* ---------- impression (relevés propriétaire) ---------- */
@media print {
  #site-header, #site-footer, #toast, .modal-back { display: none !important; }
  body { background: #fff; }
}
