/* ===== file: /assets/css/components/navbar.css =====
   NAVBAR – FINAL & STABLE (NORMAL + ADMIN)
   ✅ RTL/LTR layout
   ✅ Dropdowns (services)
   ✅ UserMenu (#userMenu / #authActions)
   ✅ Desktop:
      - logged out = تواصل الآن + تسجيل الدخول
      - logged in  = avatar only + dropdown (تواصل الآن / خروج)
   ✅ Mobile:
      - logged out = burger normal
      - logged in  = avatar only, no burger
      - mobile dropdown = pages + services + logout
   ✅ Navbar fixe
   ✅ Logo horizontal pro visible
==================================================== */

:root {
  --topbar-h: 74px;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1000;
  background: #76cdcd;
  border-bottom: 1px solid var(--border);
  /* Pas de backdrop-filter : le fond est opaque (#76cdcd) donc le flou est
     invisible, MAIS backdrop-filter ferait du .topbar le bloc conteneur de
     tous ses enfants position:fixed (burger, overlay, menu connecté), qui se
     retrouveraient calés sur la hauteur du navbar (~74px) au lieu du viewport
     → panneaux écrasés sur mobile et hauteur cassée sur Safari. */
  padding-inline: 12px;
  /* Police FIXE pour le navbar sur TOUTES les pages et dans toutes les
     langues. Sans cette ligne, le navbar hérite la police du <body>, qui
     diffère selon la page (index = Segoe UI via home.css, autres pages en
     français = Times New Roman par défaut). On force ici la police de la
     marque pour un navbar strictement identique partout. */
  font-family: system-ui, -apple-system, "Segoe UI", Tahoma, Arial, sans-serif;
}

/* =========================
   Layout principal
========================= */
.topbar .container.nav {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  min-width: 0;
  position: relative;
  /* Navbar identique sur TOUTES les pages (référence : index.html).
     Le conteneur du navbar occupe toute la largeur, sans max-width ni
     marge auto, pour que la barre soit uniforme partout. */
  max-width: none;
  /* width:100% écrase un éventuel `width: min(1100px, 92%)` hérité de main.css
     (chargé sur la page login) qui bridait le navbar et tronquait les liens. */
  width: 100%;
  margin-inline: 0;
  padding-inline: 0;
}

/* Sécurité overflow */
.topbar .brand,
.topbar .links,
.topbar .nav-actions,
.topbar .auth-actions {
  min-width: 0;
}

/* =========================
   BRAND / LOGO
========================= */
.topbar .brand {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  text-decoration: none;
  color: #0f172a;
  min-width: 0;
  gap: 0;
  flex: 0 0 auto;
  width: 160px;
  max-width: 160px;
  overflow: visible;
}

.topbar .brand.brand--logo-only {
  gap: 0;
}

.topbar .logo-img,
.topbar .brand-logo {
  display: block;
  width: 100%;
  height: 54px;
  max-width: 100%;
  object-fit: contain;
  object-position: right center;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  transform: none;
}

html[dir="ltr"] .topbar .logo-img,
html[dir="ltr"] .topbar .brand-logo {
  object-position: left center;
}

.topbar .brand-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.15;
  unicode-bidi: plaintext;
}

/* =========================
   LINKS (desktop)
========================= */
.topbar .links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
  min-width: 0;
  margin-inline: auto;
  flex: 1 1 auto;
}

/* boutons login + signup + CTA "publier" mobile cachés sur desktop */
.topbar .links .mobile-login-btn,
.topbar .links a.mobile-login-btn,
.topbar .links .mobile-signup-btn,
.topbar .links a.mobile-signup-btn,
.topbar .links .mobile-post-ad-btn,
.topbar .links a.mobile-post-ad-btn {
  display: none !important;
}

/* espace actions */
.topbar .nav-actions {
  margin-inline-start: 0;
}

html[dir="rtl"] .topbar .nav-actions {
  margin-inline-start: 0;
  margin-inline-end: 16px;
}

.topbar .links a {
  padding: 6px 8px;
  border-radius: 999px;
  text-decoration: none;
  color: rgba(15, 23, 42, 0.92);
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  display: inline-block;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

/* LTR (French) — compact navbar to keep everything on one line */
html[dir="ltr"] .topbar .brand {
  width: clamp(120px, 9vw, 155px);
  max-width: clamp(120px, 9vw, 155px);
}

html[dir="ltr"] .topbar .logo-img,
html[dir="ltr"] .topbar .brand-logo {
  height: 54px;
}

html[dir="ltr"] .topbar .container.nav {
  gap: 8px;
}

html[dir="ltr"] .topbar .nav-actions {
  gap: 8px;
  margin-inline-start: 0;
}

html[dir="ltr"] .topbar .links {
  gap: 4px;
}

html[dir="ltr"] .topbar .links a {
  padding: 6px 10px;
  max-width: none;
}

html[dir="ltr"] .topbar .post-ad-btn--nav {
  padding: 9px 12px;
  font-size: 13px;
}

.topbar .links a:hover,
.topbar .links a.active {
  background: rgba(255, 255, 255, 0.35);
  border-color: rgba(255, 255, 255, 0.35);
  color: #0f172a;
}

/* =========================
   ACTIONS
========================= */
.topbar .nav-actions,
.topbar .auth-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
  flex: 0 0 auto;
}

.topbar .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 900;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.28);
  color: #0f172a;
  backdrop-filter: blur(6px);
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.topbar .btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.38);
  border-color: rgba(255, 255, 255, 0.7);
}

/* Bouton « Se connecter » du navbar (rendu par auth.js quand déconnecté) —
   même style BLEU MARINE que le CTA « Se connecter » de la page signup, pour
   une cohérence sur toutes les pages. */
.topbar .topbar-login {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 999px;
  text-decoration: none;
  color: #ffffff;
  font-weight: 800;
  font-size: 13.5px;
  white-space: nowrap;
  background: linear-gradient(135deg, #0f766e, #14b8a6);
  border: 1px solid transparent;
  box-shadow: 0 8px 20px rgba(15, 118, 110, .3);
  transition: filter 0.15s ease, transform 0.15s ease;
}

.topbar .topbar-login:hover,
.topbar .topbar-login:focus-visible {
  filter: brightness(1.08);
  transform: translateY(-1px);
  color: #ffffff;
  background: linear-gradient(135deg, #0f766e, #14b8a6);
}

/* Remplace l'icône 👤 (personne) rendue par auth.js par l'icône log-in (porte→),
   identique au CTA « Se connecter » de signup — fait en CSS pour éviter de
   toucher auth.js (importé sans version → cascade de cache). */
.topbar .topbar-login__icon {
  display: none;
}

.topbar .topbar-login::before {
  content: "";
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.1' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4'/%3E%3Cpolyline points='10 17 15 12 10 7'/%3E%3Cline x1='15' y1='12' x2='3' y2='12'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Page login : pas de « Se connecter » (on y est déjà). Le CTA orange du navbar
   est devenu « Créer un compte » (→ signup, dans le HTML de login.html), donc on
   masque aussi le « Créer un compte » outline en double dans le burger.
   L'ID #mobileLinks passe DEVANT la règle d'affichage `body.auth-logged-out …`. */
body.login-page .topbar .topbar-login,
body.login-page .topbar #mobileLinks .mobile-login-btn,
body.login-page .topbar #mobileLinks a.mobile-login-btn,
body.login-page .topbar #mobileLinks .mobile-signup-btn,
body.login-page .topbar #mobileLinks a.mobile-signup-btn {
  display: none !important;
}

/* Page login : « Créer un compte » en BLEU MARINE (pas l'orange de publier).
   #mobileLinks pour passer devant la règle orange du burger (même spécificité). */
body.login-page .topbar .post-ad-btn--nav,
body.login-page .topbar #mobileLinks .mobile-post-ad-btn {
  background: linear-gradient(135deg, #0f766e, #14b8a6) !important;
  color: #ffffff !important;
  box-shadow: 0 8px 20px rgba(15, 118, 110, .3) !important;
}

body.login-page .topbar .post-ad-btn--nav:hover,
body.login-page .topbar #mobileLinks .mobile-post-ad-btn:hover {
  filter: brightness(1.08);
}

/* Page signup : symétrique à login. Pas de « Se connecter » discret ni de
   « Créer un compte » en double (on y est déjà). Le CTA du navbar est devenu
   « Se connecter » (→ login, dans le HTML de signup.html). On masque donc le
   topbar-login, le « Se connecter » et le « Créer un compte » outline du burger. */
body.signup-page .topbar .topbar-login,
body.signup-page .topbar #mobileLinks .mobile-login-btn,
body.signup-page .topbar #mobileLinks a.mobile-login-btn,
body.signup-page .topbar #mobileLinks .mobile-signup-btn,
body.signup-page .topbar #mobileLinks a.mobile-signup-btn {
  display: none !important;
}

