/* ==========================================================================
   Dynamic Locations for WordPress — Public Styles
   Variables (definidas en línea por el shortcode):
   --dlfw-primary, --dlfw-card-min, --dlfw-map-height, --dlfw-map-height-mobile
   ========================================================================== */

.dlfw-locations {
	--dlfw-primary: #0073aa;
	--dlfw-primary-soft: rgba(0, 115, 170, .1);
	--dlfw-card-min: 300px;
	--dlfw-map-height: 500px;
	--dlfw-map-height-mobile: 280px;
	--dlfw-text: #1f2933;
	--dlfw-muted: #52606d;
	--dlfw-border: #e1e5ea;
	--dlfw-radius: 12px;

	margin-bottom: 24px;
	color: var(--dlfw-text);
	line-height: 1.5;
}

@supports (background: color-mix(in srgb, red 10%, white)) {
	.dlfw-locations {
		--dlfw-primary-soft: color-mix(in srgb, var(--dlfw-primary) 12%, transparent);
	}
}

.dlfw-locations *,
.dlfw-locations *::before,
.dlfw-locations *::after {
	box-sizing: border-box;
}

.dlfw-locations [hidden] {
	display: none !important;
}

.dlfw-sr-only {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.dlfw-icon {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
}

/* --------------------------------------------------------------------------
   Mapa
   -------------------------------------------------------------------------- */

.dlfw-map-wrap {
	margin-bottom: 20px;
}

.dlfw-map {
	width: 100%;
	height: var(--dlfw-map-height);
	border-radius: var(--dlfw-radius);
	border: 1px solid var(--dlfw-border);
	overflow: hidden;
	z-index: 0; /* evita que los controles de Leaflet tapen menús fijos del tema */
}

/* Popup */
.dlfw-locations .leaflet-popup-content-wrapper {
	border-radius: 10px;
	box-shadow: 0 8px 24px rgba(15, 23, 42, .18);
}

.dlfw-locations .leaflet-popup-content {
	margin: 14px 16px;
	font-size: 13px;
	line-height: 1.45;
}

.dlfw-popup__title {
	display: block;
	margin-bottom: 4px;
	font-size: 14px;
	color: var(--dlfw-text);
}

.dlfw-popup__row {
	color: var(--dlfw-muted);
}

.dlfw-popup__row + .dlfw-popup__row {
	margin-top: 2px;
}

.dlfw-locations .dlfw-popup a {
	color: var(--dlfw-primary);
}

.dlfw-locations .dlfw-popup__link {
	display: inline-block;
	margin-top: 8px;
	font-weight: 600;
	text-decoration: none;
}

/* --------------------------------------------------------------------------
   Ubicaciones cercanas
   -------------------------------------------------------------------------- */

.dlfw-locations .dlfw-nearby {
	margin: 0 0 16px;
	padding: 16px;
	border: 1px solid var(--dlfw-border);
	border-radius: var(--dlfw-radius);
	background: var(--dlfw-primary-soft);
}

.dlfw-locations .dlfw-nearby__label {
	display: block;
	margin: 0 0 8px;
	color: var(--dlfw-text);
	font-weight: 600;
}

.dlfw-nearby__row {
	display: flex;
	gap: 8px;
}

.dlfw-nearby__field {
	position: relative;
	flex: 1 1 auto;
	min-width: 0;
}

.dlfw-nearby__field .dlfw-icon {
	position: absolute;
	top: 50%;
	left: 14px;
	transform: translateY(-50%);
	color: var(--dlfw-primary);
	pointer-events: none;
}

.dlfw-locations .dlfw-nearby .dlfw-nearby__input {
	box-sizing: border-box;
	display: block;
	width: 100%;
	min-width: 0;
	max-width: 100%;
	height: 44px;
	margin: 0;
	padding: 0 14px 0 42px;
	border: 1px solid var(--dlfw-border);
	border-radius: 8px;
	background: #fff;
	color: var(--dlfw-text);
	font-size: 15px;
	line-height: 44px;
	-webkit-appearance: none;
	appearance: none;
}

.dlfw-locations .dlfw-nearby .dlfw-nearby__input::placeholder {
	color: #8a94a0;
	text-overflow: ellipsis;
}

.dlfw-locations .dlfw-nearby .dlfw-nearby__input:focus {
	outline: none;
	border-color: var(--dlfw-primary);
	box-shadow: 0 0 0 3px var(--dlfw-primary-soft);
}

.dlfw-locations .dlfw-nearby .dlfw-btn {
	flex: 0 0 auto;
	min-height: 44px;
	background-color: #fff;
}

.dlfw-locations .dlfw-nearby .dlfw-btn--primary {
	background-color: var(--dlfw-primary);
}

.dlfw-locations .dlfw-nearby__locate {
	width: 44px;
	padding: 0;
}

.dlfw-locations .dlfw-nearby .dlfw-btn:disabled {
	opacity: .6;
	cursor: wait;
}

.dlfw-nearby__status {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	margin-top: 10px;
}

.dlfw-locations .dlfw-nearby__message {
	flex: 1 1 auto;
	margin: 0;
	padding: 0;
	color: var(--dlfw-muted);
	font-size: 14px;
}

.dlfw-nearby__status.is-result .dlfw-nearby__message {
	color: var(--dlfw-text);
}

.dlfw-locations .dlfw-nearby__clear {
	flex: 0 0 auto;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: var(--dlfw-primary);
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	text-decoration: underline;
	cursor: pointer;
}

/* Etiqueta de distancia en la tarjeta */
.dlfw-locations .dlfw-card__distance {
	display: inline-block;
	margin: -2px 0 8px;
	padding: 2px 10px;
	border-radius: 999px;
	background: var(--dlfw-primary-soft);
	color: var(--dlfw-primary);
	font-size: 12px;
	font-weight: 700;
	line-height: 1.6;
}

/* --------------------------------------------------------------------------
   Buscador
   -------------------------------------------------------------------------- */

.dlfw-toolbar {
	display: flex;
	flex-wrap: wrap; /* si no cabe, el contador baja de línea en vez de quedar tapado */
	align-items: center;
	gap: 8px 16px;
	margin-bottom: 16px;
}

.dlfw-search {
	position: relative;
	flex: 1 1 260px;
	min-width: 0;
	max-width: 400px;
}

.dlfw-search .dlfw-icon {
	position: absolute;
	top: 50%;
	left: 14px;
	transform: translateY(-50%);
	color: var(--dlfw-muted);
	pointer-events: none;
}

/* Selector reforzado: muchos temas (normalize.css) fuerzan box-sizing: content-box
   en input[type="search"], lo que haría el campo más ancho que su contenedor */
.dlfw-locations .dlfw-toolbar .dlfw-search__input {
	box-sizing: border-box;
	display: block;
	width: 100%;
	min-width: 0;
	max-width: 100%;
	height: 44px;
	margin: 0;
	padding: 0 14px 0 42px;
	border: 1px solid var(--dlfw-border);
	border-radius: 999px;
	background: #fff;
	color: var(--dlfw-text);
	font-size: 15px;
	line-height: 44px;
	box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
	transition: border-color .2s ease, box-shadow .2s ease;
	-webkit-appearance: none;
	appearance: none;
}

.dlfw-locations .dlfw-search__input::placeholder {
	color: #8a94a0;
	text-overflow: ellipsis;
}

.dlfw-locations .dlfw-search__input:focus {
	outline: none;
	border-color: var(--dlfw-primary);
	box-shadow: 0 0 0 3px var(--dlfw-primary-soft);
}

/* Filtro de países */
.dlfw-locations .dlfw-toolbar .dlfw-country-select {
	box-sizing: border-box;
	flex: 0 1 220px;
	min-width: 0;
	max-width: 100%;
	height: 44px;
	margin: 0;
	padding: 0 38px 0 16px;
	border: 1px solid var(--dlfw-border);
	border-radius: 999px;
	background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2352606d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center / 16px 16px;
	color: var(--dlfw-text);
	font: inherit;
	font-size: 15px;
	line-height: 1.2;
	text-overflow: ellipsis;
	cursor: pointer;
	box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
	-webkit-appearance: none;
	appearance: none;
}

.dlfw-locations .dlfw-toolbar .dlfw-country-select:focus {
	outline: none;
	border-color: var(--dlfw-primary);
	box-shadow: 0 0 0 3px var(--dlfw-primary-soft);
}

.dlfw-locations .dlfw-count {
	flex: 0 0 auto;
	margin: 0;
	padding: 0;
	color: var(--dlfw-muted);
	font-size: 14px;
}

.dlfw-locations .dlfw-no-results {
	margin: 0;
	padding: 24px;
	border: 1px dashed var(--dlfw-border);
	border-radius: var(--dlfw-radius);
	color: var(--dlfw-muted);
	text-align: center;
}

/* --------------------------------------------------------------------------
   Grupos por país
   -------------------------------------------------------------------------- */

.dlfw-group + .dlfw-group {
	margin-top: 32px;
}

.dlfw-locations .dlfw-group__title {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0 0 14px;
	padding: 0 0 10px;
	border-bottom: 1px solid var(--dlfw-border);
	color: var(--dlfw-text);
	font-size: 1.25em;
	font-weight: 600;
	line-height: 1.3;
}

.dlfw-group__count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 26px;
	height: 22px;
	padding: 0 8px;
	border-radius: 999px;
	background: var(--dlfw-primary-soft);
	color: var(--dlfw-primary);
	font-size: 12px;
	font-weight: 700;
	line-height: 1;
}

