/**
 * SNP Map — design aligné sur la maquette de référence.
 * Thème : rouge / cramoisi, cartes blanches, bord arrondi léger.
 * ⚠ Toutes les couleurs sont pilotées par les variables ci-dessous.
 */

.snp-app {
	--snp-accent: #c8102e;          /* rouge principal (boutons, bandeau) */
	--snp-accent-dark: #9b1b30;     /* maroon (libellés, titres) */
	--snp-open: #c8102e;
	--snp-closed: #94a3b8;
	--snp-bg: #ffffff;
	--snp-panel: #ffffff;
	--snp-panel-2: #ffffff;
	--snp-border: #e5e7eb;
	--snp-text: #111827;
	--snp-muted: #6b7280;
	--snp-cluster: #3b82f6;
	--snp-shadow: 0 10px 30px rgba(15, 23, 42, .08);
	--snp-height: 640px;

	position: relative;
	display: grid;
	grid-template-rows: auto 1fr;
	height: var(--snp-height);
	min-height: 440px;
	background: var(--snp-bg);
	border: 1px solid var(--snp-border);
	border-radius: 6px;
	overflow: hidden;
	box-shadow: var(--snp-shadow);
	color: var(--snp-text);
	font-family: var(--snp-font-family, inherit);
	font-size: var(--snp-font-size, 14px);
	font-weight: var(--snp-font-weight, 400);
	line-height: var(--snp-base-line-height, 1.5);
}

/* ⚠ Une règle `display` auteur écrase l'attribut `hidden` du navigateur.
   Garde-fou : tout élément [hidden] de la carte est réellement masqué. */
.snp-app [hidden] { display: none !important; }

.snp-app.snp-theme-dark {
	--snp-bg: #0f172a;
	--snp-panel: #111c33;
	--snp-panel-2: #16223c;
	--snp-border: #24334d;
	--snp-text: #e2e8f0;
	--snp-muted: #94a3b8;
	--snp-accent-dark: #f87171;
}

/* ----------------------------- Barre de filtres ----------------------------- */
.snp-topbar {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 20px;
	padding: 16px 20px;
	background: var(--snp-panel);
	border-bottom: 1px solid var(--snp-border);
}

.snp-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; position: relative; }

/* Champ recherche : largeur réduite ; les filtres se partagent l'espace restant. */
.snp-field--search { flex: 1 1 300px; max-width: 460px; }
.snp-field--category { flex: 1 1 200px; max-width: 320px; }
.snp-field--radius { flex: 1 1 240px; max-width: 380px; }
.snp-field--status { flex: 0 1 auto; }

.snp-label {
	font-size: var(--snp-label-size, 13.5px);
	font-weight: var(--snp-label-weight, 700);
	color: var(--snp-accent-dark);
	line-height: 1;
}

.snp-category,
.snp-search__input {
	width: 100%;
	height: 44px;
	padding: 0 12px;
	font: inherit;
	font-size: var(--snp-font-size, 14px);
	color: var(--snp-text);
	background: var(--snp-panel-2);
	border: 1px solid var(--snp-border);
	border-radius: 4px;
	outline: none;
	transition: border-color .18s, box-shadow .18s;
}
.snp-category:focus,
.snp-search__input:focus {
	border-color: var(--snp-accent);
	box-shadow: 0 0 0 3px rgba(200, 16, 46, .15);
}

/* Recherche */
.snp-search__box { position: relative; display: flex; }
.snp-search__input { padding-right: 52px; }
.snp-search__btn {
	position: absolute; right: 0; top: 0; bottom: 0; width: 48px;
	display: grid; place-items: center;
	background: var(--snp-accent); border: none;
	border-radius: 0 4px 4px 0; cursor: pointer; color: #fff;
	transition: filter .18s;
}
.snp-search__btn svg { width: 19px; height: 19px; }
.snp-search__btn:hover { filter: brightness(1.08); }