/* Page signup : « Se connecter » en BLEU MARINE (même style que le CTA login). */
body.signup-page .topbar .post-ad-btn--nav,
body.signup-page .topbar #mobileLinks .mobile-post-ad-btn {
  background: linear-gradient(135deg, #0f766e, #14b8a6) !important;
  color: #ffffff !important;
  box-shadow: 0 8px 20px rgba(15, 118, 110, .3) !important;
}

body.signup-page .topbar .post-ad-btn--nav:hover,
body.signup-page .topbar #mobileLinks .mobile-post-ad-btn:hover {
  filter: brightness(1.08);
}

/* Page signup-result (confirmation après inscription) : même logique que signup.
   CTA navbar = « Se connecter » (→ login). On masque le « Se connecter » discret
   et le « Créer un compte »/« Se connecter » outline du burger. */
body.sr-page .topbar .topbar-login,
body.sr-page .topbar #mobileLinks .mobile-login-btn,
body.sr-page .topbar #mobileLinks a.mobile-login-btn,
body.sr-page .topbar #mobileLinks .mobile-signup-btn,
body.sr-page .topbar #mobileLinks a.mobile-signup-btn {
  display: none !important;
}

body.sr-page .topbar .post-ad-btn--nav,
body.sr-page .topbar #mobileLinks .mobile-post-ad-btn {
  background: linear-gradient(135deg, #0f766e, #14b8a6) !important;
  color: #ffffff !important;
  box-shadow: 0 8px 20px rgba(15, 118, 110, .3) !important;
}

body.sr-page .topbar .post-ad-btn--nav:hover,
body.sr-page .topbar #mobileLinks .mobile-post-ad-btn:hover {
  filter: brightness(1.08);
}

/* Page confirm (confirmation e-mail) : même logique que signup/signup-result.
   CTA navbar = « Se connecter » (→ login). On masque le « Se connecter » discret
   et le « Créer un compte »/« Se connecter » outline du burger. */
body.confirm-page .topbar .topbar-login,
body.confirm-page .topbar #mobileLinks .mobile-login-btn,
body.confirm-page .topbar #mobileLinks a.mobile-login-btn,
body.confirm-page .topbar #mobileLinks .mobile-signup-btn,
body.confirm-page .topbar #mobileLinks a.mobile-signup-btn {
  display: none !important;
}

body.confirm-page .topbar .post-ad-btn--nav,
body.confirm-page .topbar #mobileLinks .mobile-post-ad-btn {
  background: linear-gradient(135deg, #0f766e, #14b8a6) !important;
  color: #ffffff !important;
  box-shadow: 0 8px 20px rgba(15, 118, 110, .3) !important;
}

body.confirm-page .topbar .post-ad-btn--nav:hover,
body.confirm-page .topbar #mobileLinks .mobile-post-ad-btn:hover {
  filter: brightness(1.08);
}

/* Page forgot-password : même navbar que signup. CTA bleu marine « Se connecter »
   (→ login), et on masque le « Se connecter » discret + les outlines du burger.
   On masque AUSSI #userMenu : le flux reset par OTP crée une session (verifyOtp)
   donc auth.js afficherait l'avatar « connecté » pendant la saisie du nouveau
   mot de passe — on garde un navbar « déconnecté » cohérent avec un reset. */
body.forgot-page .topbar #userMenu,
body.forgot-page .topbar .topbar-login,
body.forgot-page .topbar #mobileLinks .mobile-login-btn,
body.forgot-page .topbar #mobileLinks a.mobile-login-btn,
body.forgot-page .topbar #mobileLinks .mobile-signup-btn,
body.forgot-page .topbar #mobileLinks a.mobile-signup-btn {
  display: none !important;
}

body.forgot-page .topbar .post-ad-btn--nav,
body.forgot-page .topbar #mobileLinks .mobile-post-ad-btn {
  background: linear-gradient(135deg, #0f766e, #14b8a6) !important;
  color: #ffffff !important;
  box-shadow: 0 8px 20px rgba(15, 118, 110, .3) !important;
}

body.forgot-page .topbar .post-ad-btn--nav:hover,
body.forgot-page .topbar #mobileLinks .mobile-post-ad-btn:hover {
  filter: brightness(1.08);
}

/* Page reset (flux recovery) : navbar 100 % focalisé. auth.js force déjà
   l'état déconnecté ; ici on masque « Se connecter », « Créer un compte » ET
   « Publier une annonce » (desktop + burger) — l'utilisateur réinitialise
   juste son mot de passe. */
body.reset-page .topbar #userMenu,
body.reset-page .topbar .topbar-login,
body.reset-page .topbar .post-ad-btn--nav,
body.reset-page .topbar #mobileLinks .mobile-login-btn,
body.reset-page .topbar #mobileLinks a.mobile-login-btn,
body.reset-page .topbar #mobileLinks .mobile-signup-btn,
body.reset-page .topbar #mobileLinks a.mobile-signup-btn,
body.reset-page .topbar #mobileLinks .mobile-post-ad-btn,
body.reset-page .topbar #mobileLinks a.mobile-post-ad-btn {
  display: none !important;
}

/* hide offers ONLY on desktop */
@media (min-width: 1367px) {
  .topbar .offers-btn {
    display: none !important;
  }
}

/* =========================
   AUTH STATE HELPERS
========================= */
.desktop-login-fallback {
  display: inline-flex;
}

body.auth-logged-in .desktop-login-fallback {
  display: none !important;
}

body.auth-logged-in .topbar .nav-actions>.btn.primary,
body.auth-logged-in .topbar .nav-actions>a.btn.primary {
  display: none !important;
}

/* =========================
   LANG CHIP (desktop navbar)
========================= */
.topbar .lang-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 6px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.7);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #0f172a;
  white-space: nowrap;
  backdrop-filter: blur(6px);
  transition: background 0.16s ease, transform 0.12s ease, border-color 0.16s ease;
  flex: 0 0 auto;
  /* Visually place the chip BEFORE the post-ad CTA (between nav links and CTA)
     without touching the DOM order — keeps the orange "Publier une annonce"
     button visually isolated next to the avatar/login, and groups lang
     preference with the navigation cluster. */
  order: -1;
}

.topbar .lang-chip:hover,
.topbar .lang-chip:focus-visible {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(255, 255, 255, 0.95);
  transform: translateY(-1px);
}

.topbar .lang-chip .lang-flag {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.topbar .lang-chip .lang-flag svg {
  width: 18px;
  height: 18px;
  display: block;
  border-radius: 50%;
}

.topbar .lang-chip .lang-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

/* Sélecteur de langue : visible AUSSI sur mobile, directement dans le navbar
   (et non plus dans le menu burger). Version compacte pour gagner de la place. */
@media (max-width: 1366px) {
  .topbar .lang-select {
    order: 0 !important;
  }
  .topbar .lang-chip {
    padding: 6px 7px !important;
    font-size: 11px !important;
    gap: 5px !important;
  }
  .topbar .lang-chip .lang-flag svg {
    width: 16px !important;
    height: 16px !important;
  }
}

/* =========================
   LANG OPTION (mobile dropdown item)
   Discrete chip on the end side — signals "current value" not "primary CTA".
========================= */
.lang-option__value {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 4px;
  background: transparent;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: rgba(15, 23, 42, 0.65);
}

.lang-option__value .lang-flag {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.lang-option__value .lang-flag svg {
  width: 16px;
  height: 16px;
  display: block;
  border-radius: 50%;
}

/* =========================
   LANG DROPDOWN (desktop) — clic sur le chip → choix العربية / Français
========================= */
.topbar .lang-select {
  position: relative;
  display: inline-flex;
}

.topbar .lang-chip__caret {
  font-size: 10px;
  line-height: 1;
  opacity: 0.7;
  transition: transform 0.15s ease;
}

.topbar .lang-select.is-open .lang-chip__caret {
  transform: rotate(180deg);
}

.topbar .lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  min-width: 170px;
  padding: 6px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.10);
  box-shadow: 0 18px 44px rgba(2, 6, 23, 0.20);
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 1200;
}

.topbar .lang-select.is-open .lang-menu {
  display: flex;
}

.topbar .lang-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  text-align: start;
  transition: background 0.13s ease;
}

