/**
 * Estilos de los filtros.
 *
 * Deliberadamente sobrios y con selectores propios: el objetivo es que se integren
 * con el tema (Divi incluido) sin imponer una paleta ni pelearse por especificidad.
 *
 * @package Koryfi_Woo_Filter
 */

.kwff-filters {
	--kwff-gap: 0.5rem;
	--kwff-radius: 4px;
	--kwff-border: rgba( 0, 0, 0, 0.15 );
	--kwff-muted: rgba( 0, 0, 0, 0.55 );
	margin-bottom: 1.5rem;
}

.kwff-facet {
	margin-bottom: 1.5rem;
}

.kwff-facet__title {
	font-size: 1rem;
	margin: 0 0 var( --kwff-gap );
	padding-bottom: 0;
}

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

.kwff-option {
	margin: 0 0 2px;
}

.kwff-option__link {
	display: flex;
	align-items: center;
	gap: var( --kwff-gap );
	padding: 4px 6px;
	border-radius: var( --kwff-radius );
	text-decoration: none;
	line-height: 1.3;
}

.kwff-option__link:hover,
.kwff-option__link:focus-visible {
	background: rgba( 0, 0, 0, 0.05 );
}

.kwff-option.is-chosen > .kwff-option__link {
	font-weight: 600;
}

.kwff-option__count {
	margin-left: auto;
	color: var( --kwff-muted );
	font-size: 0.85em;
	font-variant-numeric: tabular-nums;
}

.kwff-option__count::before {
	content: "(";
}

.kwff-option__count::after {
	content: ")";
}

/* --- Swatches ------------------------------------------------------------ */

.kwff-facet--swatches .kwff-facet__options {
	display: flex;
	flex-wrap: wrap;
	gap: var( --kwff-gap );
}

.kwff-facet--swatches .kwff-option {
	margin: 0;
}

.kwff-facet--swatches .kwff-option__link {
	flex-direction: column;
	gap: 2px;
	width: 3.25rem;
	padding: 4px;
	text-align: center;
}

.kwff-facet--swatches .kwff-option__label {
	font-size: 0.7rem;
	line-height: 1.2;
	color: var( --kwff-muted );
	overflow: hidden;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.kwff-facet--swatches .kwff-option__count {
	margin-left: 0;
	font-size: 0.7rem;
}

.kwff-option__swatch {
	display: block;
	width: 2rem;
	height: 2rem;
	border-radius: 50%;
	overflow: hidden;
	border: 1px solid var( --kwff-border );
	box-shadow: 0 0 0 0 transparent;
	transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.kwff-option__link:hover .kwff-option__swatch {
	transform: scale( 1.06 );
}

.kwff-option.is-chosen .kwff-option__swatch {
	box-shadow: 0 0 0 2px #fff, 0 0 0 4px currentColor;
}

/* El swatch lo pinta koryfi-woo-variations; aquí solo se ajusta al hueco. */
.kwff-option__swatch .kwv-swatch-color,
.kwff-option__swatch .kwv-swatch-image,
.kwff-option__swatch .kwv-swatch-image img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.kwff-option__swatch .kwv-swatch-label {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	font-size: 0.65rem;
	background: rgba( 0, 0, 0, 0.04 );
}

/* --- Filtros activos ----------------------------------------------------- */

.kwff-active {
	margin-bottom: 1.25rem;
}

.kwff-active__list {
	list-style: none !important;
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin: 0 0 var( --kwff-gap );
	padding: 0 !important;
}

.kwff-chip a {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 2px 8px;
	border: 1px solid var( --kwff-border );
	border-radius: 999px;
	font-size: 0.8rem;
	text-decoration: none;
	line-height: 1.6;
}

.kwff-chip a:hover {
	background: rgba( 0, 0, 0, 0.05 );
}

.kwff-chip__remove {
	font-size: 1.1em;
	opacity: 0.6;
}

.kwff-clear {
	font-size: 0.85rem;
	text-decoration: underline;
}

/* --- Estado de carga ----------------------------------------------------- */

.kwff-loading {
	position: relative;
	opacity: 0.55;
	transition: opacity 0.15s ease;
	pointer-events: none;
}

#kwff-results {
	position: relative;
	min-height: 4rem;
}

@media ( prefers-reduced-motion: reduce ) {
	.kwff-option__swatch,
	.kwff-loading {
		transition: none;
	}

	.kwff-option__link:hover .kwff-option__swatch {
		transform: none;
	}
}
