/* Associations map — mobile first. Site art direction: theme font, navy #072366, green #0aae70, flat, px units. */
.ifm-map-page { --navy: #072366; --green: #0aae70; --green-dark: #078658; --line: #e6ebe8; --soft: #f8fbfa; color: #555; }
.ifm-map-shell { max-width: 1240px; margin: 0 auto; padding: 0 16px; }

/* Header */
.ifm-map-head { padding: 24px 0 16px; background: var(--soft); }
.ifm-map-head h1 { margin: 0; color: var(--navy); font-size: 26px; font-weight: 800; line-height: 1.2; }
.ifm-map-head h1 span { color: var(--green); }
.ifm-map-head p { margin: 6px 0 0; color: #666; font-size: 15px; line-height: 1.5; }

/* App: tools on top, then map OR list (mobile) */
.ifm-map-app { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "tools" "content"; background: #fff; }
.ifm-tools { grid-area: tools; position: sticky; top: 0; z-index: 600; padding: 12px 16px 10px; background: var(--soft);
  border-bottom: 1px solid var(--line); }
.ifm-tools__row { display: flex; gap: 8px; }
.ifm-search { display: flex; flex: 1; align-items: center; gap: 8px; min-width: 0; height: 46px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 12px; background: #fff; color: #8a949b; }
.ifm-search:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(10, 174, 112, .15); }
.ifm-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: #1d2733; font: inherit; font-size: 16px; }
.ifm-near { display: inline-flex; flex: none; align-items: center; justify-content: center; gap: 8px; width: 46px; height: 46px;
  border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--navy); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.ifm-near__label { display: none; }
.ifm-near:hover, .ifm-near.is-on { border-color: var(--green); color: var(--green-dark); }
.ifm-near.is-loading { opacity: .6; cursor: progress; }
.ifm-select { position: relative; margin-top: 10px; }
.ifm-select summary { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px;
  background: #fff; color: var(--navy); font-size: 15px; font-weight: 700; list-style: none; cursor: pointer; user-select: none; }
.ifm-select summary::-webkit-details-marker { display: none; }
.ifm-select summary:hover, .ifm-select[open] summary { border-color: var(--green); }
.ifm-select.has-value summary { border-color: var(--navy); }
.ifm-select__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ifm-select__chev { flex: none; transition: transform .15s; }
.ifm-select[open] .ifm-select__chev { transform: rotate(180deg); }
.ifm-select__menu { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 700; max-height: 320px; overflow-y: auto; padding: 6px;
  border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 16px 36px rgba(7, 35, 102, .16); }
.ifm-opt { display: flex; align-items: center; gap: 12px; margin: 0; padding: 10px 12px; border-radius: 10px; color: #1d2733; font-size: 15px; font-weight: 600; cursor: pointer; }
.ifm-opt:hover { background: #f2f8f5; }
.ifm-opt input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--green); cursor: pointer; }
.ifm-tools__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 10px; }
.ifm-count { flex: 1; min-width: 0; order: 1; margin: 0; line-height: 1.4; color: #6b757c; font-size: 13px; font-weight: 600; }
.ifm-reset { flex: 1 1 100%; order: 3; text-align: left; padding: 0; border: 0; background: none; color: var(--green-dark); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.ifm-reset:hover { text-decoration: underline; }
.ifm-switch { display: inline-flex; flex: none; order: 2; padding: 3px; border-radius: 999px; background: #e9efec; }
.ifm-switch button { min-height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--navy);
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.ifm-switch button[aria-selected="true"] { background: #fff; color: var(--green-dark); box-shadow: 0 1px 3px rgba(7, 35, 102, .15); }

/* Content areas */
.ifm-list, .ifm-empty, .ifm-mapbox { grid-area: content; }
.ifm-map-app[data-view="map"] .ifm-list, .ifm-map-app[data-view="map"] .ifm-empty { display: none; }
.ifm-map-app[data-view="list"] .ifm-mapbox { display: none; }
.ifm-mapbox { position: relative; height: 66vh; min-height: 380px; margin: 12px; }
#ifm-map { position: absolute; inset: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: #e9eeeb;
  box-shadow: 0 6px 20px rgba(7, 35, 102, .08); }
.ifm-recenter { position: absolute; right: 12px; top: 12px; z-index: 500; min-height: 36px; padding: 0 14px; border: 0; border-radius: 999px;
  background: #fff; color: var(--navy); font: inherit; font-size: 13px; font-weight: 700; box-shadow: 0 2px 8px rgba(7, 35, 102, .18); cursor: pointer; }
.ifm-recenter:hover { color: var(--green-dark); }

/* List */
.ifm-list { margin: 0; padding: 8px 12px 24px; list-style: none; }
.ifm-item { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px;
  border-radius: 14px; cursor: pointer; transition: background-color .15s; }
.ifm-item + .ifm-item { border-top: 1px solid #f0f3f1; }
.ifm-item:hover, .ifm-item.is-active { background: #f2f8f5; }
.ifm-item.is-active { box-shadow: inset 3px 0 0 var(--green); }
.ifm-item__logo { display: grid; place-items: center; width: 52px; height: 52px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.ifm-item__logo img { width: 100%; height: 100%; padding: 5px; object-fit: contain; }
.ifm-item__body { min-width: 0; }
.ifm-item__name { display: -webkit-box; overflow: hidden; color: var(--navy); font-size: 15px; font-weight: 800; line-height: 1.3; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ifm-item__name button { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.ifm-star { margin-left: 4px; color: #d8a93a; font-style: normal; }
.ifm-item__place { display: block; overflow: hidden; margin-top: 2px; color: #707a81; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.ifm-item__causes { display: flex; gap: 4px; margin-top: 6px; overflow: hidden; }
.ifm-item__causes span { flex: none; padding: 2px 8px; border-radius: 999px; background: #eff4f2; color: #3d4b45; font-size: 12px; white-space: nowrap; }
.ifm-item__go { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--green-dark); text-decoration: none; }
.ifm-item__go:hover { background: #e3f3eb; }
.ifm-empty { margin: 0; padding: 32px 20px; color: #6b757c; font-size: 15px; text-align: center; }

/* Markers & clusters */
.ifm-pin span { position: absolute; left: 3px; top: 0; width: 24px; height: 24px; border: 3px solid #fff; border-radius: 50% 50% 50% 0;
  background: var(--green); transform: rotate(-45deg); box-shadow: 0 3px 8px rgba(7, 35, 102, .3); }
.ifm-pin.is-partner span { background: var(--navy); }
.ifm-pin.is-active span { background: #e3a008; }
.ifm-cluster { display: grid; place-items: center; border-radius: 50%; background: rgba(10, 174, 112, .22); }
.ifm-cluster span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--green); color: #fff;
  font-weight: 800; font-size: 14px; box-shadow: 0 2px 6px rgba(7, 35, 102, .25); }
.ifm-you { border: 3px solid #fff; border-radius: 50%; background: #2563eb; box-shadow: 0 0 0 6px rgba(37, 99, 235, .25); }
.leaflet-control-zoom { border: 0 !important; box-shadow: 0 2px 8px rgba(7, 35, 102, .18) !important; border-radius: 12px !important; overflow: hidden; }
.leaflet-control-zoom a { width: 36px !important; height: 36px !important; line-height: 36px !important; color: var(--navy) !important; border: 0 !important; }
.leaflet-control-zoom a + a { border-top: 1px solid var(--line) !important; }

/* Popup */
.leaflet-popup-content-wrapper { border-radius: 16px; box-shadow: 0 12px 30px rgba(7, 35, 102, .18); }
.leaflet-popup-content { margin: 14px 16px; }
.ifm-pop { display: grid; gap: 4px; width: 220px; font-family: inherit; }
.ifm-pop__top { display: flex; align-items: center; gap: 10px; }
.ifm-pop__logo { display: grid; place-items: center; flex: none; width: 44px; height: 44px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.ifm-pop__logo img { width: 100%; height: 100%; padding: 4px; object-fit: contain; }
.ifm-pop b { color: var(--navy); font-size: 15px; line-height: 1.3; }
.ifm-pop__partner { color: #8a6d1e; font-size: 12px; font-weight: 700; }
.ifm-pop__place { margin-top: 4px; color: #707a81; font-size: 13px; }
.ifm-pop__actions { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.ifm-pop__actions a { color: var(--green-dark); font-size: 13px; font-weight: 700; }
.ifm-pop__btn { padding: 8px 14px; border-radius: 999px; background: var(--green); color: #fff !important; text-decoration: none; }

/* Call to action */
.ifm-cta { padding: 40px 0 56px; background: #fff; border-top: 1px solid var(--line); }
.ifm-cta .ifm-map-shell { display: flex; flex-direction: column; gap: 16px; }
.ifm-cta h2 { margin: 0; color: var(--navy); font-size: 22px; font-weight: 800; }
.ifm-cta p { margin: 6px 0 0; font-size: 15px; }
.ifm-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 50px; padding: 0 26px; border-radius: 999px;
  background: var(--green); color: #fff !important; font-size: 15px; font-weight: 700; text-decoration: none !important; }
.ifm-btn:hover { background: var(--green-dark); }
.ifm-map-page :focus-visible { outline: 3px solid rgba(10, 174, 112, .5); outline-offset: 2px; }

/* ---------- Tablet & desktop: list panel + map side by side ---------- */
@media (min-width: 900px) {
  .ifm-map-shell { padding: 0 24px; }
  .ifm-map-head { padding: 44px 0 0; }
  .ifm-map-head h1 { font-size: 38px; }
  .ifm-map-head p { margin-top: 10px; font-size: 17px; }
  .ifm-map-app { grid-template-columns: 430px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "tools map" "list map"; height: calc(100vh - 140px); min-height: 600px; max-height: 860px;
    width: calc(100% - 48px); max-width: 1240px; margin: 28px auto 48px; overflow: hidden;
    border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 10px 30px rgba(7, 35, 102, .07); }
  .ifm-map-page { background: var(--soft); }
  .ifm-tools { position: static; padding: 18px 20px 12px; border-right: 1px solid var(--line); }
  .ifm-near { width: auto; padding: 0 14px; }
  .ifm-near__label { display: inline; }
  .ifm-switch { display: none; }
  .ifm-list, .ifm-empty { grid-area: list; display: block !important; overflow-y: auto; border-right: 1px solid var(--line); }
  .ifm-empty { display: none !important; }
  .ifm-empty:not([hidden]) { display: block !important; }
  .ifm-mapbox { grid-area: map; display: block !important; height: auto; min-height: 0; margin: 14px; }
  #ifm-map { border: 1px solid var(--line); border-radius: 16px; box-shadow: none; }
  .ifm-cta .ifm-map-shell { flex-direction: row; align-items: center; justify-content: space-between; }
}

/* Embedded in the associations list (List / Map switch): search and causes come from the top filter bar */
.ifm-map-page--embedded { background: transparent; }
.ifm-map-page--embedded .ifm-search, .ifm-map-page--embedded .ifm-select, .ifm-map-page--embedded .ifm-reset,
.ifm-map-page--embedded .ifm-switch { display: none !important; }
.ifm-map-page--embedded .ifm-tools { position: static; padding: 12px 14px; }
.ifm-map-page--embedded .ifm-tools__row { align-items: center; }
.ifm-map-page--embedded .ifm-tools__foot { order: -1; flex: 1; margin: 0; }
.ifm-map-page--embedded .ifm-tools { display: flex; align-items: center; gap: 10px; }
.ifm-map-page--embedded .ifm-near { width: auto; height: 40px; padding: 0 14px; }
.ifm-map-page--embedded .ifm-near__label { display: inline; }
.ifm-map-page--embedded .ifm-map-app { border: 1px solid var(--line); border-radius: 20px; overflow: hidden; margin-bottom: 40px; }
.ifm-map-page--embedded .ifm-mapbox { margin: 0; }
.ifm-map-page--embedded #ifm-map { border: 0; border-radius: 0; box-shadow: none; }
@media (max-width: 899.98px) {
  /* phones: map first; the list of the map stays reachable under it */
  .ifm-map-page--embedded .ifm-map-app[data-view] .ifm-mapbox { display: block !important; height: 60vh; }
  .ifm-map-page--embedded .ifm-map-app[data-view] .ifm-list { display: block !important; grid-area: auto; max-height: none; }
  .ifm-map-page--embedded .ifm-map-app { grid-template-areas: "tools" "content" "list"; }
}
@media (min-width: 900px) {
  .ifm-map-page--embedded .ifm-map-app { width: 100%; max-width: none; margin: 0 0 48px; box-shadow: 0 10px 30px rgba(7, 35, 102, .07); }
  .ifm-map-page--embedded .ifm-tools { padding: 14px 18px; }
  .ifm-map-page--embedded .ifm-mapbox { margin: 12px; }
  .ifm-map-page--embedded #ifm-map { border: 1px solid var(--line); border-radius: 14px; }
}
