/**
 * Filtro Productos Latinos — estilos del front.
 *
 * Todo lo personalizable pasa por variables CSS declaradas en .fpl, que es
 * lo que escriben los controles de Elementor. Las reglas estructurales llevan
 * !important para sobrevivir a temas que pisan el CSS de los plugins; las
 * decorativas no, para que Elementor pueda mandar sobre ellas.
 */

.fpl {
	--fpl-fondo: rgba(32, 32, 32, 0.55);
	--fpl-desenfoque: 14px;
	--fpl-campo-fondo: rgba(255, 255, 255, 0.06);
	--fpl-campo-texto: #ffffff;
	--fpl-campo-borde: rgba(255, 255, 255, 0.18);
	--fpl-campo-radio: 999px;
	--fpl-boton-fondo: #f5b120;
	--fpl-boton-texto: #1a1a1a;
	--fpl-boton-fondo-hover: #ffc340;
	--fpl-boton-radio: 999px;
	--fpl-hueco: 16px;
	--fpl-opcion-texto: #ffffff;
	--fpl-opcion-fondo-activa: rgba(245, 177, 32, 0.18);
	--fpl-panel-fondo: rgba(42, 42, 42, 0.82);

	box-sizing: border-box !important;
	background: var(--fpl-fondo);
	-webkit-backdrop-filter: blur(var(--fpl-desenfoque)) saturate(140%);
	backdrop-filter: blur(var(--fpl-desenfoque)) saturate(140%);
	padding: 24px;
	display: flex !important;
	flex-direction: column !important;
	gap: 12px;
}

.fpl *,
.fpl *::before,
.fpl *::after {
	box-sizing: border-box !important;
}

/* -------------------------------------------------------------------------
 * Título
 * ---------------------------------------------------------------------- */

.fpl__titulo {
	font-family: 'Onest', system-ui, -apple-system, sans-serif;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.25;
	color: var(--fpl-campo-texto);
	margin: 0;
}

/* -------------------------------------------------------------------------
 * Disposición de los campos
 * ---------------------------------------------------------------------- */

.fpl__campos {
	display: flex !important;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--fpl-hueco);
}

.fpl--layout-columna .fpl__campos {
	flex-direction: column !important;
	align-items: stretch !important;
}

.fpl__campo {
	position: relative !important;
	flex: 1 1 200px;
	min-width: 0;
}

/* -------------------------------------------------------------------------
 * Control desplegable
 * ---------------------------------------------------------------------- */

.fpl__control {
	appearance: none !important;
	-webkit-appearance: none !important;
	display: flex !important;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	width: 100% !important;
	margin: 0;
	padding: 14px 48px 14px 22px;
	font-family: 'Inter', system-ui, -apple-system, sans-serif;
	font-size: 16px;
	line-height: 1.3;
	text-align: left;
	color: var(--fpl-campo-texto);
	background-color: var(--fpl-campo-fondo);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9' fill='none'%3E%3Cpath d='M1 1L7 7L13 1' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 20px center;
	border: 1px solid var(--fpl-campo-borde);
	border-radius: var(--fpl-campo-radio);
	cursor: pointer;
	transition: background-color .15s ease, border-color .15s ease;
}

.fpl__control:hover {
	border-color: var(--fpl-boton-fondo);
}