.topbar .lang-menu__item:hover,
.topbar .lang-menu__item:focus-visible {
  background: rgba(15, 23, 42, 0.06);
}

.topbar .lang-menu__item.is-active {
  background: rgba(15, 118, 110, 0.08);
}

.topbar .lang-menu__flag {
  display: inline-flex;
  flex-shrink: 0;
}

.topbar .lang-menu__flag svg {
  width: 20px;
  height: 20px;
  display: block;
  border-radius: 50%;
}

.topbar .lang-menu__name {
  flex: 1 1 auto;
}

.topbar .lang-menu__check {
  flex-shrink: 0;
  color: #0f766e;
  opacity: 0;
}

.topbar .lang-menu__item.is-active .lang-menu__check {
  opacity: 1;
}

/* Legacy floating button — fully replaced by chip + option, hide it. */
.lang-float {
  display: none !important;
}

/* WhatsApp FAB — uniform polish across all pages. Auto-hide via .is-hidden
   set by JS on scroll-down; reappears on scroll-up. */
.whatsapp-float,
.wa-float {
  width: 50px !important;
  height: 50px !important;
  transition: transform 0.32s ease, opacity 0.28s ease, box-shadow 0.18s ease !important;
  box-shadow: 0 6px 18px rgba(37, 211, 102, 0.32), 0 2px 6px rgba(15, 23, 42, 0.16) !important;
}

.whatsapp-float svg,
.wa-float svg {
  width: 22px !important;
  height: 22px !important;
}

.whatsapp-float.is-hidden,
.wa-float.is-hidden {
  transform: translateY(150%) scale(0.85);
  opacity: 0;
  pointer-events: none;
}

/* =========================
   POST AD BUTTON
========================= */
.topbar .post-ad-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 900;
  text-decoration: none;
  border: none;
  background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
  color: #ffffff !important;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.35);
  font-size: inherit;
  font-family: inherit;
}

.topbar .post-ad-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: 0 6px 20px rgba(234, 88, 12, 0.48);
  color: #ffffff !important;
}

/* Desktop nav-actions button: visible on desktop */
.topbar .post-ad-btn--nav {
  display: inline-flex;
}

/* Mobile: icône seule à côté du burger + sélecteur de langue. Le texte
   « Publier une annonce » est trop long en français pour tenir avec le chip
   AR/FR, on n'affiche donc que le mégaphone sur mobile. */
@media (max-width: 1366px) {
  .topbar .post-ad-btn--nav {
    display: inline-flex !important;
    order: 1 !important;
    padding: 9px 11px !important;
    font-size: 13px !important;
    min-height: 40px !important;
  }
  .topbar .post-ad-btn--nav svg {
    display: inline-block !important;
  }
  .topbar .post-ad-btn--nav > span {
    display: none !important;
  }
}

@media (max-width: 640px) {
  .topbar .post-ad-btn--nav {
    padding: 8px 10px !important;
    min-height: 38px !important;
  }
}

/* Mobile + connecté : le bouton « Publier une annonce » est désormais dans le
   menu déroulant (MON ESPACE) → on masque l'icône orange en double de la barre
   du haut. Les déconnectés (qui n'ont pas l'entrée dans leur menu) la gardent. */
@media (max-width: 1366px) {
  body.auth-logged-in .topbar .post-ad-btn--nav {
    display: none !important;
  }
}

/* =========================
   CONTACT LINK (in .links)
========================= */
/* Connecté : on cache le contact du navbar UNIQUEMENT sur mobile (il est alors
   dans le menu utilisateur). Sur desktop, le contact reste visible dans le navbar,
   juste à côté de "الخدمات العقارية". */
@media (max-width: 1366px) {
  body.auth-logged-in .topbar .links .contact-link {
    display: none !important;
  }
}

/* Mobile: contact link inside burger now follows the standard item style
   (set globally on .topbar .links a). No teal override anymore — only
   visibility + a top divider to separate it visually from the nav group,
   matching the .user-menu__divider in the logged-in dropdown. */
@media (max-width: 1366px) {
  body.auth-logged-out .topbar .links .contact-link {
    display: flex !important;
    margin-top: 12px;
    position: relative;
  }

  /* Divider line above contact-link — uses ::after so ::before stays
     available for the .active page-indicator bar (avoids pseudo conflict). */
  body.auth-logged-out .topbar .links .contact-link::after {
    content: "";
    position: absolute;
    top: -9px;
    left: 2px;
    right: 2px;
    height: 1px;
    background: rgba(15, 23, 42, 0.1);
    pointer-events: none;
  }
}

/* User dropdown item (logged-in) */
.user-menu__item.post-ad-item {
  background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%) !important;
  color: #ffffff !important;
  border-color: rgba(234, 88, 12, 0.4) !important;
}

.user-menu__item.post-ad-item:hover {
  background: linear-gradient(135deg, #fbbf24 0%, #f97316 100%) !important;
  border-color: rgba(234, 88, 12, 0.6) !important;
  color: #ffffff !important;
  transform: translateY(-1px);
}

/* ── انشروا إعلانكُم — Publier une annonce (CTA orange, menu mobile connecté) ── */
.user-menu__item--post-ad {
  background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%) !important;
  color: #ffffff !important;
  border-color: rgba(234, 88, 12, 0.35) !important;
  font-weight: 800 !important;
  letter-spacing: 0.3px;
  position: relative;
  overflow: hidden;
}

.user-menu__item--post-ad::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.14) 0%, transparent 60%);
  pointer-events: none;
}

.user-menu__item--post-ad:hover {
  background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%) !important;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.40) !important;
}

.user-menu__item--post-ad svg { flex-shrink: 0; }

/* ===== Cloche de notifications (utilisateur connecté) ===== */
.notif-bell { position: relative; display: inline-flex; align-items: center; }

.notif-bell__btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1.5px solid rgba(15, 23, 42, 0.12);
  background: #ffffff;
  color: #0f766e;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.notif-bell__btn:hover { background: #f0fdfa; border-color: #0f766e; }
.notif-bell__btn:active { transform: scale(0.95); }

