/**
 * Iroise Bellevie — Cartographie (feuille de style unique)
 * ---------------------------------------------------------------------------
 * Source unique de tout le design des cartes : overlay, boîtes de résultats,
 * popups, marqueurs, filtre "Google-like" des tuiles, overlay tactile mobile.
 *
 * Palette pilotée par variables CSS. La couleur d'accentuation de chaque marque
 * est passée en ligne sur la racine `.ib-map` via `--ib-primary`, donc changer
 * de couleur = une seule ligne (aucun CSS à dupliquer entre EHPAD / Repas).
 *
 *   EHPAD / Résidences  → --ib-primary: #ac371c (défaut)
 *   Iroise Repas        → --ib-primary: #2e59a4 (posé en ligne par le shortcode)
 *
 * Les anciennes classes (.ib-prox-*, .ibr-prox-*, .ib-single-*) restent posées
 * sur les éléments par le rendu PHP, pour préserver un éventuel CSS thème client.
 * ========================================================================= */

.ib-map {
	--ib-primary: #ac371c;          /* accent de marque (surchargé en ligne)   */
	--ib-primary-dark: #8c2d16;     /* accent survol (surchargé en ligne)      */
	--ib-card-bg: #ffeee3;          /* fond des boîtes "beige chaud"           */
	--ib-radius: 20px;              /* rayon unifié des boîtes                 */
	--ib-ink: #111827;              /* texte principal                         */
	--ib-muted: #6B7280;            /* texte secondaire                        */
	--ib-border: #E5E7EB;           /* bordures neutres                        */
	--ib-map-height: 520px;         /* hauteur carte (desktop)                 */
	--ib-map-height-mobile: 460px;  /* hauteur carte (mobile)                  */
}

/* =========================================================================
   Carte (conteneur Leaflet)
   ========================================================================= */

.ib-map-canvas {
	width: 100%;
	height: var(--ib-map-height);
	border-radius: var(--ib-radius);
}

/* Filtre "Google Maps like" : moins saturé, plus clair, légèrement plus chaud. */
.ib-map-canvas .leaflet-tile-pane {
	filter: saturate(1.3) brightness(1) contrast(1) sepia(0) hue-rotate(370deg);
}

/* =========================================================================
   Wrapper carte + overlay
   ========================================================================= */

.ib-map-wrapper {
	position: relative;
	border-radius: var(--ib-radius);
	overflow: hidden;
}

/* =========================================================================
   Overlay — la « boîte » flottante (recherche, marque, ou fiche établissement)
   ========================================================================= */

.ib-map-overlay {
	position: absolute;
	top: 50px;
	left: 50px;
	z-index: 1000;
	width: 430px;
	max-width: calc(100% - 48px);
	padding: 28px 30px 24px;
	background: var(--ib-card-bg);
	backdrop-filter: blur(6px);
	border-radius: var(--ib-radius);
	box-shadow: 0 4px 24px rgba(0, 0, 0, .12);
	box-sizing: border-box;
}

.ib-map-overlay-title {
	margin: 0 0 16px;
	font-size: 22px;
	font-weight: 600;
	line-height: 1.2;
	color: var(--ib-primary);
	text-transform: uppercase;
	letter-spacing: 0;
}

.ib-map-overlay-sub {
	margin: 12px 0 16px;
	font-style: italic;
	line-height: 1.4;
}
.ib-map-overlay-heading .ville-style {
    font-style: italic;
}

/* Bloc marque (icône + nom) */
.ib-map-brand {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0 0 16px;
}
.ib-map-brand-icon {
	flex-shrink: 0;
	width: 80px;
	height: 80px;
	object-fit: contain;
}
.ib-map-brand-text {
	display: flex;
	flex-direction: column;
	line-height: 1.25;
}


@media (max-width: 768px) { .ib-map-brand-main {font-size: 26px;} }
@media (min-width: 768px) { .ib-map-brand-main {font-size: 32px;} }

.ib-map-brand-main {
    color: var(--ib-primary);
    
    letter-spacing: -1px;
}
.ib-map-brand-sub {
    font-size: 82%;
    font-weight: 500;
    color: var(--ib-muted);
    font-style: italic;
}

/* =========================================================================
   Overlay — variante fiche établissement (single)
   ========================================================================= */

.ib-map-overlay-header {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0 0 16px;
}

@media (max-width: 768px) {
.ib-map-overlay-icon { width: 90px;	height: 90px; }
.ib-map-overlay-heading { font-size: 27px; }
}

@media (min-width: 768px) {
.ib-map-overlay-icon { width: 90px;	height: 90px; }
.ib-map-overlay-heading { font-size: 32px; }
}

.ib-map-overlay-icon {
	flex-shrink: 0;
	object-fit: contain;
}
.ib-map-overlay-heading {
	margin: 0;
	font-weight: 400;
	line-height: 1.2;
	color: var(--ib-primary);
}
.ib-map-overlay-address {
	margin: 0 0 18px;
}
.ib-map-tel {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0 0 20px;
}
.ib-map-tel-icon {
	flex-shrink: 0;
	width: 40px;
	height: 40px;
	object-fit: contain;
}
.ib-map-tel-number {
	font-size: 30px;
	font-weight: 700;
	color: var(--ib-primary);
	text-decoration: none;
}
.ib-map-tel-number:hover { color: var(--ib-primary); }