.snp-suggest {
	position: absolute; z-index: 1200; left: 0; right: 0; top: 100%;
	margin: 6px 0 0; padding: 6px; list-style: none;
	background: var(--snp-panel-2);
	border: 1px solid var(--snp-border);
	border-radius: 6px;
	box-shadow: var(--snp-shadow);
	max-height: 260px; overflow: auto;
}
.snp-suggest__item { padding: 9px 10px; font-size: var(--snp-suggest-size, 13px); border-radius: 4px; cursor: pointer; color: var(--snp-text); }
.snp-suggest__item:hover,
.snp-suggest__item:focus { background: rgba(200, 16, 46, .08); }

/* Distance Range */
.snp-radius {
	width: 100%;
	height: 24px;
	accent-color: var(--snp-accent);
	cursor: pointer;
}
.snp-radius-hint { font-size: var(--snp-hint-size, 12.5px); color: var(--snp-muted); }
.snp-radius-value { color: var(--snp-text); font-weight: 600; }
.snp-radius-ref { color: var(--snp-muted); font-style: italic; }

/* Statut */
.snp-field--status { align-items: flex-start; }
.snp-switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.snp-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.snp-switch__text { font-size: var(--snp-switch-size, 14px); font-weight: var(--snp-switch-weight, 700); color: var(--snp-text); min-width: 44px; }
.snp-switch__track {
	width: 54px; height: 28px; border-radius: 999px;
	background: #cbd5e1; position: relative; transition: background .2s; flex: none;
}
.snp-switch__thumb {
	position: absolute; top: 3px; left: 3px; width: 22px; height: 22px;
	background: #fff; border-radius: 50%; transition: transform .2s;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}
.snp-switch input:checked + .snp-switch__track { background: var(--snp-accent); }
.snp-switch input:checked + .snp-switch__track .snp-switch__thumb { transform: translateX(26px); }
.snp-switch input:focus-visible + .snp-switch__track { box-shadow: 0 0 0 3px rgba(200, 16, 46, .3); }

/* ----------------------------- Corps ----------------------------- */
.snp-body { display: grid; grid-template-columns: 420px 1fr; min-height: 0; }

.snp-sidebar {
	display: flex; flex-direction: column; min-height: 0;
	background: var(--snp-panel); border-right: 1px solid var(--snp-border);
}

/* Bandeau rouge */
.snp-sidebar__head {
	display: flex; align-items: center; justify-content: space-between;
	padding: 14px 18px;
	background: var(--snp-accent);
	color: #fff;
}
.snp-count { font-size: var(--snp-count-size, 15px); font-weight: var(--snp-count-weight, 800); }
.snp-print {
	display: inline-flex; align-items: center; gap: 8px;
	background: transparent; border: none; color: #fff;
	font: inherit; font-size: var(--snp-print-size, 13px); font-weight: var(--snp-print-weight, 800); letter-spacing: .04em;
	cursor: pointer; padding: 4px 2px;
}
.snp-print svg { width: 17px; height: 17px; }
.snp-print:hover { opacity: .85; }

.snp-list {
	flex: 1 1 auto; overflow-y: auto; margin: 0; padding: 0;
	list-style: none; scrollbar-width: thin;
}

/* Carte magasin */
.snp-card { padding: 18px 18px 16px; border-bottom: 1px solid var(--snp-border); cursor: pointer; transition: background .15s; }
.snp-card:hover { background: #fff9fa; }
.snp-card.is-active { background: #fff1f3; box-shadow: inset 4px 0 0 var(--snp-accent); }

.snp-card__top { display: flex; gap: 16px; align-items: flex-start; }
.snp-card__info { flex: 1 1 auto; min-width: 0; }
.snp-card__title {
	margin: 0 0 8px; font-size: var(--snp-title-size, 17px); font-weight: var(--snp-title-weight, 800); line-height: 1.25;
	color: var(--snp-accent-dark);
	display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.snp-card__dist { margin: 0 0 8px; font-size: var(--snp-dist-size, 12.5px); font-weight: var(--snp-dist-weight, 800); color: var(--snp-accent); }

.snp-card__logo {
	flex: none; display: grid; place-items: center;
}
.snp-card__logo img { max-width: 92px; max-height: 92px; object-fit: contain; }
/* Image (élément « image ») placée à droite : même plafond par défaut, extensible via la taille (px). */
.snp-card__logo .snp-el--image { margin: 0; }
.snp-card__logo .snp-el--image img { max-width: 92px; max-height: 92px; object-fit: contain; }

/* Lignes d'info */
.snp-row { display: flex; align-items: flex-start; gap: 9px; margin: 0 0 5px; font-size: var(--snp-sheet-size, 13px); font-weight: var(--snp-sheet-weight, inherit); color: var(--snp-muted); line-height: 1.4; }
.snp-row:last-child { margin-bottom: 0; }
.snp-ico { flex: none; width: 17px; height: 17px; color: var(--snp-accent); display: inline-flex; margin-top: 1px; }
.snp-ico svg { width: 100%; height: 100%; fill: currentColor; }
/* Repli : icônes de police (si Elementor ne rend pas les icônes en SVG). */
.snp-ico > i[class] { font-size: 15px; line-height: 1; font-style: normal; }
.snp-row__txt { min-width: 0; word-break: break-word; }
.snp-row__link { display: flex; align-items: flex-start; gap: 9px; color: inherit; text-decoration: none; }
.snp-row__link:hover .snp-row__txt { color: var(--snp-accent); text-decoration: underline; }

/* Champs ACF additionnels (« Champs à afficher ») */
.snp-extra-img { margin: 6px 0 0; }
.snp-extra-img img { max-width: 100%; height: auto; border-radius: 6px; display: block; }
.snp-ico:empty { display: none; }

/* Composition par zones (« sheet ») : zones + éléments */
.snp-zone { min-width: 0; }
.snp-zone + .snp-zone { margin-top: 8px; }
.snp-zone--title { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.snp-zone--title .snp-card__title { margin: 0; }
/* Zone « au-dessus du titre » (cover) : image / logo en tête de la fiche. */
.snp-zone--cover { margin: 0; }
.snp-zone--cover + .snp-zone { margin-top: 10px; }
.snp-zone--cols-2 {
	display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 6px 18px; align-items: start;
	grid-auto-flow: row dense;
}
.snp-zone--cols-2 > .snp-zone-item[data-col="1"] { grid-column: 1; }
.snp-zone--cols-2 > .snp-zone-item[data-col="2"] { grid-column: 2; }
/* Rangées « même ligne » (numéro de groupe par élément) : éléments côte à
   côte, retour à la ligne automatique. Une rangée occupe toute la largeur de
   sa zone, même lorsque la zone est en 2 colonnes. */
.snp-zone-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 6px 0 0; }
.snp-zone--cols-2 > .snp-zone-row { grid-column: 1 / -1; }
.snp-el { margin: 0; }
.snp-el--text { font-size: var(--snp-sheet-size, 13px); font-weight: var(--snp-sheet-weight, inherit); color: var(--snp-muted); line-height: 1.4; }
.snp-el--image { margin: 6px 0 0; }
.snp-el--image img { max-width: 100%; max-height: 92px; width: auto; height: auto; border-radius: 6px; display: block; }
.snp-el__logo { max-width: 92px; max-height: 92px; object-fit: contain; }

/* Champs regroupés « en ligne » (ex. logos réseaux sociaux côte à côte). */
.snp-extra-inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 6px 0 0; }
/* Lien « icône seule » : URL masquée. */
.snp-ico-link { display: inline-flex; width: 22px; height: 22px; color: var(--snp-accent); text-decoration: none; }
.snp-ico-link .snp-ico { width: 22px; height: 22px; margin: 0; }
.snp-ico-link:hover { opacity: .75; }
/* Badge doux pour les labels. */
.snp-badge--soft { background: rgba(0, 0, 0, .07); color: var(--snp-accent); }

.snp-badge {
	font-size: var(--snp-badge-size, 10px); font-weight: var(--snp-badge-weight, 800); text-transform: uppercase; letter-spacing: .05em;
	padding: 2px 7px; border-radius: 999px; color: #fff;
}
.snp-badge--open { background: var(--snp-open); }
.snp-badge--closed { background: var(--snp-closed); }

.snp-card__actions { display: flex; gap: 10px; margin-top: 14px; }

.snp-btn {
	display: inline-flex; align-items: center; justify-content: center;
	height: 40px; padding: 0 22px; border-radius: 4px;
	font: inherit; font-size: var(--snp-btn-size, 13.5px); font-weight: var(--snp-btn-weight, 700); text-decoration: none;
	cursor: pointer; border: 1px solid transparent; transition: background .18s, filter .18s;
}
.snp-btn--primary { background: var(--snp-accent); color: #fff; }
.snp-btn--primary:hover { filter: brightness(1.08); }
.snp-btn--ghost { background: transparent; color: var(--snp-accent); border-color: var(--snp-accent); }
.snp-btn--ghost:hover { background: rgba(200, 16, 46, .07); }

.snp-loading { display: grid; place-items: center; padding: 24px; }
.snp-spinner {
	width: 26px; height: 26px; border-radius: 50%;
	border: 3px solid var(--snp-border); border-top-color: var(--snp-accent);
	animation: snp-spin .8s linear infinite;
}
@keyframes snp-spin { to { transform: rotate(360deg); } }

.snp-empty { padding: 20px 16px; margin: 0; font-size: var(--snp-empty-size, 13.5px); color: var(--snp-muted); text-align: center; }

/* ----------------------------- Carte ----------------------------- */
.snp-map-wrap { position: relative; min-height: 0; }
.snp-map { position: absolute; inset: 0; background: #e8eef4; }
.leaflet-container { font: inherit; }

.leaflet-control-zoom a,
.snp-geo-control a {
	width: 34px !important; height: 34px !important; line-height: 34px !important;
	color: var(--snp-text) !important; font-size: 20px !important;
}
.snp-geo-control a { display: grid; place-items: center; line-height: 1 !important; }
.snp-geo-control a svg { width: 18px; height: 18px; color: var(--snp-accent); }

/* Épingles personnalisables (forme, taille, couleur, bordure, ombre, logo) */
.snp-pin-wrap { background: transparent; border: none; }
.snp-pin {
	--snp-pin-size: 38px;
	--snp-pin-bg: var(--snp-accent);
	--snp-pin-border-color: #fff;
	--snp-pin-border-width: 3px;
	--snp-pin-shadow: 0 8px 16px rgba(15, 23, 42, .32);
	--snp-pin-logo-size: 22px;
	width: var(--snp-pin-size); height: var(--snp-pin-size);
	border-radius: 50% 50% 50% 0;
	transform: rotate(-45deg);
	background: var(--snp-pin-bg);
	border: var(--snp-pin-border-width) solid var(--snp-pin-border-color);
	box-shadow: var(--snp-pin-shadow);
	display: grid; place-items: center;
}
/* Formes : goutte (défaut, ci-dessus), cercle, carré arrondi. */
.snp-pin--circle, .snp-pin--square { transform: none; }
.snp-pin--circle { border-radius: 50%; }
.snp-pin--square { border-radius: 6px; }
/* Statut : conservé tant que la couleur n'est pas explicitement fixée. */
.snp-pin.is-closed { background: var(--snp-closed); }
.snp-pin.is-unknown { background: #b91c1c; }
.snp-pin.is-closed.snp-pin--fixed,
.snp-pin.is-unknown.snp-pin--fixed { background: var(--snp-pin-bg); }
.snp-pin__logo {
	width: var(--snp-pin-logo-size); height: var(--snp-pin-logo-size);
	border-radius: 50%; background: #fff;
	overflow: hidden; display: grid; place-items: center;
	transform: rotate(45deg);
}
.snp-pin--circle .snp-pin__logo, .snp-pin--square .snp-pin__logo { transform: none; }
.snp-pin__logo img { width: 100%; height: 100%; object-fit: contain; }
.snp-pin__logo--ph { background: #fff; }
.snp-pin__logo--ph::after { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--snp-accent); }
/* Épingle « image personnalisée » (L.icon) : pas de fond Leaflet par défaut. */
.snp-pin-img { background: transparent; border: none; }

/* Position utilisateur */
.snp-me-wrap { background: transparent; border: none; }
.snp-me {
	width: 18px; height: 18px; border-radius: 50%;
	background: #2563eb; border: 3px solid #fff; position: relative;
	box-shadow: 0 0 0 2px rgba(37, 99, 235, .35);
}
.snp-me__pulse {
	position: absolute; inset: -8px; border-radius: 50%;
	background: rgba(37, 99, 235, .25); animation: snp-pulse 1.8s ease-out infinite;
}
@keyframes snp-pulse { 0% { transform: scale(.6); opacity: .9; } 100% { transform: scale(1.6); opacity: 0; } }

/* Clusters bleus */
.snp-cluster-wrap { background: transparent; border: none; }
.snp-cluster {
	width: 44px; height: 44px; border-radius: 50%;
	display: grid; place-items: center;
	background: var(--snp-cluster, #3b82f6); color: #fff;
	font-weight: 800; font-size: 15px;
	border: 3px solid rgba(255, 255, 255, .9);
	box-shadow: 0 8px 20px rgba(59, 130, 246, .4);
}

/* Popup (encart carte) — espacement calé sur les cartes de la liste.
   On neutralise la marge interne de Leaflet et on gère tout dans .snp-pop. */
.snp-popup .leaflet-popup-content-wrapper { border-radius: 8px; padding: 0; box-shadow: var(--snp-shadow); }
.snp-popup .leaflet-popup-content { margin: 0; }
.snp-popup .leaflet-popup-close-button {
	color: var(--snp-muted); font-size: 20px;
	width: 30px; height: 30px; line-height: 30px; padding: 0;
	top: 4px; right: 4px; border-radius: 4px;
}
.snp-popup .leaflet-popup-close-button:hover { background: rgba(15, 23, 42, .06); }

.snp-pop { padding: 24px 24px 22px; }
.snp-pop__top { display: flex; gap: 18px; align-items: flex-start; }
.snp-pop__info { flex: 1 1 auto; min-width: 0; }
.snp-pop__title {
	margin: 2px 0 12px; font-size: var(--snp-title-size, 17px); font-weight: var(--snp-title-weight, 800); color: var(--snp-accent-dark); line-height: 1.25;
	padding-right: 24px; /* laisse respirer les titres longs sous la croix */
}
.snp-pop__logo { flex: none; display: grid; place-items: center; }
.snp-pop__logo img { max-width: 76px; max-height: 76px; object-fit: contain; }
.snp-pop__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.snp-pop__actions .snp-btn { height: 40px; padding: 0 20px; }

/* ----------------------------- Responsive ----------------------------- */
@media (max-width: 1024px) {
	.snp-body { grid-template-columns: 340px 1fr; }
	.snp-topbar { gap: 16px; }
	.snp-field--search { flex-basis: 100%; max-width: none; }
}

@media (max-width: 860px) {
	.snp-topbar { gap: 16px; }
	.snp-field--search { flex-basis: 100%; max-width: none; }
	.snp-body { grid-template-columns: 1fr; grid-template-rows: 52vh 1fr; }
	.snp-map-wrap { order: -1; }
	.snp-sidebar { border-right: none; border-top: 1px solid var(--snp-border); }
	.snp-list { max-height: 46vh; }
	.snp-card__logo img { max-width: 74px; max-height: 74px; }
}

@media (max-width: 520px) {
	.snp-topbar { gap: 14px; }
	.snp-field--search,
	.snp-field--category,
	.snp-field--radius { flex-basis: 100%; max-width: none; }
	.snp-card__actions .snp-btn { flex: 1 1 auto; }
}

/* ----------------------------- Filtres (bouton + fenêtre) ----------------------------- */
.snp-filter-btn {
	display: inline-flex; align-items: center; gap: 8px;
	height: 44px; padding: 0 18px;
	border: 1px solid var(--snp-border); border-radius: 8px;
	background: var(--snp-panel); color: var(--snp-accent-dark);
	font: inherit; font-weight: var(--snp-button-weight, 700); cursor: pointer;
}
.snp-filter-btn svg { width: 18px; height: 18px; }
.snp-filter-btn:hover { border-color: var(--snp-accent); }
.snp-filter-count {
	display: inline-flex; align-items: center; justify-content: center;
	min-width: 20px; height: 20px; padding: 0 6px;
	border-radius: 999px; background: var(--snp-accent); color: #fff;
	font-size: var(--snp-fcount-size, 12px); font-weight: var(--snp-fcount-weight, 700);
}
.snp-filter-modal { position: fixed; inset: 0; z-index: 1200; display: flex; align-items: center; justify-content: center; }
.snp-filter-modal[hidden] { display: none !important; }
.snp-filter-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .55); }
.snp-filter-dialog {
	position: relative; z-index: 1;
	width: min(420px, calc(100% - 32px));
	max-height: min(80vh, 640px);
	display: flex; flex-direction: column;
	background: var(--snp-bg); color: var(--snp-text);
	border: 1px solid var(--snp-border); border-radius: 14px;
	box-shadow: 0 24px 60px rgba(15, 23, 42, .35); overflow: hidden;
}
.snp-filter-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; background: var(--snp-accent); color: #fff; font-weight: var(--snp-title-weight, 800); cursor: move; cursor: grab; user-select: none; -webkit-user-select: none; touch-action: none; }
.snp-filter-head__left { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.snp-filter-move { display: inline-flex; align-items: center; opacity: .85; }
.snp-filter-move svg { display: block; }
.snp-filter-dialog--dragging { transition: none; }
.snp-filter-dialog--dragging .snp-filter-head { cursor: grabbing; }
.snp-filter-title { font-size: var(--snp-ftitle-size, 16px); }
.snp-filter-close { border: 0; background: transparent; color: #fff; font-size: 24px; line-height: 1; cursor: pointer; }
.snp-filter-body { padding: 16px 18px; overflow: auto; display: flex; flex-direction: column; gap: 16px; }
.snp-filter-group { display: flex; flex-direction: column; gap: 10px; }
.snp-filter-group__title { font-size: var(--snp-label-size, 13.5px); font-weight: var(--snp-label-weight, 700); color: var(--snp-accent-dark); text-transform: uppercase; letter-spacing: .04em; }
.snp-filter-option { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: var(--snp-foption-size, 14px); }
.snp-filter-option input { width: 18px; height: 18px; accent-color: var(--snp-accent); }
.snp-filter-foot { padding: 14px 18px; border-top: 1px solid var(--snp-border); display: flex; justify-content: flex-end; }
.snp-filter-modal .snp-suggest { position: static; margin-top: 8px; }

/* Impression */
@media print {
	.snp-topbar, .snp-map-wrap, .snp-print, .snp-filter-modal { display: none !important; }
	.snp-app { height: auto; border: none; box-shadow: none; }
	.snp-list { overflow: visible; max-height: none; }
}

/* Contour (GeoJSON) : infobulle des zones */
.leaflet-tooltip.snp-geo-tip {
	background: #fff; border: 1px solid var(--snp-border, #e6e6e6); border-radius: 4px;
	padding: 4px 8px; font-size: 12.5px; font-weight: 700; color: var(--snp-accent-dark, #333);
	box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
}
.leaflet-tooltip.snp-geo-tip::before { border-top-color: #fff; }

/* Contour (GeoJSON) : voile alpha sur l'extérieur (non cliquable) */
.snp-geo-mask { pointer-events: none; filter: blur(var(--snp-geo-blur, 0px)); }