.notif-bell__badge {
  position: absolute;
  top: -3px;
  inset-inline-end: -3px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

.notif-bell__badge[hidden] { display: none; }

.notif-bell__panel {
  position: absolute;
  top: calc(100% + 10px);
  inset-inline-end: 0;
  width: min(340px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: 70vh;
  overflow-y: auto;
  overflow-x: hidden;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 14px;
  box-shadow: 0 18px 44px rgba(2, 6, 23, 0.18);
  z-index: 1200;
  padding: 8px;
}

.notif-bell__panel[hidden] { display: none; }

.notif-bell__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px 10px;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 6px;
}

.notif-bell__head-title {
  font-weight: 800;
  font-size: 14px;
  color: #0f172a;
}

.notif-bell__markall {
  border: none;
  background: none;
  color: #0f766e;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  white-space: nowrap;
}

@media (hover: hover) {
  .notif-bell__markall:hover { background: #f0fdfa; text-decoration: underline; }
}

.notif-bell__empty {
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
  padding: 22px 8px;
}

.notif-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 8px;
  border-radius: 10px;
  text-decoration: none;
  color: #0f172a;
  transition: background 0.12s ease;
}

.notif-item:hover { background: #f8fafc; }
.notif-item.is-unread { background: #f0fdfa; }

.notif-item__icon {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 13px;
  color: #fff;
}

.notif-item__icon--ok { background: #16a34a; }
.notif-item__icon--no { background: #dc2626; }

/* Backdrop (mobile) : assombrit sous la navbar, la barre reste nette. Desktop : aucun. */
.notif-bell__backdrop {
  position: fixed;
  top: var(--topbar-h, 64px);
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.45);
  /* Sous la topbar (z-index:1000, qui crée un contexte d'empilement). Sinon le
     backdrop passe au-dessus du panneau — piégé dans le contexte de la topbar —
     et intercepte les taps (« Afficher tout » fermait le panneau sur mobile). */
  z-index: 999;
  display: none;
}

/* Mobile : panneau plein largeur sous la navbar (pro) */
@media (max-width: 1366px) {
  .notif-bell__backdrop:not([hidden]) { display: block; }

  .notif-bell__panel {
    position: fixed;
    top: calc(var(--topbar-h, 64px) + 6px);
    inset-inline: 8px;
    width: auto;
    max-width: none;
    max-height: min(72vh, calc(100vh - var(--topbar-h, 64px) - 24px));
    border-radius: 16px;
    z-index: 1200;
    box-shadow: 0 18px 44px rgba(2, 6, 23, 0.25);
    animation: notif-slide-down 0.22s ease;
  }
}

@keyframes notif-slide-down {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.notif-item__body { flex: 1 1 auto; min-width: 0; overflow: hidden; }
.notif-item__msg {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.notif-item__motif { font-size: 12px; color: #b91c1c; margin-top: 3px; }
.notif-item__time { font-size: 11px; color: #94a3b8; margin-top: 4px; }

.notif-bell__more {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 9px 8px;
  border: none;
  border-top: 1px solid #f1f5f9;
  background: transparent;
  color: #0f766e;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 0 0 8px 8px;
  transition: background 0.12s ease;
}

.notif-bell__more:hover { background: #f0fdfa; }

/* ── إعلاناتي — My Ads button ── */
.user-menu__item--my-ads {
  background: linear-gradient(135deg, #0f766e 0%, #14b8a6 100%) !important;
  color: #ffffff !important;
  border-color: rgba(15, 118, 110, 0.35) !important;
  font-weight: 700 !important;
  letter-spacing: 0.3px;
  position: relative;
  overflow: hidden;
}

.user-menu__item--my-ads::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.12) 0%, transparent 60%);
  pointer-events: none;
}

.user-menu__item--my-ads:hover {
  background: linear-gradient(135deg, #0f766e 0%, #14b8a6 100%) !important;
  border-color: rgba(59, 130, 246, 0.6) !important;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(15, 118, 110, 0.35) !important;
}

.user-menu__item--my-ads svg {
  opacity: 0.9;
}

/* =========================
   USER MENU
========================= */
.topbar :is(#userMenu, #authActions) {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 0 1 clamp(170px, 22vw, 360px);
  max-width: clamp(170px, 22vw, 360px);
  overflow: visible;
}

.topbar :is(#userMenu, #authActions) .user-menu {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  width: 100%;
  overflow: visible;
}

.topbar :is(#userMenu, #authActions) .user-menu__trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.28);
  color: #0f172a;
  cursor: pointer;
  line-height: 1.15;
  white-space: nowrap;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  backdrop-filter: blur(6px);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.topbar :is(#userMenu, #authActions) .user-menu__trigger:hover {
  background: rgba(255, 255, 255, 0.38);
  border-color: rgba(255, 255, 255, 0.7);
  transform: translateY(-1px);
}

html[dir="rtl"] .topbar :is(#userMenu, #authActions) .user-menu__trigger {
  flex-direction: row-reverse;
}

.topbar :is(#userMenu, #authActions) .user-menu__avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.16);
  overflow: hidden;
}

.topbar :is(#userMenu, #authActions) .user-menu__avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.topbar :is(#userMenu, #authActions) .user-menu__info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-width: 0;
}

html[dir="rtl"] .topbar :is(#userMenu, #authActions) .user-menu__info {
  align-items: flex-end;
  text-align: right;
}

.topbar :is(#userMenu, #authActions) .user-menu__name {
  font-size: 13px;
  font-weight: 900;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.topbar :is(#userMenu, #authActions) .user-menu__role {
  margin-top: 2px;
  font-size: 11px;
  font-weight: 800;
  opacity: 0.75;
  color: rgba(15, 23, 42, 0.8);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* =========================
   USER DROPDOWN
========================= */
.topbar :is(#userMenu, #authActions) .user-menu__dropdown {
  position: absolute;
  top: calc(100% + 6px);
  min-width: 260px;
  max-width: 280px;
  background: #fff;
  color: #0f172a;
  border-radius: 16px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.22);
  overflow: hidden;
  display: none;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 200;
  right: auto;
  left: auto;
}

html[dir="ltr"] .topbar :is(#userMenu, #authActions) .user-menu__dropdown {
  left: 0;
  right: auto;
}

html[dir="rtl"] .topbar :is(#userMenu, #authActions) .user-menu__dropdown {
  right: 0;
  left: auto;
}

.topbar :is(#userMenu, #authActions) .user-menu__dropdown.open {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.topbar :is(#userMenu, #authActions) .user-menu__dropdown::before {
  content: "";
  position: absolute;
  top: -6px;
  width: 12px;
  height: 12px;
  background: #fff;
  transform: rotate(45deg);
  border-left: 1px solid rgba(15, 23, 42, 0.12);
  border-top: 1px solid rgba(15, 23, 42, 0.12);
}

html[dir="rtl"] .topbar :is(#userMenu, #authActions) .user-menu__dropdown::before {
  right: 20px;
}

html[dir="ltr"] .topbar :is(#userMenu, #authActions) .user-menu__dropdown::before {
  left: 20px;
}

@media (min-width: 1367px) {
  .topbar :is(#userMenu, #authActions) .user-menu__dropdown {
    max-width: min(280px, calc(100vw - 24px));
  }
}

.user-menu__header {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 12px;
  background: rgba(15, 23, 42, 0.04);
  border-bottom: 1px solid rgba(15, 23, 42, 0.1);
}

html[dir="rtl"] .user-menu__header {
  flex-direction: row-reverse;
}

.user-menu__avatar--lg {
  width: 44px !important;
  height: 44px !important;
}

.user-menu__header-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.user-menu__body {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.user-menu__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: #fff;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  color: #0f172a;
  font-weight: 600;
  transition: background 0.15s ease, transform 0.12s ease, border-color 0.15s ease;
}

.user-menu__item:hover {
  background: rgba(15, 118, 110, 0.06);
  border-color: rgba(15, 118, 110, 0.18);
  transform: translateY(-1px);
}

.user-menu__item--danger {
  border-color: rgba(248, 113, 113, 0.55);
  color: #b91c1c;
}

.user-menu__item--danger:hover {
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.75);
}

.user-menu__item--success {
  border-color: rgba(34, 197, 94, 0.45);
  color: #15803d;
}

.user-menu__item--success:hover {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.7);
}

/* corps spécifiques desktop/mobile du dropdown */
.topbar .user-menu__body--desktop {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.topbar .user-menu__body--mobile {
  display: none;
}

/* mobile services inside user dropdown */
.topbar .user-menu__mobile-services {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.topbar .user-menu__mobile-services-menu {
  display: none;
  flex-direction: column;
  gap: 6px;
  margin-inline-start: 14px;
  padding-inline-start: 10px;
  border-inline-start: 2px solid rgba(15, 23, 42, 0.08);
}

.topbar .user-menu__mobile-services-menu.is-open {
  display: flex;
}

.topbar .user-menu__mobile-services-menu .user-menu__item {
  background: rgba(15, 23, 42, 0.025);
  border-color: rgba(15, 23, 42, 0.08);
  font-weight: 600;
}

.topbar .user-menu__mobile-services-menu .user-menu__item:hover {
  background: rgba(15, 118, 110, 0.06);
  border-color: rgba(15, 118, 110, 0.18);
}

/* Sous-items du menu connecté AVEC badge d'icône coloré (même rendu que le
   sous-menu Services du burger déconnecté). */
.topbar .user-menu__mobile-services-menu .user-menu__sub-item {
  justify-content: flex-start;
  gap: 10px;
}

.topbar .user-menu__mobile-services-menu .user-menu__sub-item .link-drop-menu__icon {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
}

.topbar .user-menu__mobile-services-menu .user-menu__sub-item .link-drop-menu__icon svg {
  width: 16px;
  height: 16px;
}

.topbar .user-menu__services-toggle {
  justify-content: space-between;
  font: inherit;
  font-size: inherit;
  font-weight: 600;
}

.topbar .user-menu__services-toggle span {
  font-size: inherit;
  font-weight: inherit;
}

.topbar .user-menu__services-caret {
  font-size: 14px;
  line-height: 1;
  flex: 0 0 auto;
  display: inline-block;
  transition: transform 0.2s ease, color 0.2s ease;
  color: #0f766e;
  font-weight: 900;
}

.topbar .user-menu__services-toggle[aria-expanded="true"] .user-menu__services-caret {
  transform: rotate(180deg);
}

/* Section labels inside mobile dropdown */
.user-menu__section-label {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: rgba(15, 23, 42, 0.6);
  padding: 6px 4px 8px;
  margin-top: 6px;
  text-align: start;
}

.user-menu__section-label:first-child {
  margin-top: 0;
  padding-top: 2px;
}

/* Section labels are mobile-only. They sit inside <nav class="links">, which
   on desktop becomes the horizontal navbar — so without this guard they'd
   render inline as big buttons next to the nav links. */
@media (min-width: 1367px) {
  .topbar .links .user-menu__section-label {
    display: none !important;
  }
}

/* L'option langue du burger est supprimée partout : le sélecteur AR/FR est
   désormais toujours visible dans le navbar (desktop ET mobile). */
.topbar .links > .js-lang-toggle {
  display: none !important;
}

/* Divider between groups (before contact + logout) */
.user-menu__divider {
  height: 1px;
  background: rgba(15, 23, 42, 0.08);
  margin: 8px 2px 4px;
  border: 0;
}

/* Hide floating FABs (WhatsApp + language switcher) when any mobile menu is open
   (user dropdown when logged in, burger menu when logged out). */
@media (max-width: 1366px) {
  body.user-menu-open .whatsapp-float,
  body.user-menu-open .wa-float,
  body.user-menu-open .lang-float,
  body.burger-menu-open .whatsapp-float,
  body.burger-menu-open .wa-float,
  body.burger-menu-open .lang-float {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: scale(0.85) !important;
    transition: opacity 0.18s ease, transform 0.18s ease;
  }
}

/* =========================
   DROPDOWN (services)
========================= */
.topbar .links-group {
  position: relative;
  flex: 0 0 auto;
}

.topbar .link-drop {
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 999px;
  color: rgba(15, 23, 42, 0.92);
  font: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.topbar .link-drop:hover,
.topbar .link-drop:focus-visible {
  background: rgba(255, 255, 255, 0.35);
  border-color: rgba(255, 255, 255, 0.35);
}

.topbar .link-drop-menu {
  position: absolute;
  top: 110%;
  inset-inline-end: 0;
  min-width: 210px;
  padding: 6px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.25);
  display: none;
  z-index: 110;
}

.topbar .link-drop-menu a {
  display: flex;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
}

.topbar .link-drop-menu a:hover {
  background: rgba(15, 118, 110, 0.06);
  border-color: rgba(15, 118, 110, 0.18);
}

/* =========================
   PRO SERVICES DROPDOWN
   Icon bubble + title + description, hover-to-open on desktop, accent hover.
========================= */
@media (min-width: 1367px) {
  .topbar .link-drop-menu {
    min-width: 320px;
    padding: 8px;
    border-radius: 16px;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18), 0 4px 12px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(15, 23, 42, 0.08);
    /* Hover-to-open: keep the menu mounted (display: block) but hide it via
       opacity/visibility so :hover on the group can fade it in instantly. */
    display: block;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0.18s;
  }

  /* Visible on hover of the wrapper OR when JS clicked it open (keyboard nav). */
  .topbar .links-group:hover .link-drop-menu,
  .topbar .link-drop-menu.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0s;
  }
}

.link-drop-menu__item {
  display: flex !important;
  align-items: center;
  gap: 12px;
  padding: 12px !important;
  border-radius: 12px !important;
  border: 1px solid transparent !important;
  text-decoration: none;
  color: #0f172a;
  /* Override .topbar .links a (overflow:hidden + text-overflow:ellipsis +
     max-width) so titles and 2-line descriptions render fully — Arabic
     glyphs are wider than Latin and were being clipped at the end. */
  overflow: visible !important;
  text-overflow: clip !important;
  max-width: none !important;
  white-space: normal;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.link-drop-menu__item:hover {
  background: rgba(15, 118, 110, 0.05) !important;
  border-color: rgba(15, 118, 110, 0.15) !important;
}

html[dir="ltr"] .link-drop-menu__item:hover {
  transform: translateX(2px);
}

html[dir="rtl"] .link-drop-menu__item:hover {
  transform: translateX(-2px);
}

.link-drop-menu__icon {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease;
}

.link-drop-menu__item:hover .link-drop-menu__icon {
  transform: scale(1.06);
}

.link-drop-menu__icon--blue {
  background: rgba(15, 118, 110, 0.1);
  color: #0f766e;
}

.link-drop-menu__icon--orange {
  background: rgba(234, 88, 12, 0.1);
  color: #ea580c;
}

.link-drop-menu__icon--green {
  background: rgba(34, 197, 94, 0.12);
  color: #16a34a;
}

.link-drop-menu__text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1 1 auto;
}

.link-drop-menu__title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
  white-space: normal;
  overflow: visible;
}

.link-drop-menu__desc {
  font-size: 12px;
  color: rgba(15, 23, 42, 0.6);
  line-height: 1.35;
  font-weight: 500;
  white-space: normal;
  overflow: visible;
}

/* Mobile (burger panel): compact the icon, hide the description to keep
   sub-items at the same height as other burger items. Background/border come
   from the existing .topbar .link-drop-menu a mobile rule and the .active
   override — no need to redeclare them here. */
@media (max-width: 1366px) {
  /* Burger : badge d'icône coloré conservé (même rendu que le menu connecté),
     description masquée pour garder des lignes compactes. */
  .link-drop-menu__icon {
    width: 32px;
    height: 32px;
  }

  .link-drop-menu__icon svg {
    width: 16px;
    height: 16px;
  }

  .link-drop-menu__desc {
    display: none;
  }

  .link-drop-menu__title {
    font-size: 15px;
  }
}

.topbar .link-drop-menu.is-open {
  display: block;
}

/* =========================
   BURGER
========================= */
.topbar .nav-burger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(6px);
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
  flex: 0 0 auto;
}

.topbar .nav-burger:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.38);
  border-color: rgba(255, 255, 255, 0.7);
}

.topbar .nav-burger .bar {
  width: 18px;
  height: 2px;
  background: rgba(15, 23, 42, 0.92);
  border-radius: 999px;
  display: block;
  position: relative;
}

.topbar .nav-burger .bar::before,
.topbar .nav-burger .bar::after {
  content: "";
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  background: rgba(15, 23, 42, 0.92);
  border-radius: 999px;
  transition: transform 0.12s ease, top 0.12s ease;
}

.topbar .nav-burger .bar::before {
  top: -6px;
}

.topbar .nav-burger .bar::after {
  top: 6px;
}

.topbar.is-menu-open .nav-burger .bar {
  background: transparent;
}

.topbar.is-menu-open .nav-burger .bar::before {
  top: 0;
  transform: rotate(45deg);
}

.topbar.is-menu-open .nav-burger .bar::after {
  top: 0;
  transform: rotate(-45deg);
}

/* =========================
   OVERLAY
========================= */
.topbar .nav-overlay {
  display: none;
}

@media (max-width: 1366px) {
  .topbar .nav-overlay {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(2px);
    z-index: 900;
  }

  .topbar.is-menu-open .nav-overlay {
    display: block;
  }
}

/* =========================
   MOBILE LAYOUT
========================= */
@media (max-width: 1366px) {
  /* Padding réduit sur mobile → burger et logo plus collés aux bords. */
  .topbar {
    padding-inline: 6px;
  }

  .topbar .nav-burger {
    display: inline-flex !important;
    width: 42px !important;
    height: 42px !important;
    order: 2 !important;
  }

  .topbar .offers-btn {
    display: inline-flex !important;
  }

  .topbar .container.nav {
    gap: 8px !important;
    justify-content: space-between !important;
    align-items: center !important;
  }

  .topbar .brand {
    order: 1 !important;
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: 150px !important;
    margin: 0 !important;
  }

  .topbar .logo-img,
  .topbar .brand-logo {
    width: auto !important;
    max-width: 150px !important;
    height: 40px !important;
    transform: none !important;
  }

  .topbar .nav-actions {
    order: 2 !important;
    margin: 0 !important;
    gap: 8px !important;
    flex: 0 0 auto !important;
    min-width: 0 !important;
    align-items: center !important;
  }

  .topbar .nav-actions>.btn.primary,
  .topbar .nav-actions>a.btn.primary {
    order: 1 !important;
    padding: 8px 12px !important;
    font-size: 13px !important;
    min-height: 40px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }

  /* Mobile : userMenu caché par défaut — JS le restaure pour auth-logged-in */
  .topbar :is(#userMenu, #authActions) {
    display: none !important;
  }

  /* logged in mobile = avatar seulement */
  body.auth-logged-in .topbar :is(#userMenu, #authActions) {
    display: flex !important;
    order: 2 !important;
    flex: 0 0 auto !important;
    max-width: none !important;
  }

  body.auth-logged-in .topbar .nav-burger {
    display: none !important;
  }

  body.auth-logged-in .topbar .links {
    display: none !important;
  }

  body.auth-logged-in .topbar .nav-actions>.btn.primary,
  body.auth-logged-in .topbar .nav-actions>a.btn.primary,
  body.auth-logged-in .topbar .desktop-login-fallback,
  body.auth-logged-in .topbar .mobile-login-btn,
  body.auth-logged-in .topbar .links .mobile-login-btn,
  body.auth-logged-in .topbar .links a.mobile-login-btn,
  body.auth-logged-in .topbar .mobile-signup-btn,
  body.auth-logged-in .topbar .links .mobile-signup-btn,
  body.auth-logged-in .topbar .links a.mobile-signup-btn {
    display: none !important;
  }

  .topbar .nav-actions .login-btn,
  .topbar .nav-actions a[href*="signup"],
  .topbar .nav-actions a[href*="register"] {
    display: none !important;
  }

  .topbar .links {
    position: fixed;
    top: var(--topbar-h);
    inset-inline: 0;
    bottom: 0;
    margin: 0;
    padding: 12px 14px 24px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 8px;
    background: #fff;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
    z-index: 960;
    /* Hauteur définie par top + bottom (du bas du navbar au bas de l'écran).
       Plus robuste que 100vh/100dvh, qui varient selon la barre d'outils sur
       Safari iOS et peuvent rendre le panneau trop court. */
    overflow-y: auto;
    overscroll-behavior: contain;
    /* PAS de -webkit-overflow-scrolling: touch — sur iOS Safari, dans un
       panneau position:fixed, ce flag provoque la disparition / perte de style
       intermittente des enfants (boutons du bas, CTA injecté). Le scroll fluide
       est natif sur iOS moderne, ce flag est inutile. */
  }

  /* Les éléments du burger gardent leur taille : quand « Services » s'ouvre,
     le panneau SCROLLE au lieu de comprimer les autres boutons. */
  .topbar .links > * {
    flex-shrink: 0;
  }

  /* Override the desktop LTR rule (~L168) that forces gap:0 on .topbar .links —
     intended for the horizontal nav, but cascades to mobile too because it has
     a higher specificity than the mobile rule above. Restore gap:8px + normal
     font-size for the burger panel in French/LTR. */
  html[dir="ltr"] .topbar .links {
    gap: 8px;
    font-size: inherit;
  }

  .topbar.is-menu-open .links {
    display: flex !important;
  }

  /* Align burger-menu items (logged out) with .user-menu__item (logged in) so
     both mobile menus share identical typography, padding, radius, border. */
  .topbar .links a,
  .topbar .links .link-drop {
    width: 100%;
    max-width: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 15px;
    font-weight: 600;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.1);
    background: #fff;
    color: #0f172a;
  }

  .topbar .links a:hover,
  .topbar .links .link-drop:hover,
  .topbar .links a:focus-visible,
  .topbar .links .link-drop:focus-visible {
    background: rgba(15, 118, 110, 0.06);
    border-color: rgba(15, 118, 110, 0.18);
  }

  /* Active page indicator on mobile burger items — left blue accent bar
     (uses inset-inline-start so it stays on the start side in both RTL and LTR).
     Also applies to .link-drop (Services button) when a sub-page is active
     OR when the user expanded it (aria-expanded="true") — gives clear visual
     feedback that the toggle is currently selected/open. */
  .topbar .links a.active,
  .topbar .links .link-drop.active,
  .topbar .links .link-drop[aria-expanded="true"] {
    background: rgba(15, 118, 110, 0.06);
    border-color: rgba(15, 118, 110, 0.22);
    color: #0f766e;
    font-weight: 600;
    position: relative;
  }

  .topbar .links a.active::before,
  .topbar .links .link-drop.active::before,
  .topbar .links .link-drop[aria-expanded="true"]::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #0f766e;
    border-start-start-radius: 12px;
    border-end-start-radius: 12px;
  }

  /* When Services is expanded, deselect the visual "active page" indicator on
     OTHER top-level items so only the open toggle stays highlighted. The
     active item recovers its blue style as soon as Services is closed.
     Sub-items inside .link-drop-menu are intentionally not affected (they
     should remain highlighted to show the user's current page). */
  .topbar .links:has(.link-drop[aria-expanded="true"]) > a.active {
    background: #fff;
    border-color: rgba(15, 23, 42, 0.1);
    color: #0f172a;
    font-weight: 500;
  }

  .topbar .links:has(.link-drop[aria-expanded="true"]) > a.active::before {
    display: none;
  }

  /* FR (LTR) : annule les overrides desktop (~L173) qui, sur mobile, donnaient
     padding:6px 8px et max-width:175px aux items → items trop compacts et
     tronqués par rapport à l'arabe. Restaure le padding mobile complet pour
     que le burger soit identique en LTR et RTL. */
  html[dir="ltr"] .topbar .links a {
    max-width: none;
    padding: 10px 12px;
  }

  .topbar .links-group {
    width: 100%;
  }

  /* Services sub-menu — match the logged-in mobile services sub-list:
     indentation + vertical guide, sub-items with subtle gray background.
     IMPORTANT: stays display:none unless .is-open (toggled by burger JS),
     otherwise the sub-menu would be permanently expanded.
     Width is intentionally NOT forced to 100% so the sub-items' end edges
     stay aligned with the parent "Services" button (margin-inline-start
     would otherwise push the 100%-wide menu past the parent's end edge). */
  .topbar .link-drop-menu {
    position: static;
    inset: auto;
    top: auto;
    min-width: 0;
    width: auto;
    box-shadow: none;
    background: transparent;
    border: 0;
    border-radius: 0;
    margin-top: 6px;
    margin-inline-start: 14px;
    padding: 0;
    padding-inline-start: 10px;
    border-inline-start: 2px solid rgba(15, 23, 42, 0.08);
    flex-direction: column;
    gap: 6px;
    align-self: stretch;
  }

  .topbar .link-drop-menu.is-open {
    display: flex;
  }

  /* Caret rotation + blue color on services toggle to signal it has sub-items
     — same behavior + look as the user dropdown's services caret. */
  .topbar .links .link-drop .link-drop-caret {
    display: inline-block;
    transition: transform 0.2s ease, color 0.2s ease;
    color: #0f766e;
    font-weight: 900;
    font-size: 14px;
  }

  .topbar .links .link-drop[aria-expanded="true"] .link-drop-caret {
    transform: rotate(180deg);
  }

  .topbar .link-drop-menu a {
    font-size: 15px;
    font-weight: 600;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.025);
    border: 1px solid rgba(15, 23, 42, 0.08);
    color: #0f172a;
  }

  /* Active sub-item: same blue treatment as top-level active items.
     Declared AFTER .link-drop-menu a so it wins on cascade order as well
     as specificity (0,4,1 vs 0,2,1). */
  .topbar .links .link-drop-menu a.active {
    background: rgba(15, 118, 110, 0.06);
    border-color: rgba(15, 118, 110, 0.35);
    color: #0f766e;
    font-weight: 600;
    position: relative;
  }

  .topbar .links .link-drop-menu a.active::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #0f766e;
    border-start-start-radius: 12px;
    border-end-start-radius: 12px;
  }

  /* Signup + login both stick to the bottom of the burger menu.
     margin-top: auto on the FIRST of them (signup) pushes the pair to the bottom;
     login follows naturally with a small gap. */
  body.auth-logged-out .topbar .links .mobile-signup-btn,
  body.auth-logged-out .topbar .links a.mobile-signup-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 50px;
    margin-top: auto;
    margin-bottom: 2px;
    padding: 12px 16px;
    border-radius: 16px;
    text-decoration: none;
    font-weight: 800;
    font-size: 15px;
    color: #0f766e !important;
    background: #fff;
    border: 2px solid #0f766e;
    box-shadow: 0 6px 18px rgba(15, 118, 110, 0.14);
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, color 0.16s ease;
  }

  body.auth-logged-out .topbar .links .mobile-signup-btn:hover,
  body.auth-logged-out .topbar .links .mobile-signup-btn:focus-visible,
  body.auth-logged-out .topbar .links a.mobile-signup-btn:hover,
  body.auth-logged-out .topbar .links a.mobile-signup-btn:focus-visible {
    transform: translateY(-1px);
    background: rgba(15, 118, 110, 0.06);
    box-shadow: 0 10px 24px rgba(15, 118, 110, 0.22);
    color: #0f766e !important;
  }

  body.auth-logged-out .topbar .links .mobile-login-btn,
  body.auth-logged-out .topbar .links a.mobile-login-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 50px;
    margin-top: 8px;
    padding: 12px 16px;
    border-radius: 16px;
    text-decoration: none;
    font-weight: 900;
    font-size: 15px;
    color: #ffffff !important;
    background: linear-gradient(135deg, #0f172a 0%, #0f766e 100%);
    border: 1px solid rgba(15, 118, 110, 0.35);
    box-shadow: 0 16px 30px rgba(15, 118, 110, 0.22);
    transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
  }

  .topbar .links .mobile-login-btn:hover,
  .topbar .links .mobile-login-btn:focus-visible,
  .topbar .links a.mobile-login-btn:hover,
  .topbar .links a.mobile-login-btn:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 20px 34px rgba(15, 118, 110, 0.28);
    filter: saturate(1.04);
  }

  /* ── Déconnecté : le CTA orange n'est PLUS dans la barre du haut … */
  body.auth-logged-out .topbar .post-ad-btn--nav {
    display: none !important;
  }

  /* … il est dans le burger, au-dessus de « Créer un compte ». Le margin-top
     auto le pousse (avec signup + login) vers le bas du panneau. */
  body.auth-logged-out .topbar .links .mobile-post-ad-btn,
  body.auth-logged-out .topbar .links a.mobile-post-ad-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 50px;
    margin-top: auto;
    margin-bottom: 8px;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 15px;
    font-weight: 900;
    color: #ffffff !important;
    background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%) !important;
    border: none;
    box-shadow: 0 12px 26px rgba(234, 88, 12, 0.32);
  }

  body.auth-logged-out .topbar .links .mobile-post-ad-btn svg {
    display: inline-block !important;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
  }

  body.auth-logged-out .topbar .links .mobile-post-ad-btn:hover,
  body.auth-logged-out .topbar .links .mobile-post-ad-btn:focus-visible {
    transform: translateY(-1px);
    filter: brightness(1.06);
    box-shadow: 0 16px 32px rgba(234, 88, 12, 0.42);
  }

  /* Le CTA prend désormais le margin-top:auto → signup repasse en espacement
     normal pour rester collé sous le CTA. */
  body.auth-logged-out .topbar .links a.mobile-signup-btn {
    margin-top: 8px !important;
  }

  /* avatar only on mobile when logged in */
  body.auth-logged-in .topbar :is(#userMenu, #authActions) .user-menu {
    width: auto !important;
  }

  body.auth-logged-in .topbar :is(#userMenu, #authActions) .user-menu__trigger {
    width: auto !important;
    max-width: none !important;
    min-width: 46px !important;
    padding: 4px !important;
    gap: 0 !important;
    border-radius: 999px !important;
  }

  body.auth-logged-in .topbar :is(#userMenu, #authActions) .user-menu__info {
    display: none !important;
  }

  body.auth-logged-in .topbar :is(#userMenu, #authActions) .user-menu__avatar {
    width: 42px !important;
    height: 42px !important;
  }

  body.auth-logged-in .topbar :is(#userMenu, #authActions) .user-menu__dropdown {
    position: fixed;
    top: var(--topbar-h) !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: auto !important;
    max-width: none !important;
    transform: none;
    /* Hauteur via top + bottom (robuste Safari iOS, pas de dépendance dvh/vh). */
    overflow-y: auto;
    overscroll-behavior: contain;
    /* Voir note burger : -webkit-overflow-scrolling retiré (bug rendu iOS). */
    z-index: 960;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    box-shadow: none;
  }

  /* Animate in from below the navbar instead of the desktop translateY pop */
  body.auth-logged-in .topbar :is(#userMenu, #authActions) .user-menu__dropdown.open {
    transform: none;
  }

  /* Les éléments du menu connecté gardent leur taille → scroll (et non
     compression) quand le sous-menu Services s'ouvre. */
  body.auth-logged-in .topbar .user-menu__body--mobile > * {
    flex-shrink: 0;
  }

  /* Slightly more breathing room inside the full-screen panel */
  body.auth-logged-in .topbar .user-menu__body--mobile {
    padding: 12px 14px 24px;
  }

  /* Show the navbar overlay behind the user dropdown on mobile so page
     content stops bleeding through above and below the dropdown. */
  body.user-menu-open .topbar .nav-overlay {
    display: block;
  }

  body.auth-logged-in .topbar :is(#userMenu, #authActions) .user-menu__dropdown::before {
    display: none !important;
  }

  body.auth-logged-in .topbar .user-menu__body--desktop {
    display: none !important;
  }

  /* Hide profile header on mobile — saves vertical space; identity is already
     visible via the avatar trigger in the navbar. */
  body.auth-logged-in .topbar .user-menu__dropdown .user-menu__header {
    display: none !important;
  }

  body.auth-logged-in .topbar .user-menu__body--mobile {
    display: flex !important;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    border-top: 0;
    /* Fill the dropdown so margin-top: auto on Déconnexion can push it to
       the actual bottom (otherwise the body just wraps to its content). */
    min-height: 100%;
    box-sizing: border-box;
  }

  /* même taille pour "الخدمات العقارية" que les autres lignes */
  body.auth-logged-in .topbar .user-menu__body--mobile .user-menu__item,
  body.auth-logged-in .topbar .user-menu__body--mobile .user-menu__services-toggle {
    font-size: 15px !important;
    font-weight: 600 !important;
  }

  /* Section labels stay heavy as visual headers */
  body.auth-logged-in .topbar .user-menu__body--mobile .user-menu__section-label {
    font-weight: 800 !important;
  }

  /* ── Active page indicator (logged-in dropdown) ─────────────────────────
     Same visual treatment as the burger menu: blue background + text +
     vertical bar via ::before. Also triggers when the services toggle is
     expanded (aria-expanded="true") OR when its parent page is a service. */
  body.auth-logged-in .topbar .user-menu__body--mobile .user-menu__item.active,
  body.auth-logged-in .topbar .user-menu__body--mobile .user-menu__services-toggle[aria-expanded="true"] {
    background: rgba(15, 118, 110, 0.06) !important;
    border-color: rgba(15, 118, 110, 0.25) !important;
    color: #0f766e !important;
    font-weight: 600 !important;
    position: relative;
  }

  body.auth-logged-in .topbar .user-menu__body--mobile .user-menu__item.active::before,
  body.auth-logged-in .topbar .user-menu__body--mobile .user-menu__services-toggle[aria-expanded="true"]::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #0f766e;
    border-start-start-radius: 12px;
    border-end-start-radius: 12px;
  }

  /* ── Deselect other actives when Services is open ───────────────────────
     Targets only direct children .user-menu__item so sub-items inside
     .user-menu__mobile-services-menu (the actual service page) stay blue. */
  body.auth-logged-in .topbar .user-menu__body--mobile:has(.user-menu__services-toggle[aria-expanded="true"]) > .user-menu__item.active {
    background: #fff !important;
    border-color: rgba(15, 23, 42, 0.1) !important;
    color: #0f172a !important;
    font-weight: 500 !important;
  }

  body.auth-logged-in .topbar .user-menu__body--mobile:has(.user-menu__services-toggle[aria-expanded="true"]) > .user-menu__item.active::before {
    display: none;
  }

  /* Logout pinned to the bottom of the mobile dropdown panel. */
  body.auth-logged-in .topbar .user-menu__body--mobile > .user-menu__item--danger {
    margin-top: auto;
  }

  /* Center the TEXT of Mon compte / Mes annonces / Déconnexion while keeping
     the icon anchored to the end side via absolute positioning. The flex
     parent uses justify-content: center so the text node sits in the middle. */
  body.auth-logged-in .topbar .user-menu__body--mobile > .user-menu__item--success,
  body.auth-logged-in .topbar .user-menu__body--mobile > .user-menu__item--my-ads,
  body.auth-logged-in .topbar .user-menu__body--mobile > .user-menu__item--post-ad,
  body.auth-logged-in .topbar .user-menu__body--mobile > .user-menu__item--danger {
    justify-content: center;
    position: relative;
  }

  body.auth-logged-in .topbar .user-menu__body--mobile > .user-menu__item--success > svg,
  body.auth-logged-in .topbar .user-menu__body--mobile > .user-menu__item--my-ads > svg,
  body.auth-logged-in .topbar .user-menu__body--mobile > .user-menu__item--post-ad > svg,
  body.auth-logged-in .topbar .user-menu__body--mobile > .user-menu__item--danger > svg {
    position: absolute;
    inset-inline-end: 12px;
    top: 50%;
    transform: translateY(-50%);
  }

  body.auth-logged-in .topbar .user-menu__body--mobile .user-menu__services-toggle span {
    font-size: inherit !important;
    font-weight: inherit !important;
  }
}