/* --------------------------------------------------------------------------
   Lista y tarjetas
   -------------------------------------------------------------------------- */

.dlfw-locations .dlfw-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--dlfw-card-min)), 1fr));
	gap: 16px;
	margin: 0 !important;
	padding: 0 !important;
	list-style: none !important;
}

.dlfw-locations .dlfw-card {
	display: flex;
	flex-direction: column;
	gap: 14px;
	margin: 0;
	padding: 18px 20px;
	background: #fff;
	border: 1px solid var(--dlfw-border);
	border-radius: var(--dlfw-radius);
	box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
	list-style: none;
	transition: border-color .2s ease, box-shadow .2s ease;
}

.dlfw-locations .dlfw-card::before {
	content: none; /* algunos temas añaden viñetas con ::before */
}

.dlfw-locations .dlfw-card:hover {
	box-shadow: 0 6px 18px rgba(15, 23, 42, .08);
}

.dlfw-locations .dlfw-card.is-active {
	border-color: var(--dlfw-primary);
	box-shadow: 0 0 0 3px var(--dlfw-primary-soft);
}

.dlfw-card__body {
	flex: 1 1 auto;
	min-width: 0;
}

.dlfw-locations .dlfw-card__title {
	margin: 0 0 8px;
	padding: 0;
	color: var(--dlfw-text);
	font-size: 1.1em;
	font-weight: 600;
	line-height: 1.3;
}

