/* ===== Carte des offres ===== */
:root {
  --pin-eci: #c4a35a;   /* Offres en cours (Cabinet ECI) : or */
  --pin-nat: #0b1d36;   /* Offres nationales : marine */
  --pin-immo: #2f6e6a;  /* Ventes immobilières : vert d’eau profond */
}
.page-carte section { padding: 0; }
.carte-main { background: var(--cream); }

/* Barre d’outils (titre + filtres) */
.map-toolbar { background: var(--cream); border-bottom: 1px solid var(--line); padding: 14px 0 10px; }
.map-head { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "t s c"; align-items: center; gap: 8px 20px; margin-bottom: 6px; }
.map-head h1 { grid-area: t; }
.map-head .mchips-src { grid-area: s; }
.map-head .map-count { grid-area: c; }
.map-head h1 { font-family: "Playfair Display", Georgia, serif; font-weight: 500; color: var(--navy); font-size: clamp(24px, 3vw, 34px); line-height: 1.1; }
.map-count { font-size: 14px; color: var(--muted); white-space: nowrap; }
.map-count b { color: var(--navy); font-size: 16px; }

.mchips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding: 2px 0 6px; scroll-snap-type: x proximity; }
.mchips::-webkit-scrollbar { display: none; }
.mchips + .mchips { margin-top: 4px; }
.mchip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px; scroll-snap-align: start;
  min-height: 40px; padding: 0 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--navy);
  font: 600 14px/1 "Source Sans 3", system-ui, sans-serif; white-space: nowrap;
  -webkit-tap-highlight-color: transparent; transition: background .15s, color .15s, border-color .15s;
}
.mchip:active { transform: scale(.97); }
.mchip-n { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--cream-2); color: var(--navy); font-size: 12px; font-weight: 700; }
.mchip-ico { width: 18px; height: 18px; color: var(--gold-dark); }
.mchip.is-empty { opacity: .45; }

