/**
 * Styles front-office de la carte interactive.
 *
 * @package CarteFranceInteractive
 */

/* Conteneur principal : responsive, centré, conserve les proportions. */
.cfi-map-wrapper {
	position: relative;
	width: 100%;
	max-width: 900px;
	margin: 0 auto;
	box-sizing: border-box;
}

.cfi-map-inner {
	width: 100%;
}

/* Le SVG occupe toute la largeur disponible et garde son ratio. */
.cfi-map-wrapper svg {
	display: block;
	width: 100%;
	height: auto;
	overflow: visible;
}

/* Contours toujours visibles. */
.cfi-map-wrapper svg path {
	stroke: #7a7a7a;
	stroke-width: 0.6px;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-opacity: 0.6;
	/* Couleur par défaut : gris clair pour les départements sans zone. */
	fill: #e0e0e0;
	transition: fill 0.2s ease, opacity 0.2s ease, filter 0.2s ease;
}

/* Départements sans zone : non cliquables, curseur par défaut. */
.cfi-map-wrapper svg path:not(.cfi-active) {
	cursor: default;
	pointer-events: none;
}

/*
 * Départements appartenant à une zone : colorés via la variable --cfi-color
 * (définie en inline par le JS), cliquables, curseur pointeur.
 */
.cfi-map-wrapper svg path.cfi-active {
	fill: var(--cfi-color, #3366cc);
	cursor: pointer;
	pointer-events: auto;
}

/* Effet de survol doux : léger éclaircissement + transition fluide. */
.cfi-map-wrapper svg path.cfi-active:hover,
.cfi-map-wrapper svg path.cfi-active:focus {
	filter: brightness(1.12);
	opacity: 0.92;
	outline: none;
}

/* Accessibilité clavier : contour visible au focus. */
.cfi-map-wrapper svg path.cfi-active:focus-visible {
	stroke: #1a1a1a;
	stroke-width: 1.4px;
	stroke-opacity: 1;
}

/* Numéro de département affiché au centre de chaque département. */
.cfi-map-wrapper svg text.cfi-dept-label {
	fill: #1d2327;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-weight: 600;
	/* Halo blanc pour rester lisible sur n'importe quelle couleur de zone. */
	stroke: #ffffff;
	stroke-width: 0.5px;
	stroke-linejoin: round;
	paint-order: stroke fill;
	pointer-events: none;
	user-select: none;
}

/* Infobulle (préparée pour l'évolutivité : nom de zone / département). */
.cfi-tooltip {
	position: absolute;
	z-index: 5;
	pointer-events: none;
	background: rgba(30, 30, 30, 0.92);
	color: #fff;
	padding: 6px 10px;
	border-radius: 4px;
	font-size: 13px;
	line-height: 1.3;
	white-space: nowrap;
	opacity: 0;
	transform: translate(-50%, -120%);
	transition: opacity 0.15s ease;
}

.cfi-tooltip.is-visible {
	opacity: 1;
}

/* --- Légende des zones (front) --- */
.cfi-legend {
	list-style: none;
	margin: 18px 0 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 8px 18px;
	justify-content: center;
}

.cfi-legend-item {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	line-height: 1.3;
}

.cfi-legend-swatch {
	display: inline-block;
	width: 16px;
	height: 16px;
	border-radius: 3px;
	border: 1px solid rgba(0, 0, 0, 0.15);
	flex: 0 0 auto;
}

.cfi-legend-label {
	color: #1d2327;
	text-decoration: none;
}

a.cfi-legend-label:hover,
a.cfi-legend-label:focus {
	text-decoration: underline;
}

.cfi-error {
	color: #b32d2e;
	font-style: italic;
}

/* Petits écrans : le SVG reste pleinement responsive. */
@media (max-width: 600px) {
	.cfi-map-wrapper {
		max-width: 100%;
	}
}