/* =========================
   SMALL PHONES
========================= */
@media (max-width: 640px) {
  .topbar .container.nav {
    gap: 8px !important;
  }

  .topbar .brand-text {
    display: none;
  }

  .topbar .brand {
    max-width: 138px !important;
  }

  .topbar .logo-img,
  .topbar .brand-logo {
    max-width: 138px !important;
    height: 36px !important;
  }

  .topbar .nav-actions {
    gap: 6px !important;
  }

  .topbar .nav-actions>.btn.primary,
  .topbar .nav-actions>a.btn.primary {
    padding: 7px 10px !important;
    font-size: 12px !important;
    min-height: 38px !important;
  }

  .topbar .nav-burger {
    width: 40px !important;
    height: 40px !important;
  }

  body.auth-logged-out .topbar .links .mobile-login-btn,
  body.auth-logged-out .topbar .links a.mobile-login-btn,
  body.auth-logged-out .topbar .links .mobile-signup-btn,
  body.auth-logged-out .topbar .links a.mobile-signup-btn {
    min-height: 46px;
    font-size: 14px;
    border-radius: 14px;
  }
}

/* =========================
   DESKTOP USER MENU
========================= */
@media (min-width: 1367px) {
  .topbar :is(#userMenu, #authActions) {
    flex: 0 0 auto !important;
    max-width: 240px !important;
  }

  .topbar :is(#userMenu, #authActions) .user-menu__trigger {
    width: 240px !important;
    max-width: 240px !important;
    padding: 8px 10px !important;
    gap: 8px !important;
  }

  .topbar :is(#userMenu, #authActions) .user-menu__name {
    max-width: 150px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .topbar :is(#userMenu, #authActions) .user-menu__dropdown {
    min-width: 260px !important;
    max-width: 320px !important;
    max-width: min(320px, calc(100vw - 24px)) !important;
  }

  html[dir="rtl"] .topbar :is(#userMenu, #authActions) .user-menu__dropdown {
    right: 0 !important;
    left: auto !important;
  }

  html[dir="ltr"] .topbar :is(#userMenu, #authActions) .user-menu__dropdown {
    left: 0 !important;
    right: auto !important;
  }

  /* desktop connecté = avatar seulement */
  body.auth-logged-in .topbar :is(#userMenu, #authActions) {
    flex: 0 0 auto !important;
    max-width: none !important;
  }

  body.auth-logged-in .topbar :is(#userMenu, #authActions) .user-menu {
    width: auto !important;
  }

  body.auth-logged-in .topbar :is(#userMenu, #authActions) .user-menu__trigger {
    width: auto !important;
    max-width: none !important;
    min-width: 46px !important;
    padding: 4px !important;
    gap: 0 !important;
    border-radius: 999px !important;
  }

  body.auth-logged-in .topbar :is(#userMenu, #authActions) .user-menu__info {
    display: none !important;
  }

  body.auth-logged-in .topbar :is(#userMenu, #authActions) .user-menu__avatar {
    width: 42px !important;
    height: 42px !important;
  }

  /* correction du dropdown desktop sous l’icône */
  body.auth-logged-in .topbar :is(#userMenu, #authActions) .user-menu__dropdown {
    top: calc(100% + 8px) !important;
    left: 0 !important;
    right: auto !important;
    min-width: 270px !important;
    max-width: 300px !important;
    transform-origin: top left !important;
  }

  html[dir="rtl"] body.auth-logged-in .topbar :is(#userMenu, #authActions) .user-menu__dropdown {
    left: 0 !important;
    right: auto !important;
  }

  html[dir="ltr"] body.auth-logged-in .topbar :is(#userMenu, #authActions) .user-menu__dropdown {
    right: 0 !important;
    left: auto !important;
    transform-origin: top right !important;
  }

  html[dir="rtl"] body.auth-logged-in .topbar :is(#userMenu, #authActions) .user-menu__dropdown::before {
    left: 16px !important;
    right: auto !important;
  }

  html[dir="ltr"] body.auth-logged-in .topbar :is(#userMenu, #authActions) .user-menu__dropdown::before {
    right: 16px !important;
    left: auto !important;
  }

  .topbar .user-menu__body--desktop {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .topbar .user-menu__body--mobile {
    display: none !important;
  }

  /* Client desktop : on retire l'en-tête (avatar + « Services Vectra » + « Client ») du
     dropdown ; on ne garde que les 3 boutons (Mon compte / Mes annonces / Déconnexion).
     Sur mobile l'en-tête est déjà masqué (le menu mobile a sa propre mise en page). */
  .topbar .user-menu__dropdown .user-menu__header {
    display: none;
  }

  /* Center text in Mon compte / Mes annonces / Déconnexion (desktop dropdown)
     while pinning the icon to the inline-end side — matches the mobile look. */
  body.auth-logged-in .topbar .user-menu__body--desktop > .user-menu__item--success,
  body.auth-logged-in .topbar .user-menu__body--desktop > .user-menu__item--my-ads,
  body.auth-logged-in .topbar .user-menu__body--desktop > .user-menu__item--danger {
    justify-content: center;
    position: relative;
  }

  body.auth-logged-in .topbar .user-menu__body--desktop > .user-menu__item--success > svg,
  body.auth-logged-in .topbar .user-menu__body--desktop > .user-menu__item--my-ads > svg,
  body.auth-logged-in .topbar .user-menu__body--desktop > .user-menu__item--danger > svg {
    position: absolute;
    inset-inline-end: 12px;
    top: 50%;
    transform: translateY(-50%);
  }
}

/* medium laptops */
@media (min-width: 1367px) and (max-width: 1500px) {
  .topbar .brand {
    width: 160px;
    max-width: 160px;
  }

  .topbar .logo-img,
  .topbar .brand-logo {
    height: 54px;
  }

  body.auth-logged-out .topbar :is(#userMenu, #authActions) {
    max-width: 200px !important;
  }

  body.auth-logged-out .topbar :is(#userMenu, #authActions) .user-menu__trigger {
    width: 200px !important;
    max-width: 200px !important;
  }

  body.auth-logged-out .topbar :is(#userMenu, #authActions) .user-menu__name {
    max-width: 120px !important;
  }
}

/* Laptops moyens (1025–1300px) : on compacte le navbar pour que les 6 liens
   tiennent SANS troncature (« Ac… », « Co… ») au lieu de basculer en burger.
   Le breakpoint burger reste à 1024 (cohérence avec les pages du site). */
@media (min-width: 1367px) and (max-width: 1600px) {
  /* gaps resserrés */
  .topbar .links,
  html[dir="ltr"] .topbar .links {
    gap: 2px;
  }

  html[dir="ltr"] .topbar .container.nav {
    gap: 6px;
  }

  html[dir="ltr"] .topbar .nav-actions {
    gap: 6px;
  }

  /* liens : padding + taille réduits pour gagner de la largeur */
  .topbar .links a,
  html[dir="ltr"] .topbar .links a {
    padding: 6px 7px;
    font-size: 13.5px;
  }

  /* CTA « Publier une annonce » compact */
  .topbar .post-ad-btn--nav,
  html[dir="ltr"] .topbar .post-ad-btn--nav {
    padding: 9px 11px;
    font-size: 12.5px;
  }

  /* « Se connecter » : on supprime la largeur fixe (240px) → bouton à la
     taille de son texte = gros gain de place, c'est ce qui débloque le tout. */
  body.auth-logged-out .topbar :is(#userMenu, #authActions) {
    max-width: 160px !important;
  }

  body.auth-logged-out .topbar :is(#userMenu, #authActions) .user-menu__trigger {
    width: auto !important;
    max-width: 160px !important;
    padding: 8px 14px !important;
  }
}

/* =========================
   FOOTER MOBILE OPTIMISÉ
========================= */
@media (max-width: 820px) {
  .partenaires-immo-page .pp-footer-shell {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 14px;
    align-items: start;
  }

  .partenaires-immo-page .pp-footer-shell>.pp-footer-col:first-child {
    grid-column: 1 / -1;
  }

  .partenaires-immo-page .pp-footer-shell>.pp-footer-col:nth-child(2),
  .partenaires-immo-page .pp-footer-shell>.pp-footer-col:nth-child(3) {
    grid-column: auto;
    min-width: 0;
  }

  .partenaires-immo-page .pp-footer-shell>.pp-footer-bottom {
    grid-column: 1 / -1;
  }

  .partenaires-immo-page .pp-footer-col h4 {
    margin-bottom: 10px;
  }

  .partenaires-immo-page .pp-footer-col ul {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .partenaires-immo-page .pp-footer-col li {
    margin-bottom: 8px;
  }

  .partenaires-immo-page .pp-footer-col a,
  .partenaires-immo-page .pp-footer-col span {
    display: inline-block;
    line-height: 1.7;
    word-break: break-word;
  }
}