.dlfw-locations .dlfw-card__line {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin: 0 0 6px;
	padding: 0;
	color: var(--dlfw-muted);
	font-size: .925em;
}

.dlfw-locations .dlfw-card__line:last-child {
	margin-bottom: 0;
}

.dlfw-card__line .dlfw-icon {
	width: 16px;
	height: 16px;
	margin-top: .2em;
	color: var(--dlfw-primary);
}

.dlfw-locations .dlfw-card__line a {
	color: inherit;
	text-decoration: none;
	border-bottom: 1px solid var(--dlfw-border);
}

.dlfw-locations .dlfw-card__line a[href^="tel:"] {
	white-space: nowrap;
}

.dlfw-locations .dlfw-card__line a:hover,
.dlfw-locations .dlfw-card__line a:focus {
	color: var(--dlfw-primary);
	border-bottom-color: currentColor;
}

.dlfw-card__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: auto;
}

/* Botones */
.dlfw-locations .dlfw-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 38px;
	margin: 0;
	padding: 8px 14px;
	border: 1px solid transparent;
	border-radius: 8px;
	background: none;
	font: inherit;
	font-size: .875em;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: background-color .2s ease, border-color .2s ease, color .2s ease, filter .2s ease;
}

.dlfw-locations .dlfw-btn .dlfw-icon {
	width: 16px;
	height: 16px;
}