.ib-map-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	padding: 12px 18px;
	background: var(--ib-primary);
	color: #fff !important;
	border-radius: 99px;
	font-size: .875rem;
	font-weight: 600;
	text-align: center;
	text-decoration: none;
	box-sizing: border-box;
	transition: background .2s;
}
.ib-map-btn:hover { background: var(--ib-primary-dark); color: #fff; }

/* =========================================================================
   Champ de recherche + boutons (proximité)
   ========================================================================= */

.ib-map-search {
	display: flex;
	gap: 0;
}
.ib-map-input {
	flex: 1;
	width: auto;
	max-width: 100%;
	height: 48px !important;
	margin: 0;
	padding: 0 14px !important;
	font-size: 1rem;
	line-height: 1.4;
	background: #fff;
	border: 1px solid #D1D5DB;
	border-right: none;
	border-radius: 99px 0 0 99px !important;
	box-shadow: none !important;
	outline: none;
	transition: border .2s;
}
.ib-map-input:focus {
	border-color: var(--ib-primary);
	box-shadow: 0 0 0 2px color-mix(in srgb, var(--ib-primary) 18%, transparent);
}
.ib-map-btn-go {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 56px;
	height: 48px;
	min-width: 0;
	margin-right: 0;
	padding: 0;
	background: var(--ib-primary);
	color: #fff;
	border: 1px solid var(--ib-primary);
	border-radius: 0 99px 99px 0;
	font-size: inherit;
	font-weight: normal;
	line-height: 1;
	letter-spacing: 0;
	text-transform: none;
	vertical-align: middle;
	cursor: pointer;
	transition: filter .2s;
}
.ib-map-btn-go:hover { filter: brightness(.9); }

.ib-map-btn-geoloc {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	min-width: 0;
	min-height: 0;
	margin-right: 0;
	padding: 12px 18px;
	background: var(--ib-primary);
	color: #fff;
	border: none;
	border-radius: 99px;
	font-size: .875rem;
	font-weight: 600;
	line-height: 1.4;
	letter-spacing: 0;
	text-transform: none;
	cursor: pointer;
	transition: filter .2s;
}
.ib-map-btn-geoloc:hover { filter: brightness(.9); }

.ib-map-msg {
	margin: 8px 0 0;
	min-height: 1em;
	font-size: .8125rem;
	color: var(--ib-muted);
}
.ib-map-msg--error { color: #DC2626; }

/* =========================================================================
   Liste de résultats — boîtes unifiées « beige chaud »
   ========================================================================= */

.ib-map-list { margin-top: 20px; }
.ib-map-list-title {
	margin: 0 0 20px;
	font-size: 30px;
	font-weight: 400;
	letter-spacing: 0;
	color: var(--ib-ink);
}
.ib-map-list-ul {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 14px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ib-map-item {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	height: 100%;
	margin-left: 0 !important;
	padding: 14px 16px;
	background: var(--ib-card-bg);
	border: 1px solid var(--ib-border);
	border-radius: var(--ib-radius);
	box-sizing: border-box;
	transition: border-color .2s, box-shadow .2s;
}
.ib-map-item:hover {
	border-color: var(--ib-primary);
	box-shadow: 0 2px 8px color-mix(in srgb, var(--ib-primary) 12%, transparent);
}
.ib-map-item--first {
	border-color: var(--ib-primary);
	background: color-mix(in srgb, var(--ib-primary) 8%, var(--ib-card-bg));
}

.ib-map-item-rank {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	background: var(--ib-primary);
	border-radius: 50%;
	font-size: .8125rem;
	font-weight: 700;
	color: #fff;
}
.ib-map-item-body { flex: 1; min-width: 0; }
.ib-map-item-title {
	margin: 0 0 2px;
	font-size: .9375rem;
	font-weight: 700;
	color: var(--ib-ink);
}
.ib-map-item-distance {
	display: block;
	margin-bottom: 4px;
	font-size: .8125rem;
	font-weight: 600;
	color: var(--ib-primary);
}
.ib-map-item-address {
	margin: 0 0 6px;
	font-size: .8125rem;
	color: var(--ib-muted);
}
.ib-map-item-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
}
.ib-map-item-link {
	margin: 10px 0;
	padding: 10px 20px;
	background: var(--ib-primary);
	border-radius: 99px;
	font-size: .8125rem;
	color: #fff;
	text-decoration: none;
	white-space: nowrap;
	transition: opacity .2s;
}
.ib-map-item-link:hover { opacity: .85; color: #fff; }

/* =========================================================================
   Popups Leaflet
   ========================================================================= */

.ib-map-popup { font-family: inherit; min-width: 180px; }
.ib-map-popup-title {
	display: block;
	margin-bottom: 4px;
	font-size: .9375rem;
	font-weight: 700;
	color: var(--ib-ink);
}
.ib-map-popup-address {
	margin: 0 0 8px;
	font-size: .8125rem;
	line-height: 1.4;
	color: var(--ib-muted);
}
.ib-map-popup-links {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 8px;
}
a.ib-map-popup-link {
	display: inline-block;
	margin: 0;
	padding: 5px 10px;
	background: var(--ib-primary);
	border-radius: 5px;
	font-size: .8125rem;
	font-weight: 600;
	color: #fff !important;
	text-decoration: none;
	transition: opacity .2s;
}
a.ib-map-popup-link:hover { opacity: .85; }

/* =========================================================================
   Overlay tactile mobile (« Utilisez deux doigts »)
   ========================================================================= */

.ib-map-touch-overlay {
	position: absolute;
	inset: 0;
	z-index: 1001;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, .4);
	opacity: 0;
	pointer-events: none;
	transition: opacity .3s;
	border-radius: inherit;
}
.ib-map-touch-overlay--visible { opacity: 1; }
.ib-map-touch-overlay span {
	max-width: 80%;
	padding: 12px 20px;
	background: rgba(0, 0, 0, .55);
	border-radius: 8px;
	font-size: .9375rem;
	font-weight: 600;
	color: #fff;
	text-align: center;
}

/* =========================================================================
   États vides / erreurs
   ========================================================================= */

.ib-map-empty,
.ib-map-error { margin: 0; }
.ib-map-error { color: #DC2626; }

/* =========================================================================
   Responsive — overlay empilé au-dessus de la carte
   ========================================================================= */

@media (max-width: 768px) {
	.ib-map-canvas { height: var(--ib-map-height-mobile); }

	.ib-map-wrapper {
		display: flex;
		flex-direction: column;
	}
	.ib-map-overlay {
		position: static;
		order: -1;
		width: 100%;
		max-width: 100%;
		padding: 20px 18px 16px;
		background: var(--ib-card-bg);
		border-radius: var(--ib-radius) var(--ib-radius) 0 0;
		border-bottom: 1px solid var(--ib-border);
		backdrop-filter: none;
		box-shadow: none;
	}
	.ib-map-overlay-sub { margin: 8px 0 12px; font-size: .8rem; }
	/* Coins arrondis seulement quand un overlay coiffe la carte (proximité / fiche). */
	.ib-map-overlay + .ib-map-canvas { border-radius: 0 0 var(--ib-radius) var(--ib-radius) !important; }

	.ib-map-list-ul {
		grid-template-columns: 1fr;
		gap: 10px;
	}
}

/* =========================================================================
   Variante Iroise Repas — overlay de proximité en bleu plein
   Cible uniquement [ib_carte_repas_proximite] (classe .ibr-prox-overlay).
   Spécificité renforcée (.ib-map-overlay.ibr-prox-overlay) pour passer devant
   la règle mobile de .ib-map-overlay quel que soit l'ordre.
   ========================================================================= */

.ib-map-overlay.ibr-prox-overlay {
	background: var(--ib-primary); /* #2e59a4, posé en ligne sur .ib-map */
	backdrop-filter: none;
}

/* Tout le texte de l'overlay en blanc */
.ibr-prox-overlay .ib-map-overlay-title,
.ibr-prox-overlay .ib-map-overlay-sub,
.ibr-prox-overlay .ib-map-brand-main,
.ibr-prox-overlay .ib-map-brand-sub,
.ibr-prox-overlay .ib-map-msg {
	color: #fff;
}

/* Bouton « Activer votre position » : fond blanc, texte + icône bleus */
.ibr-prox-overlay .ib-map-btn-geoloc {
	background: #fff;
	color: var(--ib-primary);
}
.ibr-prox-overlay .ib-map-btn-geoloc:hover { filter: none; background: #eef3fb; }

/* Bouton recherche (loupe) : fond blanc, icône bleue */
.ibr-prox-overlay .ib-map-btn-go {
	background: #fff;
	border-color: #D1D5DB;
	color: var(--ib-primary);
}
.ibr-prox-overlay .ib-map-btn-go:hover { filter: none; background: #eef3fb; }

/* =========================================================================
   Variante Iroise Repas — overlay de fiche en bleu plein
   Cible uniquement [ib_carte_repas_single] (classe .ibr-single-overlay).
   ========================================================================= */

.ib-map-overlay.ibr-single-overlay {
	background: var(--ib-primary); /* #2e59a4, posé en ligne sur .ib-map */
	backdrop-filter: none;
}

/* Tout le texte de l'overlay en blanc (titre/ville, adresse, téléphone) */
.ibr-single-overlay .ib-map-overlay-heading,
.ibr-single-overlay .ib-map-overlay-address,
.ibr-single-overlay .ib-map-tel-number {
	color: #fff;
}
.ibr-single-overlay .ib-map-tel-number:hover { color: #fff; }

/* Bouton « Google Maps » : fond blanc, texte bleu */
.ibr-single-overlay .ib-map-btn {
	background: #fff;
	color: var(--ib-primary) !important;
}
.ibr-single-overlay .ib-map-btn:hover { background: #eef3fb; color: var(--ib-primary) !important; }