/* Sources : pastille de couleur + état activé */
.mchip-dot { width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(11,29,54,.25); }
.mchip--eci .mchip-dot { background: var(--pin-eci); }
.mchip--nat .mchip-dot { background: var(--pin-nat); }
.mchip--immo .mchip-dot { background: var(--pin-immo); }
.mchip-src:not(.is-on) { color: var(--muted); background: transparent; border-style: dashed; }
.mchip-src:not(.is-on) .mchip-dot { background: transparent; box-shadow: inset 0 0 0 2px rgba(11,29,54,.35); }
.mchip-src.is-on.mchip--eci { background: #fbf4e3; border-color: var(--pin-eci); }
.mchip-src.is-on.mchip--nat { background: #e9edf4; border-color: var(--pin-nat); }
.mchip-src.is-on.mchip--immo { background: #e6f1f0; border-color: var(--pin-immo); }
/* Activité : sélection unique, marine */
.mchip-act.is-on { background: var(--navy); color: var(--cream); border-color: var(--navy); }
.mchip-act.is-on .mchip-ico { color: var(--gold); }
.mchip-act.is-on .mchip-n { background: var(--gold); color: var(--navy); }

/* Carte */
.map-shell { position: relative; z-index: 0; isolation: isolate; height: 70vh; min-height: 360px; background: #e8e4da; }
.map { position: absolute; inset: 0; z-index: 1; }
.leaflet-container { font-family: "Source Sans 3", system-ui, sans-serif; background: #e8e4da; }
.leaflet-control-attribution { font-size: 11px; }
.leaflet-bar a { width: 40px !important; height: 40px !important; line-height: 40px !important; color: var(--navy); font-size: 20px; }
.leaflet-touch .leaflet-bar { border: 0; box-shadow: 0 4px 14px rgba(11,29,54,.18); border-radius: 12px; overflow: hidden; }

.map-zones { position: absolute; z-index: 500; left: 12px; top: 12px; display: flex; gap: 6px; }
.map-zones button {
  min-height: 38px; padding: 0 12px; border-radius: 999px; border: 0; cursor: pointer;
  background: rgba(255,255,255,.96); color: var(--navy); font: 700 13px "Source Sans 3", sans-serif;
  box-shadow: 0 4px 14px rgba(11,29,54,.18);
}
.map-zones button:active { background: var(--cream-2); }
.map-zones button.is-on { background: var(--navy); color: var(--cream); }

/* Légende repliable */
.map-legend {
  position: absolute; z-index: 500; left: 12px; bottom: 28px; max-width: 240px;
  background: rgba(255,255,255,.97); border-radius: 14px; box-shadow: 0 6px 20px rgba(11,29,54,.18);
  font-size: 13px; color: var(--navy);
}
.map-legend summary { list-style: none; cursor: pointer; padding: 9px 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.map-legend summary::-webkit-details-marker { display: none; }
.map-legend summary::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: conic-gradient(var(--pin-eci) 0 120deg, var(--pin-nat) 0 240deg, var(--pin-immo) 0); }
.map-legend ul { list-style: none; margin: 0; padding: 0 14px 10px; display: grid; gap: 6px; }
.map-legend .ml-acts { border-top: 1px solid var(--line); padding-top: 10px; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.map-legend[open] { max-width: 330px; max-height: calc(100% - 80px); overflow: auto; }
.map-legend li { display: flex; align-items: center; gap: 8px; line-height: 1.2; }
.ml-pin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(11,29,54,.3); flex: 0 0 auto; }
.ml-pin--eci { background: var(--pin-eci); }
.ml-pin--nat { background: var(--pin-nat); }
.ml-pin--immo { background: var(--pin-immo); }
.ml-pin--approx { background: #fff; border: 2px dashed var(--navy); box-shadow: none; }
.ml-ico { width: 22px; height: 22px; border-radius: 50%; background: var(--navy); color: var(--gold-2); display: grid; place-items: center; flex: 0 0 auto; }
.ml-ico svg { width: 14px; height: 14px; }

/* Épingles */
.eci-pin-wrap { background: none; border: 0; }
.eci-pin {
  position: relative; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  border: 2.5px solid #fff; box-shadow: 0 4px 10px rgba(11,29,54,.35); transition: transform .15s ease;
}
.eci-pin::after {
  content: ""; position: absolute; left: 50%; bottom: -8px; width: 12px; height: 12px; margin-left: -6px;
  background: inherit; border-right: 2.5px solid #fff; border-bottom: 2.5px solid #fff; transform: rotate(45deg); z-index: -1;
  border-bottom-right-radius: 3px;
}
.eci-pin-ico { width: 21px; height: 21px; }
.eci-pin--eci { background: var(--pin-eci); color: var(--navy); }
.eci-pin--nat { background: var(--pin-nat); color: var(--gold-2); }
.eci-pin--immo { background: var(--pin-immo); color: #fff; }
.eci-pin.is-approx { border-style: dashed; }
.leaflet-marker-icon:hover .eci-pin, .leaflet-marker-icon:focus .eci-pin { transform: translateY(-2px) scale(1.06); }

/* Groupes (cluster) : anneau aux couleurs des sources */
.eci-cluster-wrap { background: none; border: 0; }
.eci-cluster { display: grid; place-items: center; border-radius: 50%; box-shadow: 0 4px 12px rgba(11,29,54,.35); }
.eci-cluster b {
  display: grid; place-items: center; width: calc(100% - 10px); height: calc(100% - 10px); border-radius: 50%;
  background: #fff; color: var(--navy); font: 700 15px "Source Sans 3", sans-serif;
}

/* Popup */
.eci-popup .leaflet-popup-content-wrapper { padding: 0; border-radius: 16px; overflow: hidden; box-shadow: 0 14px 40px rgba(11,29,54,.28); }
.eci-popup .leaflet-popup-content { margin: 0; width: 270px !important; line-height: 1.35; }
.eci-popup a.leaflet-popup-close-button {
  top: 8px; right: 8px; width: 32px; height: 32px; border-radius: 50%; background: rgba(11,29,54,.72);
  color: #fff; font: 22px/30px Arial, sans-serif; text-align: center; z-index: 2;
}
.mp-photo { display: block; position: relative; height: 132px; background: var(--navy) center/cover no-repeat; }
.mp-src { position: absolute; left: 10px; bottom: 10px; padding: 4px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; }
.mp-src--eci { background: var(--pin-eci); color: var(--navy); }
.mp-src--nat { background: var(--pin-nat); color: var(--gold-2); }
.mp-src--immo { background: var(--pin-immo); color: #fff; }
.mp-body { padding: 12px 14px 14px; }
.mp-cat { display: flex; align-items: center; gap: 6px; margin: 0 0 4px !important; color: var(--gold-dark); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.mp-cat-ico { width: 16px; height: 16px; }
.mp-title { font-family: "Playfair Display", Georgia, serif; font-size: 17px; font-weight: 600; color: var(--navy); line-height: 1.2; margin: 0 0 4px; }
.mp-city { margin: 0 0 6px !important; color: var(--muted); font-size: 14px; }
.mp-addr { display: flex; align-items: flex-start; gap: 5px; margin: 0 0 8px !important; color: var(--ink, #2b3442); font-size: 14px; line-height: 1.35; }
.mp-addr-ico { width: 15px; height: 15px; flex: 0 0 auto; margin-top: 2px; color: var(--gold-dark); }
.mp-price { margin: 0 0 8px !important; font-size: 18px; font-weight: 700; color: var(--navy); }
.mp-price small { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.mp-dl { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin: 0 0 10px !important; padding: 6px 10px; border-radius: 10px; font-size: 13px; }
.mp-dl svg { width: 15px; height: 15px; flex: 0 0 auto; }
.mp-dl.is-ok { background: #f3ecdc; color: var(--navy); }
.mp-dl.is-urgent { background: #fbe7e4; color: #9b2c1f; }
.mp-dl span { color: var(--muted); }
.mp-approx { margin: -4px 0 8px !important; font-size: 12.5px; color: var(--muted); font-style: italic; }
.mp-btn { width: 100%; min-height: 44px; font-size: 15px; color: var(--cream) !important; }

.map-note { padding: 18px 0 28px; display: grid; gap: 12px; }
.map-note p:last-child { display: flex; flex-wrap: wrap; gap: 10px; }

.mchip-s { display: none; }
.mchips-act { -webkit-mask-image: linear-gradient(90deg, #000 92%, transparent); mask-image: linear-gradient(90deg, #000 92%, transparent); }
@media (max-width: 900px) {
  .map-toolbar { padding: 10px 0 6px; }
  .map-head { grid-template-columns: 1fr auto; grid-template-areas: "t c" "s s"; gap: 6px 10px; }
  .mchips-src { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; overflow: visible; padding: 0; }
  .mchips-src .mchip { justify-content: center; gap: 4px; padding: 0 4px; font-size: 13px; min-width: 0; letter-spacing: -.005em; }
  .mchips-src .mchip-dot { width: 10px; height: 10px; }
  .mchips-src .mchip-l { display: none; }
  .mchips-src .mchip-s { display: inline; overflow: hidden; text-overflow: ellipsis; }
  .mchips-src .mchip-n { min-width: 18px; height: 18px; padding: 0 4px; font-size: 11px; }
  .map-toolbar .container { width: 100%; padding: 0 12px; }
  .map-head { margin-bottom: 6px; }
  .map-head h1 { font-size: 22px; }
  .map-count { font-size: 13px; }
  .mchip { min-height: 38px; font-size: 13.5px; padding: 0 11px; }
  .map-legend { bottom: 22px; left: 10px; }
  .map-zones { left: 10px; top: 10px; }
  .map-note .btn { flex: 1 1 100%; }
}
.mp-also { margin: 0 0 8px !important; font-size: 12.5px; color: var(--muted); }
.mp-also a { color: inherit; text-decoration: underline; }
