/**
 * Mapa Colombia CTU-USCTRAB — Estilos
 * --------------------------------------------------------------------------
 * Todas las clases usan el prefijo `ctu-` para evitar conflictos con el tema
 * (Divi) u otros plugins. Los colores se controlan con variables CSS que el
 * plugin inyecta desde PHP (ver mcctu_inline_color_vars), con respaldo aquí.
 * --------------------------------------------------------------------------
 */

/* Paleta institucional (respaldo; PHP las sobreescribe en :root). */
.ctu-mapa-colombia {
	--ctu-azul-oscuro: #002B5C;
	--ctu-azul-medio:  #3E7CB1;
	--ctu-azul-claro:  #A9D4F0;
	--ctu-dorado:      #D6A018;
	--ctu-blanco:      #FFFFFF;
}

/* ------------------------------------------------------------------ */
/* Contenedor tipo tarjeta                                            */
/* ------------------------------------------------------------------ */
.ctu-mapa-colombia {
	box-sizing: border-box;
	max-width: 100%;
	margin: 1rem auto;
	background: transparent; /* Sin tarjeta: se integra con el fondo de la página. */
	border: 0;
	box-shadow: none;
	overflow: visible;
	font-family: inherit;
}

.ctu-mapa-colombia *,
.ctu-mapa-colombia *::before,
.ctu-mapa-colombia *::after {
	box-sizing: border-box;
}

/* ------------------------------------------------------------------ */
/* Encabezado                                                        */
/* ------------------------------------------------------------------ */
.ctu-mapa-encabezado {
	padding: 1.25rem 1.5rem 0.5rem;
	text-align: center;
}

.ctu-mapa-titulo {
	margin: 0 0 0.35rem;
	color: var(--ctu-azul-oscuro);
	font-size: clamp(1.15rem, 2.4vw, 1.6rem);
	font-weight: 800;
	line-height: 1.2;
	letter-spacing: 0.2px;
}

.ctu-mapa-subtitulo {
	margin: 0;
	color: #5a6b7b;
	font-size: clamp(0.85rem, 1.6vw, 1rem);
	font-weight: 500;
}

/* ------------------------------------------------------------------ */
/* Cuerpo: dos columnas (mapa + lista)                               */
/* ------------------------------------------------------------------ */
.ctu-mapa-cuerpo {
	display: flex;
	flex-wrap: wrap;
	align-items: stretch;
	gap: 0.5rem 1rem;
	padding: 0.25rem 1rem 0.5rem;
}

.ctu-mapa-col-mapa {
	flex: 1 1 58%;
	min-width: 280px;
}

.ctu-mapa-col-lista {
	flex: 1 1 32%;
	min-width: 240px;
	display: flex;
	align-items: center;
}

/* Cuando NO hay lista, el mapa ocupa todo el ancho. */
.ctu-mapa-colombia:not(.ctu-tiene-lista) .ctu-mapa-col-mapa {
	flex-basis: 100%;
}

/* ------------------------------------------------------------------ */
/* Lista lateral de presencia                                        */
/* ------------------------------------------------------------------ */
.ctu-lista {
	list-style: none;
	margin: 0;
	padding: 0;
	width: 100%;
	columns: 1;
}

.ctu-lista-item {
	display: flex;
	align-items: center;
	gap: 0.45rem;
	padding: 0.22rem 0.45rem;
	border-radius: 7px;
	color: var(--ctu-azul-oscuro);
	font-size: clamp(0.68rem, 1.1vw, 0.82rem);
	font-weight: 700;
	line-height: 1.2;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.ctu-lista-bullet {
	flex: 0 0 auto;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--ctu-azul-medio);
	box-shadow: 0 0 0 2px rgba(0, 43, 92, 0.12);
	transition: background 0.15s ease, transform 0.15s ease;
}

/* Texto del ítem (puede ser <span> o <a> cuando hay enlace). */
.ctu-lista-texto {
	color: inherit;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
}

/* Icono ↗ que indica que el ítem abre un enlace externo. */
.ctu-lista-icono-link {
	font-size: 0.78em;
	opacity: 0.55;
	transition: opacity 0.15s ease;
}
.ctu-lista-item.ctu-tiene-link .ctu-lista-bullet {
	background: var(--ctu-dorado); /* Diferencia los que tienen enlace. */
}

/* Estado activo (hover en la lista o en el mapa). */
.ctu-lista-item:hover,
.ctu-lista-item.ctu-lista-activo {
	background: var(--ctu-azul-oscuro);
	color: var(--ctu-blanco);
	transform: translateX(2px);
}

.ctu-lista-item:hover .ctu-lista-icono-link {
	opacity: 1;
}

.ctu-lista-item:hover .ctu-lista-bullet,
.ctu-lista-item.ctu-lista-activo .ctu-lista-bullet {
	background: var(--ctu-dorado);
	transform: scale(1.2);
}

/* ------------------------------------------------------------------ */
/* Pines (punticos) sobre el mapa                                    */
/* ------------------------------------------------------------------ */
.ctu-pin-icono {
	background: transparent;
	border: 0;
}

.ctu-pin {
	width: 18px;
	height: 25px;
	filter: drop-shadow(0 2px 2px rgba(0, 43, 92, 0.35));
	transform-origin: 50% 100%;
	transition: transform 0.18s ease;
}