.dlfw-locations .dlfw-btn--primary,
.dlfw-locations .dlfw-btn--primary:visited {
	background: var(--dlfw-primary);
	color: #fff;
}

.dlfw-locations .dlfw-btn--primary:hover,
.dlfw-locations .dlfw-btn--primary:focus {
	color: #fff;
	filter: brightness(.9);
}

.dlfw-locations .dlfw-btn--ghost {
	border-color: var(--dlfw-border);
	color: var(--dlfw-text);
}

.dlfw-locations .dlfw-btn--ghost:hover,
.dlfw-locations .dlfw-btn--ghost:focus {
	border-color: var(--dlfw-primary);
	color: var(--dlfw-primary);
	background: var(--dlfw-primary-soft);
}

.dlfw-locations .dlfw-btn:focus-visible,
.dlfw-locations .dlfw-more:focus-visible {
	outline: 2px solid var(--dlfw-primary);
	outline-offset: 2px;
}

.dlfw-locations .dlfw-more {
	display: block;
	width: 100%;
	margin: 12px 0 0;
	padding: 10px 16px;
	border: 1px solid var(--dlfw-border);
	border-radius: 8px;
	background: #fff;
	color: var(--dlfw-primary);
	font: inherit;
	font-size: .9em;
	font-weight: 600;
	cursor: pointer;
}

/* --------------------------------------------------------------------------
   Diseño lateral: lista a la izquierda, mapa a la derecha
   -------------------------------------------------------------------------- */

