/*
 * Findar Map RealEstate UI SAFE v4.4.9
 * Scope: /carte/ only via body.fdmre-map-page.
 * UI-only: no SQL, no CPT, no contact, no route takeover, no external assets.
 */

body.fdmre-map-page {
  overflow-x: hidden !important;
  --fdmre-blue: #0b4cff;
  --fdmre-navy: #07111f;
  --fdmre-text: #111827;
  --fdmre-muted: #64748b;
  --fdmre-border: rgba(15, 23, 42, 0.12);
  --fdmre-border-strong: rgba(15, 23, 42, 0.18);
  --fdmre-bg: #f7f8fb;
  --fdmre-card: #ffffff;
  background: var(--fdmre-bg) !important;
}

/* Remove old SEO/map hero only on /carte/. */
body.fdmre-map-page .entry-header,
body.fdmre-map-page .page-header,
body.fdmre-map-page .fmp-results-hero,
body.fdmre-map-page .fmp-search-hero,
body.fdmre-map-page .fmp-page-hero,
body.fdmre-map-page .findar-page-hero,
body.fdmre-map-page .findar-hero,
body.fdmre-map-page .money-page-hero,
body.fdmre-map-page .wp-block-cover:first-of-type,
body.fdmre-map-page .wp-block-group:first-child:has(h1) {
  display: none !important;
}

