/* MG Carte Pros — v1.6.0 */

.mg-cp-wrapper {
	display: block;
}

.mg-cp {
	display: flex;
	gap: 20px;
	align-items: stretch;
}

/* ---------- Colonne liste ---------- */

.mg-cp-liste {
	flex: 0 0 var(--mg-cp-list-w, 35%);
	max-width: var(--mg-cp-list-w, 35%);
	display: flex;
	flex-direction: column;
	max-height: var(--mg-cp-h, 520px);
}

.mg-cp-legende {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 14px;
	padding: 0 4px 10px;
	font-size: 0.82em;
	opacity: 0.85;
}

.mg-cp-legende-item {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	white-space: nowrap;
}

/* ---------- Barre d'outils : filtre + tri ---------- */

.mg-cp-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 16px;
	padding: 0 4px 10px;
}

.mg-cp-filtres {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 12px;
	font-size: 0.82em;
}

.mg-cp-filtre {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	cursor: pointer;
	white-space: nowrap;
	user-select: none;
}

/* Checkbox native masquée mais accessible (focus clavier conservé). */
.mg-cp-filtre input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
	margin: 0;
	pointer-events: none;
}

/* Rond custom : contour seul = décoché, plein = coché. */
.mg-cp-check {
	display: inline-block;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	border: 2px solid var(--mg-cat, #666);
	background: transparent;
	box-sizing: border-box;
	flex: 0 0 auto;
	transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.mg-cp-filtre input:checked + .mg-cp-check {
	background: var(--mg-cat, #666);
}

.mg-cp-filtre input:focus-visible + .mg-cp-check {
	box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.15);
}

.mg-cp-filtre:hover .mg-cp-check {
	box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

.mg-cp-filtre-actions {
	display: inline-flex;
	gap: 6px;
}

.mg-cp-btn {
	background: var(--mg-cp-btn-bg, #2a6df4);
	color: var(--mg-cp-btn-txt, #fff);
	border: none;
	border-radius: var(--mg-cp-radius, 8px);
	padding: 4px 10px;
	font-size: 1em;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.mg-cp-btn:hover:not(:disabled) {
	opacity: 0.85;
}

.mg-cp-btn:disabled {
	background: var(--mg-cp-btn-bg-off, #e5e5e5);
	color: var(--mg-cp-btn-txt-off, #9a9a9a);
	cursor: default;
}

.mg-cp-tri {
	font-size: 0.82em;
	padding: 4px 8px;
	border: 1px solid rgba(0, 0, 0, 0.15);
	border-radius: 6px;
	background: #fff;
	cursor: pointer;
	max-width: 100%;
}

.mg-cp-item-dist {
	font-size: 0.78em;
	opacity: 0.6;
	white-space: nowrap;
}

.mg-cp-items {
	overflow-y: auto;
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 4px;
	scrollbar-width: thin;
}

.mg-cp-item {
	background: var(--mg-cp-item-bg, #fff);
	border: 1px solid rgba(0, 0, 0, 0.08);
	border-radius: var(--mg-cp-radius, 8px);
	padding: 12px 14px;
	cursor: pointer;
	transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.mg-cp-item.is-active,
.mg-cp-item:hover,
.mg-cp-item:focus-visible {
	background: var(--mg-cp-hl, #eef3ff);
	border-color: rgba(0, 0, 0, 0.16);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
	outline: none;
}

.mg-cp-item-head {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.mg-cp-dot {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	flex: 0 0 auto;
}

.mg-cp-item-nom {
	font-weight: 600;
}

.mg-cp-item-cat {
	font-size: 0.78em;
	opacity: 0.65;
	margin-left: auto;
	white-space: nowrap;
}

.mg-cp-item-adresse {
	font-size: 0.88em;
	opacity: 0.8;
	margin-top: 4px;
	padding-left: 18px;
}

.mg-cp-item-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 14px;
	margin-top: 8px;
	padding-left: 18px;
	font-size: 0.85em;
}

.mg-cp-meta-link {
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* ---------- Colonne carte ---------- */

.mg-cp-carte {
	flex: 1 1 auto;
	min-width: 0;
}

.mg-cp-map {
	width: 100%;
	height: var(--mg-cp-h, 520px);
	border-radius: var(--mg-cp-radius, 8px);
	z-index: 1;
}

/* Marqueurs (divIcon) */
.mg-cp-pin {
	background: none;
	border: none;
}

.mg-cp-pin svg {
	display: block;
	filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
	transition: transform 0.15s ease;
	transform-origin: 50% 100%;
}

.mg-cp-pin.is-active svg {
	transform: scale(1.25);
}

/* Marqueur du point de référence */
.mg-cp-ref-pin {
	background: none;
	border: none;
	display: flex;
	align-items: center;
	justify-content: center;
}

.mg-cp-ref-icon {
	display: inline-flex;
	line-height: 1;
	filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}

.mg-cp-ref-icon svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
}

/* Popup */
.mg-cp-popup .leaflet-popup-content {
	margin: 12px 16px;
	font-size: 13px;
	line-height: 1.5;
}

.mg-cp-popup-nom {
	font-weight: 700;
	margin-bottom: 2px;
}

.mg-cp-popup-cat {
	font-size: 0.85em;
	opacity: 0.7;
	margin-bottom: 6px;
}

.mg-cp-popup a {
	text-decoration: underline;
}

/* ---------- Mention légale (pied de widget) ---------- */

.mg-cp-mention {
	margin: 14px 0 0;
	padding: 0 4px;
	font-size: var(--mg-cp-mention-size, 12px);
	line-height: 1.5;
	color: var(--mg-cp-mention-color, #666);
}

.mg-cp-mention--filet {
	border-top: 1px solid rgba(0, 0, 0, 0.1);
	padding-top: 12px;
}

.mg-cp-mention a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* ---------- Responsive ---------- */

@media (max-width: 767px) {
	.mg-cp {
		flex-direction: column; /* liste puis carte = carte en dessous */
	}

	.mg-cp--mobile-above {
		flex-direction: column-reverse; /* carte au-dessus */
	}

	.mg-cp-liste {
		flex-basis: auto;
		max-width: 100%;
		max-height: none;
	}

	.mg-cp-items {
		max-height: 60vh;
	}

	.mg-cp-map {
		height: var(--mg-cp-h-mobile, 320px);
	}

	.mg-cp--mobile-hidden .mg-cp-carte {
		display: none;
	}
}