.fpl__control[aria-expanded="true"] {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9' fill='none'%3E%3Cpath d='M13 8L7 2L1 8' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.fpl__valor {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.fpl__campo--bloqueado .fpl__control,
.fpl__control[disabled] {
	opacity: .55;
	cursor: not-allowed;
}

.fpl__campo--bloqueado .fpl__control:hover {
	border-color: var(--fpl-campo-borde);
}

/* -------------------------------------------------------------------------
 * Panel y lista de opciones
 * ---------------------------------------------------------------------- */

.fpl__panel,
.fpl__campo > .fpl__lista {
	position: absolute !important;
	top: calc(100% + 6px);
	left: 0;
	z-index: 999 !important;
	width: 100% !important;
	background: var(--fpl-panel-fondo);
	-webkit-backdrop-filter: blur(var(--fpl-desenfoque)) saturate(140%);
	backdrop-filter: blur(var(--fpl-desenfoque)) saturate(140%);
	border: 1px solid var(--fpl-campo-borde);
	border-radius: 14px;
	box-shadow: 0 12px 32px rgba(0, 0, 0, .35);
}

.fpl__panel {
	overflow: hidden;
}

.fpl__lista {
	list-style: none !important;
	margin: 0 !important;
	padding: 6px !important;
	max-height: 320px;
	overflow-y: auto !important;
	-webkit-overflow-scrolling: touch;
	/* Al llegar al final de la lista, la rueda no arrastra la página detrás. */
	overscroll-behavior: contain;
}

.fpl__panel .fpl__lista {
	position: static !important;
	border: 0;
	box-shadow: none;
	border-radius: 0;
}

.fpl__opcion {
	margin: 0 !important;
	padding: 0 !important;
	list-style: none !important;
}

.fpl__opcion a {
	display: block !important;
	padding: 11px 16px;
	font-family: 'Inter', system-ui, -apple-system, sans-serif;
	font-size: 15px;
	line-height: 1.35;
	color: var(--fpl-opcion-texto);
	text-decoration: none !important;
	border-radius: 9px;
	cursor: pointer;
}

.fpl__opcion:hover a,
.fpl__opcion[data-activa] a,
.fpl__opcion[aria-selected="true"] a {
	background: var(--fpl-opcion-fondo-activa);
}

/* -------------------------------------------------------------------------
 * Buscador dentro del panel de productos
 * ---------------------------------------------------------------------- */

.fpl__buscador {
	display: block !important;
	width: 100% !important;
	margin: 0;
	padding: 12px 16px;
	font-family: 'Inter', system-ui, -apple-system, sans-serif;
	font-size: 15px;
	color: var(--fpl-campo-texto);
	background: transparent;
	border: 0;
	border-bottom: 1px solid var(--fpl-campo-borde);
	border-radius: 0;
}

.fpl__buscador::placeholder {
	color: var(--fpl-campo-texto);
	opacity: .5;
}

/* -------------------------------------------------------------------------
 * Botón
 * ---------------------------------------------------------------------- */

.fpl__boton {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	padding: 15px 34px;
	font-family: 'Inter', system-ui, -apple-system, sans-serif;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.2;
	color: var(--fpl-boton-texto) !important;
	background: var(--fpl-boton-fondo);
	border-radius: var(--fpl-boton-radio);
	text-decoration: none !important;
	cursor: pointer;
	transition: background-color .15s ease, opacity .15s ease;
}

.fpl__boton:hover {
	background: var(--fpl-boton-fondo-hover);
}

.fpl__boton[aria-disabled="true"] {
	opacity: .5;
	pointer-events: none !important;
	cursor: not-allowed;
}

/* -------------------------------------------------------------------------
 * Estado y foco
 * ---------------------------------------------------------------------- */

.fpl__estado {
	margin: 0;
	min-height: 1em;
	font-family: 'Inter', system-ui, -apple-system, sans-serif;
	font-size: 14px;
	color: var(--fpl-campo-texto);
	opacity: .75;
}

.fpl__estado:empty {
	display: none !important;
}

.fpl__control:focus-visible,
.fpl__buscador:focus-visible,
.fpl__boton:focus-visible,
.fpl__opcion a:focus-visible {
	outline: 2px solid var(--fpl-boton-fondo) !important;
	outline-offset: 2px !important;
}

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

@media (max-width: 768px) {
	.fpl {
		padding: 20px 16px;
	}

	.fpl__campos {
		flex-direction: column !important;
		align-items: stretch !important;
	}

	.fpl__campo {
		flex: 1 1 auto;
	}

	.fpl__boton {
		width: 100% !important;
	}
}

/* -------------------------------------------------------------------------
 * Reserva para navegadores sin backdrop-filter (Firefox antiguo, etc.).
 * Sin desenfoque, los fondos translúcidos se leerían mal sobre una foto,
 * así que se sustituyen por opacos.
 * ---------------------------------------------------------------------- */

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
	.fpl {
		--fpl-fondo: #202020;
		--fpl-panel-fondo: #2a2a2a;
	}
}

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