/* Animación al resaltar (desde la lista o al pasar el mouse). */
.ctu-pin-activo {
	transform: scale(1.3) translateY(-2px);
}

/* Pin con enlace: el cursor indica que es clicable. */
.ctu-pin-link {
	cursor: pointer;
}

/* ------------------------------------------------------------------ */
/* Lienzo del mapa                                                   */
/* ------------------------------------------------------------------ */
.ctu-mapa-lienzo {
	position: relative;
	width: 100%;
	min-height: 320px;
	margin: 0.25rem 0 0.5rem;
	background: transparent; /* Sin fondo gris de tiles: es un mapa vectorial. */
}

/* El propio elemento del mapa de Leaflet. */
.ctu-mapa-lienzo.leaflet-container {
	background: transparent;
	outline: none;
	font: inherit;
}

/* Mensaje de carga y de error. */
.ctu-mapa-cargando,
.ctu-mapa-error {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: 1rem;
	color: var(--ctu-azul-oscuro);
	font-weight: 600;
}

.ctu-mapa-error {
	color: #b00020;
}

/* ------------------------------------------------------------------ */
/* Tooltip elegante (azul oscuro + borde dorado)                     */
/* ------------------------------------------------------------------ */
.leaflet-tooltip.ctu-tooltip {
	background: var(--ctu-azul-oscuro);
	color: var(--ctu-blanco);
	border: 1.5px solid var(--ctu-dorado);
	border-radius: 8px;
	padding: 6px 12px;
	font-size: 0.9rem;
	font-weight: 700;
	letter-spacing: 0.3px;
	box-shadow: 0 6px 18px rgba(0, 43, 92, 0.35);
	white-space: nowrap;
	max-width: 230px;
}

/* Título dentro del tooltip. */
.leaflet-tooltip.ctu-tooltip .ctu-tt-titulo {
	display: block;
	font-weight: 800;
}

/* Descripción breve dentro del tooltip. */
.leaflet-tooltip.ctu-tooltip .ctu-tt-desc {
	display: block;
	margin-top: 3px;
	font-size: 0.78rem;
	font-weight: 500;
	color: #cfe3f7;
	white-space: normal; /* Permite varias líneas en descripciones largas. */
	letter-spacing: 0;
}

/* Flecha del tooltip a juego con el fondo azul oscuro. */
.leaflet-tooltip.ctu-tooltip.leaflet-tooltip-top::before {
	border-top-color: var(--ctu-azul-oscuro);
}
.leaflet-tooltip.ctu-tooltip.leaflet-tooltip-bottom::before {
	border-bottom-color: var(--ctu-azul-oscuro);
}
.leaflet-tooltip.ctu-tooltip.leaflet-tooltip-left::before {
	border-left-color: var(--ctu-azul-oscuro);
}
.leaflet-tooltip.ctu-tooltip.leaflet-tooltip-right::before {
	border-right-color: var(--ctu-azul-oscuro);
}

/* Cursor de mano sobre los departamentos. */
.ctu-mapa-lienzo .leaflet-interactive {
	cursor: pointer;
	transition: fill 0.15s ease, stroke 0.15s ease;
}

/* ------------------------------------------------------------------ */
/* Leyenda                                                           */
/* ------------------------------------------------------------------ */
.ctu-mapa-leyenda {
	display: flex;
	flex-wrap: wrap;
	gap: 1.25rem;
	justify-content: center;
	padding: 0.5rem 1.5rem 1.25rem;
}

.ctu-leyenda-item {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	color: var(--ctu-azul-oscuro);
	font-size: 0.85rem;
	font-weight: 600;
}

.ctu-leyenda-color {
	display: inline-block;
	width: 18px;
	height: 18px;
	border-radius: 4px;
	border: 1.5px solid var(--ctu-blanco);
	box-shadow: 0 0 0 1px rgba(0, 43, 92, 0.15);
}

.ctu-leyenda-activo   { background: var(--ctu-azul-medio); }
.ctu-leyenda-inactivo { background: var(--ctu-azul-claro); }

/* ------------------------------------------------------------------ */
/* Responsive                                                        */
/* ------------------------------------------------------------------ */
/* Tablet / móvil: la lista pasa debajo del mapa y se reparte en 2 columnas. */
@media (max-width: 680px) {
	.ctu-mapa-col-lista {
		align-items: flex-start;
		margin-top: 0.5rem;
	}
	.ctu-lista {
		columns: 2;
		column-gap: 0.5rem;
	}
	.ctu-lista-item {
		break-inside: avoid;
	}
}

@media (max-width: 600px) {
	.ctu-mapa-colombia {
		border-radius: 12px;
		margin: 1rem auto;
	}
	.ctu-mapa-encabezado {
		padding: 1rem 1rem 0.25rem;
	}
	.ctu-mapa-leyenda {
		gap: 0.75rem;
		padding: 0.5rem 0 0.25rem;
	}
	/* En móvil el alto en línea puede ser alto; se acota para que no domine. */
	.ctu-mapa-lienzo {
		height: 360px !important;
	}
}

/* Pantallas muy pequeñas: lista a una sola columna. */
@media (max-width: 400px) {
	.ctu-lista {
		columns: 1;
	}
}