body.fdmre-map-page .site,
body.fdmre-map-page #page,
body.fdmre-map-page .site-main,
body.fdmre-map-page main,
body.fdmre-map-page .entry-content,
body.fdmre-map-page .wp-site-blocks,
body.fdmre-map-page .page-content {
  max-width: none !important;
  width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* Keep global Findar header clean and fixed. */
body.fdmre-map-page .fmp-theme-mobile-header,
body.fdmre-map-page #fmp-theme-mobile-header,
body.fdmre-map-page .site-header {
  position: sticky !important;
  top: var(--wp-admin--admin-bar--height, 0px) !important;
  z-index: 9997 !important;
  background: rgba(255,255,255,0.96) !important;
  backdrop-filter: blur(14px) !important;
  border-bottom: 1px solid rgba(15,23,42,.08) !important;
}
body.fdmre-map-page.admin-bar .fmp-theme-mobile-header,
body.fdmre-map-page.admin-bar #fmp-theme-mobile-header,
body.fdmre-map-page.admin-bar .site-header { top: 32px !important; }

/* Top filter/search bar: realestate.com.au-inspired. */
body.fdmre-map-page .fdmre-topbar {
  position: sticky;
  top: calc(var(--wp-admin--admin-bar--height, 0px) + 82px);
  z-index: 9995;
  display: grid;
  grid-template-columns: minmax(320px, 1fr) auto auto auto auto auto auto;
  align-items: center;
  gap: 10px;
  padding: 12px clamp(14px, 2vw, 30px);
  background: rgba(255,255,255,.985);
  border-bottom: 1px solid var(--fdmre-border);
  box-shadow: 0 8px 24px rgba(15,23,42,.06);
}
body.admin-bar.fdmre-map-page .fdmre-topbar { top: calc(32px + 82px); }

body.fdmre-map-page .fdmre-searchbox {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  border: 1px solid var(--fdmre-border-strong);
  border-radius: 999px;
  background: #fff;
  padding: 0 16px;
}
body.fdmre-map-page .fdmre-searchbox svg,
body.fdmre-map-page .fdmre-btn svg { width: 18px; height: 18px; flex: 0 0 auto; }
body.fdmre-map-page .fdmre-searchbox input {
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
  min-width: 0;
  width: 100%;
  font-size: 15px;
  font-weight: 650;
  color: var(--fdmre-text);
  background: transparent !important;
}
body.fdmre-map-page .fdmre-searchbox input::placeholder { color: #5f6b7a; font-weight: 520; }

body.fdmre-map-page .fdmre-btn,
body.fdmre-map-page .fdmre-select {
  min-height: 46px;
  border: 1px solid var(--fdmre-border-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--fdmre-text);
  padding: 0 17px;
  font-size: 15px;
  font-weight: 850;
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  cursor: pointer;
}
body.fdmre-map-page .fdmre-btn:hover,
body.fdmre-map-page .fdmre-select:hover {
  border-color: rgba(11,76,255,.36);
  box-shadow: 0 8px 18px rgba(15,23,42,.08);
}
body.fdmre-map-page .fdmre-list-btn { background: var(--fdmre-navy); color: #fff !important; border-color: var(--fdmre-navy); }
body.fdmre-map-page .fdmre-filter-submit { background: #fff; color: var(--fdmre-text); }

/* Hide duplicate maps chosen by JS. */
body.fdmre-map-page .fdmre-duplicate-map-hidden,
body.fdmre-map-page .fdmre-duplicate-map-node-hidden {
  display: none !important;
  height: 0 !important;
  min-height: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Primary map shell: no white box, map-first layout. */
body.fdmre-map-page .fdmre-map-stage {
  position: relative !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: #dbeafe !important;
  overflow: hidden !important;
  min-height: calc(100vh - 150px) !important;
}
body.admin-bar.fdmre-map-page .fdmre-map-stage { min-height: calc(100vh - 182px) !important; }

body.fdmre-map-page .fdmre-map-stage .fmi-safe-head,
body.fdmre-map-page .fdmre-map-stage .fmi-safe-legend,
body.fdmre-map-page .fdmre-map-stage .fdmre-hide-old-copy { display: none !important; }

/* Existing Findar map controls become a compact floating filter row. */
body.fdmre-map-page .fdmre-map-stage .fmi-safe-controls {
  position: absolute !important;
  z-index: 720 !important;
  left: 18px !important;
  right: 18px !important;
  top: 72px !important;
  display: grid !important;
  grid-template-columns: minmax(160px, 1.15fr) minmax(150px, .9fr) minmax(120px, .75fr) minmax(120px, .75fr) minmax(120px, .75fr) auto auto auto !important;
  gap: 8px !important;
  margin: 0 !important;
  padding: 0 !important;
  pointer-events: auto !important;
}
body.fdmre-map-page .fdmre-map-stage .fmi-safe-controls select,
body.fdmre-map-page .fdmre-map-stage .fmi-safe-controls input,
body.fdmre-map-page .fdmre-map-stage .fmi-safe-controls button,
body.fdmre-map-page .fdmre-map-stage .fmi-safe-controls .fdmre-inline-list {
  height: 44px !important;
  min-height: 44px !important;
  border: 1px solid rgba(15,23,42,.14) !important;
  border-radius: 999px !important;
  background: rgba(255,255,255,.96) !important;
  color: var(--fdmre-text) !important;
  font-size: 14px !important;
  font-weight: 850 !important;
  padding: 0 14px !important;
  box-shadow: 0 10px 28px rgba(15,23,42,.10) !important;
  text-decoration: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}
body.fdmre-map-page .fdmre-map-stage .fmi-safe-controls #fmiSafeApply,
body.fdmre-map-page .fdmre-map-stage .fmi-safe-controls #fmiSafeHeat.active {
  background: var(--fdmre-blue) !important;
  color: #fff !important;
  border-color: var(--fdmre-blue) !important;
}
body.fdmre-map-page .fdmre-map-stage .fmi-safe-controls #fmiSafeHeat,
body.fdmre-map-page .fdmre-map-stage .fmi-safe-controls .fdmre-inline-list {
  background: var(--fdmre-navy) !important;
  color: #fff !important;
  border-color: var(--fdmre-navy) !important;
}

/* Map canvas takes the page, like realestate.com.au. */
body.fdmre-map-page .fdmre-map-stage #fmiSafeMap,
body.fdmre-map-page .fdmre-map-stage .fdmre-primary-map,
body.fdmre-map-page .fdmre-map-stage .leaflet-container {
  width: 100% !important;
  max-width: none !important;
  min-height: calc(100vh - 150px) !important;
  height: calc(100vh - 150px) !important;
  border-radius: 0 !important;
  background: #dbeafe !important;
  z-index: 1 !important;
}
body.admin-bar.fdmre-map-page .fdmre-map-stage #fmiSafeMap,
body.admin-bar.fdmre-map-page .fdmre-map-stage .fdmre-primary-map,
body.admin-bar.fdmre-map-page .fdmre-map-stage .leaflet-container {
  min-height: calc(100vh - 182px) !important;
  height: calc(100vh - 182px) !important;
}

/* Floating UI overlays. */
body.fdmre-map-page .fdmre-map-overlay { position: absolute; z-index: 760; pointer-events: none; }
body.fdmre-map-page .fdmre-update-chip {
  top: 16px; left: 18px; pointer-events: auto;
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(15,23,42,.10);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 10px 28px rgba(15,23,42,.14);
  color: var(--fdmre-text);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 760;
}
body.fdmre-map-page .fdmre-update-chip input { width: 18px; height: 18px; accent-color: var(--fdmre-blue); }
body.fdmre-map-page .fdmre-pan-chip {
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(15,23,42,.10);
  border-radius: 14px;
  padding: 12px 18px;
  box-shadow: 0 10px 28px rgba(15,23,42,.14);
  color: var(--fdmre-text);
  font-size: 16px;
  font-weight: 720;
  max-width: min(520px, calc(100vw - 420px));
  text-align: center;
}

/* Pro preview card inspired by realestate.com.au/Zillow map card. */
body.fdmre-map-page .fdmre-preview-card {
  right: 22px;
  top: 142px;
  width: min(390px, calc(100vw - 44px));
  pointer-events: auto;
  display: none;
  background: #fff;
  border: 1px solid rgba(15,23,42,.12);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 26px 70px rgba(15,23,42,.24);
}
body.fdmre-map-page .fdmre-preview-card.is-visible { display: block; }
body.fdmre-map-page .fdmre-preview-close {
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,.94);
  color: var(--fdmre-text);
  box-shadow: 0 8px 20px rgba(15,23,42,.16);
  font-size: 22px;
  font-weight: 800;
  cursor: pointer;
}
body.fdmre-map-page .fdmre-preview-media {
  height: 170px;
  background: linear-gradient(135deg, #dbeafe, #eff6ff);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fdmre-blue);
  font-weight: 950;
  letter-spacing: .04em;
  text-transform: uppercase;
}
body.fdmre-map-page .fdmre-preview-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
body.fdmre-map-page .fdmre-preview-body { padding: 16px 18px 18px; }
body.fdmre-map-page .fdmre-preview-kicker {
  font-size: 22px;
  line-height: 1.05;
  font-weight: 950;
  color: var(--fdmre-text);
  margin-bottom: 8px;
}
body.fdmre-map-page .fdmre-preview-title {
  font-size: 18px;
  line-height: 1.18;
  font-weight: 900;
  color: var(--fdmre-text);
  margin: 0 0 8px;
}
body.fdmre-map-page .fdmre-preview-sub,
body.fdmre-map-page .fdmre-preview-meta {
  color: #475569;
  font-size: 14px;
  line-height: 1.4;
  margin: 0 0 12px;
}
body.fdmre-map-page .fdmre-preview-actions a {
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--fdmre-blue);
  background: var(--fdmre-blue);
  color: #fff !important;
  font-weight: 900;
  cursor: pointer;
  text-decoration: none !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Hide native Leaflet popup when the pro preview card has taken over. */
body.fdmre-popup-managed.fdmre-map-page .fdmre-map-stage .leaflet-popup { display: none !important; }

/* Leaflet controls polish. */
body.fdmre-map-page .fdmre-map-stage .leaflet-control-zoom { border: 0 !important; box-shadow: 0 12px 28px rgba(15,23,42,.18) !important; }
body.fdmre-map-page .fdmre-map-stage .leaflet-control-zoom a {
  width: 46px !important;
  height: 46px !important;
  line-height: 46px !important;
  font-size: 24px !important;
  color: #111827 !important;
  border-color: rgba(15,23,42,.10) !important;
}
body.fdmre-map-page .fdmre-map-stage .leaflet-control-attribution { font-size: 11px !important; }
body.fdmre-map-page .fdmre-map-stage .leaflet-marker-icon:not(.marker-cluster) { filter: drop-shadow(0 10px 12px rgba(15,23,42,.28)); }
body.fdmre-map-page .fdmre-map-stage .marker-cluster,
body.fdmre-map-page .fdmre-map-stage .marker-cluster div { border-radius: 999px !important; }

body.fdmre-map-page footer,
body.fdmre-map-page .site-footer { margin-top: 0 !important; }

@media (max-width: 1200px) {
  body.fdmre-map-page .fdmre-topbar { grid-template-columns: minmax(260px, 1fr) auto auto auto auto; overflow-x: auto; }
  body.fdmre-map-page .fdmre-hide-tablet { display: none !important; }
  body.fdmre-map-page .fdmre-pan-chip { max-width: min(440px, calc(100vw - 360px)); }
}

@media (max-width: 900px) {
  body.fdmre-map-page .fdmre-topbar { top: calc(var(--wp-admin--admin-bar--height, 0px) + 70px); grid-template-columns: minmax(240px, 1fr) auto auto; padding: 9px 10px; gap: 8px; }
  body.admin-bar.fdmre-map-page .fdmre-topbar { top: calc(46px + 70px); }
  body.fdmre-map-page .fdmre-hide-mobile { display: none !important; }
  body.fdmre-map-page .fdmre-searchbox,
  body.fdmre-map-page .fdmre-btn,
  body.fdmre-map-page .fdmre-select { min-height: 42px; font-size: 13px; padding: 0 12px; }
  body.fdmre-map-page .fdmre-pan-chip { display: none; }
  body.fdmre-map-page .fdmre-update-chip { left: 10px; top: 10px; max-width: calc(100vw - 20px); font-size: 13px; padding: 10px 12px; }
  body.fdmre-map-page .fdmre-map-stage .fmi-safe-controls { left: 10px !important; right: 10px !important; top: 62px !important; grid-template-columns: 1fr 1fr auto !important; overflow-x: auto !important; }
  body.fdmre-map-page .fdmre-map-stage .fmi-safe-controls #fmiSafeMin,
  body.fdmre-map-page .fdmre-map-stage .fmi-safe-controls #fmiSafeMax { display: none !important; }
  body.fdmre-map-page .fdmre-preview-card { right: 10px; left: 10px; top: auto; bottom: 14px; width: auto; border-radius: 16px; }
  body.fdmre-map-page .fdmre-preview-media { height: 110px; }
  body.fdmre-map-page .fdmre-map-stage,
  body.fdmre-map-page .fdmre-map-stage #fmiSafeMap,
  body.fdmre-map-page .fdmre-map-stage .leaflet-container { min-height: calc(100vh - 124px) !important; height: calc(100vh - 124px) !important; }
}


/* v4.4.9 — Single full-screen map hardening.
   The real map is lifted into .fdmre-fullscreen-map-stage; all old map wrappers are hidden. */
body.fdmre-map-page.fdmre-map-lifted .fdmre-original-map-shell-hidden,
body.fdmre-map-page .fdmre-duplicate-map-hidden,
body.fdmre-map-page .fdmre-duplicate-map-node-hidden {
  display: none !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

body.fdmre-map-page.fdmre-map-lifted .fmi-safe-wrap:not(.fdmre-fullscreen-map-stage),
body.fdmre-map-page.fdmre-map-lifted .fmi-results-map-shell:not(.fdmre-fullscreen-map-stage),
body.fdmre-map-page.fdmre-map-lifted [data-fmp-map-panel]:not(.fdmre-fullscreen-map-stage) {
  display: none !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

body.fdmre-map-page .fdmre-fullscreen-map-stage {
  position: relative !important;
  width: 100vw !important;
  max-width: 100vw !important;
  height: calc(100vh - 150px) !important;
  min-height: calc(100vh - 150px) !important;
  margin: 0 !important;
  margin-left: calc(50% - 50vw) !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  overflow: hidden !important;
  background: #cfefff !important;
  box-shadow: none !important;
  z-index: 1 !important;
}
body.admin-bar.fdmre-map-page .fdmre-fullscreen-map-stage {
  height: calc(100vh - 182px) !important;
  min-height: calc(100vh - 182px) !important;
}

body.fdmre-map-page .fdmre-fullscreen-map-stage .fdmre-primary-map,
body.fdmre-map-page .fdmre-fullscreen-map-stage .leaflet-container {
  width: 100% !important;
  max-width: 100% !important;
  height: 100% !important;
  min-height: 100% !important;
  border-radius: 0 !important;
  border: 0 !important;
  margin: 0 !important;
  background: #cfefff !important;
  z-index: 1 !important;
}

/* When the map is lifted, the old plugin filter row should not create a second UI layer. */
body.fdmre-map-page .fdmre-fullscreen-map-stage .fmi-safe-controls,
body.fdmre-map-page .fdmre-fullscreen-map-stage .fmi-safe-head,
body.fdmre-map-page .fdmre-fullscreen-map-stage .fmi-safe-legend {
  display: none !important;
}

body.fdmre-map-page .fdmre-topbar {
  position: sticky !important;
  top: calc(var(--wp-admin--admin-bar--height, 0px) + 82px) !important;
  z-index: 9995 !important;
  border-bottom: 1px solid rgba(15,23,42,.12) !important;
}
body.admin-bar.fdmre-map-page .fdmre-topbar { top: calc(32px + 82px) !important; }

body.fdmre-map-page .fdmre-fullscreen-map-stage .fdmre-update-chip {
  top: 18px !important;
  left: 18px !important;
}
body.fdmre-map-page .fdmre-fullscreen-map-stage .fdmre-pan-chip {
  top: 18px !important;
}
body.fdmre-map-page .fdmre-fullscreen-map-stage .fdmre-preview-card {
  right: 24px !important;
  top: 118px !important;
}

body.fdmre-map-page .fdmre-fullscreen-map-stage .leaflet-top.leaflet-left {
  top: 94px !important;
}
body.fdmre-map-page .fdmre-fullscreen-map-stage .leaflet-top.leaflet-right {
  top: 86px !important;
}
body.fdmre-map-page .fdmre-fullscreen-map-stage .leaflet-bottom.leaflet-right {
  right: 22px !important;
  bottom: 22px !important;
}

/* Keep the page clean under the single map. */
body.fdmre-map-page.fdmre-ready .fdmre-hide-old-copy { display: none !important; }
body.fdmre-map-page.fdmre-ready footer,
body.fdmre-map-page.fdmre-ready .site-footer { display: none !important; }

@media (max-width: 900px) {
  body.fdmre-map-page .fdmre-fullscreen-map-stage,
  body.fdmre-map-page .fdmre-fullscreen-map-stage .fdmre-primary-map,
  body.fdmre-map-page .fdmre-fullscreen-map-stage .leaflet-container {
    height: calc(100vh - 124px) !important;
    min-height: calc(100vh - 124px) !important;
  }
  body.admin-bar.fdmre-map-page .fdmre-fullscreen-map-stage,
  body.admin-bar.fdmre-map-page .fdmre-fullscreen-map-stage .fdmre-primary-map,
  body.admin-bar.fdmre-map-page .fdmre-fullscreen-map-stage .leaflet-container {
    height: calc(100vh - 156px) !important;
    min-height: calc(100vh - 156px) !important;
  }
  body.fdmre-map-page .fdmre-fullscreen-map-stage .fdmre-update-chip { top: 10px !important; left: 10px !important; }
  body.fdmre-map-page .fdmre-fullscreen-map-stage .leaflet-top.leaflet-left { top: 74px !important; }
}