@media (min-width: 900px) {
	.dlfw-layout-side {
		display: grid;
		grid-template-columns: minmax(300px, 380px) 1fr;
		gap: 20px;
		align-items: start;
	}

	.dlfw-layout-side .dlfw-map-wrap {
		order: 2;
		margin: 0;
		position: sticky;
		top: 20px;
	}

	/* Alto mínimo para que la lista tenga espacio junto al buscador y los filtros */
	.dlfw-layout-side .dlfw-map {
		height: max(var(--dlfw-map-height), 620px);
	}

	.dlfw-layout-side .dlfw-panel {
		order: 1;
		display: flex;
		flex-direction: column;
		height: max(var(--dlfw-map-height), 620px);
		min-width: 0;
	}

	.dlfw-locations.dlfw-layout-side .dlfw-nearby {
		margin-bottom: 12px;
		padding: 12px;
	}

	.dlfw-locations.dlfw-layout-side .dlfw-nearby .dlfw-nearby__submit {
		width: 44px;
		padding: 0;
	}

	.dlfw-layout-side .dlfw-nearby__submit span {
		position: absolute !important;
		width: 1px;
		height: 1px;
		margin: -1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		white-space: nowrap;
	}

	.dlfw-locations.dlfw-layout-side .dlfw-nearby__message {
		font-size: 13px;
	}

	.dlfw-layout-side .dlfw-toolbar {
		gap: 8px 10px;
		margin-bottom: 12px;
	}

	.dlfw-locations.dlfw-layout-side .dlfw-toolbar .dlfw-search {
		flex: 1 1 100%;
		max-width: none;
	}

	.dlfw-layout-side .dlfw-count {
		font-size: 13px;
	}

	.dlfw-layout-side .dlfw-scroll {
		flex: 1 1 auto;
		min-height: 0;
		overflow-y: auto;
		padding: 2px 6px 2px 2px;
		overscroll-behavior: contain;
	}

	.dlfw-locations.dlfw-layout-side .dlfw-list {
		grid-template-columns: 1fr;
		gap: 10px;
	}

	/* Encabezado de país fijo mientras se recorre su grupo */
	.dlfw-layout-side .dlfw-group__title {
		position: sticky;
		top: -2px;
		z-index: 1;
		margin-bottom: 8px;
		padding: 8px 0;
		background: var(--dlfw-bg, #fff);
	}

	.dlfw-layout-side .dlfw-group + .dlfw-group {
		margin-top: 16px;
	}

	.dlfw-locations.dlfw-layout-side .dlfw-toolbar .dlfw-country-select {
		flex: 1 1 auto;
		max-width: none;
	}

	.dlfw-layout-side .dlfw-card {
		padding: 14px 16px;
		gap: 10px;
	}

	.dlfw-layout-side .dlfw-card__title {
		font-size: 1em;
	}
}

/* --------------------------------------------------------------------------
   Móvil: mapa más bajo y tarjetas compactas en fila con botones de icono
   -------------------------------------------------------------------------- */

@media (max-width: 640px) {
	.dlfw-map {
		height: var(--dlfw-map-height-mobile);
		border-radius: 10px;
	}

	.dlfw-map-wrap {
		margin-bottom: 12px;
	}

	.dlfw-toolbar {
		flex-direction: column;
		align-items: stretch;
		gap: 6px;
		margin-bottom: 10px;
	}

	.dlfw-search {
		flex: 0 0 auto;
		max-width: none;
	}

	.dlfw-locations .dlfw-toolbar .dlfw-country-select {
		flex: 0 0 auto;
		max-width: none;
		height: 42px;
		font-size: 16px;
	}

	.dlfw-locations .dlfw-nearby {
		margin-bottom: 12px;
		padding: 12px;
	}

	.dlfw-locations .dlfw-nearby .dlfw-nearby__input {
		font-size: 16px; /* evita el zoom automático de iOS */
	}

	.dlfw-locations .dlfw-nearby .dlfw-btn,
	.dlfw-locations .dlfw-nearby .dlfw-nearby__submit {
		width: 44px;
		height: 44px;
		padding: 0;
		border-radius: 8px;
	}

	.dlfw-nearby__submit span {
		position: absolute !important;
		width: 1px;
		height: 1px;
		margin: -1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		white-space: nowrap;
	}

	.dlfw-locations .dlfw-card__distance {
		margin-bottom: 4px;
	}

	.dlfw-group + .dlfw-group {
		margin-top: 18px;
	}

	.dlfw-locations .dlfw-group__title {
		margin-bottom: 8px;
		font-size: 1em;
	}

	.dlfw-locations .dlfw-toolbar .dlfw-search__input {
		height: 42px;
		line-height: 42px;
		font-size: 16px; /* evita el zoom automático de iOS */
	}

	.dlfw-locations .dlfw-count {
		font-size: 13px;
	}

	.dlfw-locations .dlfw-list {
		grid-template-columns: 1fr;
		gap: 8px;
	}

	.dlfw-locations .dlfw-card {
		flex-direction: row;
		align-items: center;
		gap: 10px;
		padding: 12px 12px 12px 14px;
		border-radius: 10px;
		box-shadow: none;
	}

	.dlfw-locations .dlfw-card__title {
		margin-bottom: 2px;
		font-size: .975em;
	}

	.dlfw-locations .dlfw-card__line {
		gap: 6px;
		margin-bottom: 2px;
		font-size: .85em;
		line-height: 1.4;
	}

	.dlfw-card__line .dlfw-icon {
		width: 14px;
		height: 14px;
	}

	/* La dirección se recorta a dos líneas */
	.dlfw-card__line > span {
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
		overflow: hidden;
	}

	.dlfw-card__actions {
		flex: 0 0 auto;
		flex-wrap: nowrap;
		gap: 6px;
		margin: 0;
	}

	.dlfw-locations .dlfw-btn {
		width: 40px;
		min-height: 40px;
		height: 40px;
		padding: 0;
		border-radius: 50%;
	}

	.dlfw-locations .dlfw-btn .dlfw-icon {
		width: 18px;
		height: 18px;
	}

	.dlfw-btn__label {
		position: absolute !important;
		width: 1px;
		height: 1px;
		margin: -1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		white-space: nowrap;
	}
}

@media (prefers-reduced-motion: reduce) {
	.dlfw-locations * {
		transition: none !important;
	}
}
