/* ==========================================================================
   Kohler Filters — Base Stylesheet
   All values are overridable from the Elementor Style tab via CSS custom
   properties or direct selectors.
   ========================================================================== */

/* ── CSS custom properties (defaults) ─────────────────────────────────────── */
:root {
	--kf-font-base:        inherit;
	--kf-color-text:       #111;
	--kf-color-muted:      #6b7280;
	--kf-color-border:     #e5e7eb;
	--kf-color-accent:     #111;
	--kf-color-bg:         transparent;
	--kf-border-radius:    4px;
	--kf-transition:       0.2s ease;
	--kf-checkbox-border:  #d1d5db;
}

/* ── Panel wrapper ─────────────────────────────────────────────────────────── */
.kohler-filters-panel {
	display:        flex;
	flex-direction: column;
	gap:            24px;
	background:     var(--kf-color-bg);
	font-family:    var(--kf-font-base);
}

/* ── Filter groups ─────────────────────────────────────────────────────────── */
.kohler-filter-group {
	border-bottom:  1px solid var(--kf-color-border);
	padding-bottom: 20px;
}
.kohler-filter-group:last-child {
	border-bottom: none;
	padding-bottom: 0;
}

/* ── Filter titles ─────────────────────────────────────────────────────────── */
.kohler-filter-title {
	font-size:      12px;
	font-weight:    600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color:          var(--kf-color-text);
	margin-bottom:  12px;
	cursor:         pointer;
	display:        flex;
	justify-content:space-between;
	align-items:    center;
	user-select:    none;
	transition:     color var(--kf-transition);
}
.kohler-filter-title:hover {
	opacity: 0.75;
}
.kohler-filter-title::after {
	content:      '−';
	font-size:    18px;
	font-weight:  300;
	line-height:  1;
	flex-shrink:  0;
}
.kohler-filter-title.collapsed::after {
	content: '+';
}

/* ── Options list ──────────────────────────────────────────────────────────── */
.kohler-filter-options {
	display:        flex;
	flex-direction: column;
	gap:            8px;
}
.kohler-filter-options.collapsed {
	display: none;
}

/* ── Single option (label wrapper) ────────────────────────────────────────── */
.kohler-filter-option {
	display:     flex;
	align-items: center;
	gap:         8px;
	cursor:      pointer;
	transition:  opacity var(--kf-transition);
}
.kohler-filter-option:hover {
	opacity: 0.8;
}

/* ── Checkbox ──────────────────────────────────────────────────────────────── */
.kohler-filter-checkbox {
	width:         16px;
	height:        16px;
	min-width:     16px;
	cursor:        pointer;
	accent-color:  var(--kf-color-accent);
	border:        1px solid var(--kf-checkbox-border);
	border-radius: 2px;
	flex-shrink:   0;
}

/* ── Option label + count ──────────────────────────────────────────────────── */
.kohler-option-label {
	font-size:   14px;
	color:       var(--kf-color-text);
	line-height: 1.4;
}
.kohler-option-count {
	font-size: 12px;
	color:     var(--kf-color-muted);
	margin-left: 2px;
}

/* ── Color swatch ──────────────────────────────────────────────────────────── */
.kohler-color-swatch {
	width:           18px;
	height:          18px;
	min-width:       18px;
	border:          1px solid rgba(0, 0, 0, 0.14);
	border-radius:   4px;
	background-color:#f0f0f0;
	background-size: cover;
	background-position: center;
	flex-shrink:     0;
}

/* ── Price range slider ────────────────────────────────────────────────────── */
.kohler-filter-options--price {
	gap: 12px;
}

.kohler-price-slider-wrap {
	position:   relative;
	height:     24px;
	margin:     4px 0;
	user-select: none;
}

.kohler-price-track {
	position:      absolute;
	top:           50%;
	left:          0;
	right:         0;
	transform:     translateY(-50%);
	height:        4px;
	background:    var(--kf-color-border);
	border-radius: 2px;
	pointer-events: none;
}

.kohler-price-fill {
	position:      absolute;
	height:        100%;
	background:    var(--kf-color-accent);
	border-radius: 2px;
	top:           0;
}

/* Both range inputs stacked */
.kohler-range {
	position:          absolute;
	width:             100%;
	top:               50%;
	transform:         translateY(-50%);
	-webkit-appearance: none;
	appearance:        none;
	background:        transparent;
	pointer-events:    none;
	margin:            0;
	padding:           0;
	height:            24px;
}

/* Thumb — WebKit */
.kohler-range::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance:         none;
	width:              18px;
	height:             18px;
	border-radius:      50%;
	background:         #fff;
	border:             2px solid var(--kf-color-accent);
	cursor:             pointer;
	pointer-events:     auto;
	position:           relative;
	z-index:            3;
	box-shadow:         0 1px 3px rgba(0,0,0,.15);
	transition:         box-shadow var(--kf-transition);
}
.kohler-range::-webkit-slider-thumb:hover,
.kohler-range::-webkit-slider-thumb:active {
	box-shadow: 0 0 0 6px rgba(0,0,0,.08);
}

/* Thumb — Firefox */
.kohler-range::-moz-range-thumb {
	width:        18px;
	height:       18px;
	border-radius:50%;
	background:   #fff;
	border:       2px solid var(--kf-color-accent);
	cursor:       pointer;
	pointer-events: auto;
	box-shadow:   0 1px 3px rgba(0,0,0,.15);
}

/* Track — WebKit (transparent, visual handled by .kohler-price-track) */
.kohler-range::-webkit-slider-runnable-track {
	background:    transparent;
	height:        4px;
}
.kohler-range::-moz-range-track {
	background:    transparent;
	height:        4px;
}

/* Price display */
.kohler-price-display {
	display:     flex;
	align-items: center;
	gap:         6px;
	font-size:   13px;
	color:       var(--kf-color-muted);
}
.kohler-price-sep {
	color: var(--kf-color-border);
}

/* ── Toggle (Available Now) ────────────────────────────────────────────────── */
.kohler-filter-toggle-wrap {
	display:     flex;
	align-items: center;
	gap:         10px;
	cursor:      pointer;
}

/* Hide native checkbox */
.kohler-filter-toggle {
	position: absolute;
	opacity:  0;
	width:    0;
	height:   0;
}

.kohler-toggle-slider {
	position:       relative;
	width:          40px;
	min-width:      40px;
	height:         22px;
	background:     var(--kf-color-border);
	border-radius:  11px;
	transition:     background var(--kf-transition);
	flex-shrink:    0;
}
.kohler-toggle-slider::before {
	content:        '';
	position:       absolute;
	top:            3px;
	left:           3px;
	width:          16px;
	height:         16px;
	border-radius:  50%;
	background:     #fff;
	box-shadow:     0 1px 3px rgba(0,0,0,.2);
	transition:     transform var(--kf-transition);
}
.kohler-filter-toggle:checked + .kohler-toggle-slider {
	background: var(--kf-color-accent);
}
.kohler-filter-toggle:checked + .kohler-toggle-slider::before {
	transform: translateX(18px);
}

.kohler-toggle-label {
	font-size: 14px;
	color:     var(--kf-color-text);
}

/* ── Results bar ───────────────────────────────────────────────────────────── */
.kohler-results-bar {
	display:         flex;
	align-items:     center;
	justify-content: space-between;
	min-height:      20px;
}

.kohler-results-count {
	font-size:   13px;
	color:       var(--kf-color-muted);
}

.kohler-clear-filters {
	font-size:       12px;
	color:           var(--kf-color-muted);
	text-decoration: underline;
	cursor:          pointer;
	background:      none;
	border:          none;
	padding:         0;
	line-height:     1;
	transition:      color var(--kf-transition);
}
.kohler-clear-filters:hover {
	color: var(--kf-color-text);
}

/* ── Pagination (injected after Loop Grid widget) ──────────────────────────── */
.kohler-filters-pagination,
.kohler-pagination {
	display:         flex;
	gap:             8px;
	margin-top:      32px;
	justify-content: center;
	flex-wrap:       wrap;
}

.kohler-filters-pagination .kohler-page-btn,
.kohler-pagination .kohler-page-btn,
.kohler-page-btn {
	display:          inline-flex;
	align-items:      center;
	justify-content:  center;
	min-width:        36px;
	padding:          6px 12px;
	border:           1px solid var(--kf-color-border);
	border-radius:    var(--kf-border-radius);
	text-decoration:  none;
	color:            var(--kf-color-text);
	font-size:        14px;
	font-weight:      400;
	background:       #fff;
	cursor:           pointer;
	transition:       background var(--kf-transition), color var(--kf-transition), border-color var(--kf-transition);
	line-height:      1;
}
.kohler-page-btn.active,
.kohler-page-btn:hover {
	background:    var(--kf-color-accent);
	color:         #fff;
	border-color:  var(--kf-color-accent);
}
.kohler-page-btn.prev-next {
	font-size: 18px;
	padding:   4px 10px;
}

/* ── Loading overlay ───────────────────────────────────────────────────────── */
.kohler-loading-overlay {
	position:   absolute;
	inset:      0;
	background: rgba(255,255,255,0.75);
	display:    flex;
	align-items:center;
	justify-content: center;
	z-index:    10;
	border-radius: inherit;
	backdrop-filter: blur(1px);
}

.kohler-spinner {
	width:        32px;
	height:       32px;
	border:       3px solid var(--kf-color-border);
	border-top-color: var(--kf-color-accent);
	border-radius:50%;
	animation:    kohler-spin 0.6s linear infinite;
}

@keyframes kohler-spin {
	to { transform: rotate(360deg); }
}

/* No results */
.kohler-no-results {
	grid-column: 1 / -1;
	text-align:  center;
	padding:     40px 20px;
	color:       var(--kf-color-muted);
	font-size:   15px;
}

/* ── Responsive ──────────────────────────────────────────────────────────────
 *
 * El corte está en 1024px, el mismo que usa Elementor para "tablet", y no en
 * los 768 de antes. En un iPad de 834px el panel se quedaba en la columna
 * estrecha que le deja la plantilla -188px, pegado a la derecha- y la rejilla
 * de productos empezaba DEBAJO, con media pantalla en blanco. De 1024 para
 * abajo el panel pasa a ser un cajón y la rejilla ocupa todo el ancho.
 */
@media (max-width: 1024px) {
	.kohler-filters-panel {
		gap: 16px;
	}
	.kohler-filter-group {
		padding-bottom: 16px;
	}

	/* La caja de la foto de cada tarjeta se mide contra el ALTO de la
	   pantalla -la plantilla le pone min-height: 48vh- y no contra el ancho de
	   su columna. En un iPad de 834px eso daba tarjetas de 230 de ancho por
	   832 de alto, con la foto estirada y el texto empujado fuera de la
	   pantalla. Cuadrada es la proporción con la que Kohler fotografía el
	   producto, y la tarjeta baja de 832 a 528. */
	.e-loop-item .e-con-inner > a.e-con {
		--min-height:  0px;
		min-height:    0 !important;
		aspect-ratio:  1 / 1;
	}
}

/* ==========================================================================
   v1.6 — Chips, ordenamiento, drawer móvil, transiciones y accesibilidad
   ========================================================================== */

/* ── Ocultado componible (facetas + ver-más + búsqueda) ───────────────────── */
.kohler-filter-option.kf-oculta-faceta,
.kohler-filter-option.kf-oculta-busqueda,
.kohler-filter-option.kf-oculta-limite,
.kohler-filter-group.kf-oculto-grupo {
	display: none;
}

/* ── Ordenamiento ──────────────────────────────────────────────────────────── */
.kohler-sort-bar {
	display:     flex;
	align-items: center;
	gap:         8px;
}
.kohler-sort-label {
	font-size:      12px;
	font-weight:    600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color:          var(--kf-color-text);
	white-space:    nowrap;
}
.kohler-sort-select {
	flex:          1;
	min-width:     0;
	font-size:     13px;
	color:         var(--kf-color-text);
	background:    #fff;
	border:        1px solid var(--kf-color-border);
	border-radius: var(--kf-border-radius);
	padding:       6px 8px;
	cursor:        pointer;
	transition:    border-color var(--kf-transition);
}
.kohler-sort-select:hover,
.kohler-sort-select:focus {
	border-color: var(--kf-color-accent);
}

/* ── Chips de filtros activos ──────────────────────────────────────────────── */
.kohler-active-chips {
	display:   none;
	flex-wrap: wrap;
	gap:       8px;
}
.kohler-active-chips.kf-tiene-chips {
	display: flex;
}
.kohler-chip {
	display:       inline-flex;
	align-items:   center;
	gap:           6px;
	max-width:     100%;
	font-size:     12px;
	line-height:   1.3;
	color:         var(--kf-color-text);
	background:    #fff;
	border:        1px solid var(--kf-color-border);
	border-radius: 999px;
	padding:       5px 10px;
	cursor:        pointer;
	transition:    border-color var(--kf-transition), background var(--kf-transition);
}
.kohler-chip:hover {
	border-color: var(--kf-color-accent);
	background:   #f7f7f7;
}
.kohler-chip-text {
	overflow:      hidden;
	text-overflow: ellipsis;
	white-space:   nowrap;
}
.kohler-chip-x {
	font-size:   10px;
	line-height: 1;
	color:       var(--kf-color-muted);
	flex-shrink: 0;
}
.kohler-chip:hover .kohler-chip-x {
	color: var(--kf-color-text);
}
.kohler-chip--static {
	cursor: default;
}
.kohler-chip--static:hover {
	border-color: var(--kf-color-border);
	background:   #fff;
}

/* ── Badge de selecciones en el título del grupo ───────────────────────────── */
.kohler-title-badge {
	display:         inline-flex;
	align-items:     center;
	justify-content: center;
	min-width:       18px;
	height:          18px;
	margin-left:     auto;
	margin-right:    8px;
	padding:         0 5px;
	font-size:       11px;
	font-weight:     600;
	letter-spacing:  0;
	color:           #fff;
	background:      var(--kf-color-accent);
	border-radius:   9px;
}

/* ── Ver más / ver menos ───────────────────────────────────────────────────── */
.kohler-show-more {
	align-self:      flex-start;
	margin-top:      2px;
	padding:         0;
	font-size:       12px;
	color:           var(--kf-color-muted);
	background:      none;
	border:          none;
	text-decoration: underline;
	cursor:          pointer;
	transition:      color var(--kf-transition);
}
.kohler-show-more:hover {
	color: var(--kf-color-text);
}

/* ── Buscador interno de un grupo ──────────────────────────────────────────── */
.kohler-group-search {
	width:         100%;
	font-size:     13px;
	color:         var(--kf-color-text);
	background:    #fff;
	border:        1px solid var(--kf-color-border);
	border-radius: var(--kf-border-radius);
	padding:       6px 10px;
	margin-bottom: 4px;
	transition:    border-color var(--kf-transition);
}
.kohler-group-search:focus {
	outline:      none;
	border-color: var(--kf-color-accent);
}

/* ── Inputs numéricos de precio ────────────────────────────────────────────── */
.kohler-price-inputs {
	display:     flex;
	align-items: center;
	gap:         6px;
}
.kohler-price-input {
	width:         0;
	flex:          1;
	font-size:     13px;
	color:         var(--kf-color-text);
	background:    #fff;
	border:        1px solid var(--kf-color-border);
	border-radius: var(--kf-border-radius);
	padding:       6px 8px;
	-moz-appearance: textfield;
	transition:    border-color var(--kf-transition);
}
.kohler-price-input::-webkit-outer-spin-button,
.kohler-price-input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}
.kohler-price-input:focus {
	outline:      none;
	border-color: var(--kf-color-accent);
}

/* ── Transición del grid al filtrar ────────────────────────────────────────── */
.kf-cargando > *:not(.kohler-loading-overlay) {
	opacity:    0.45;
	transition: opacity 0.15s ease;
}
.kohler-loading-overlay {
	background:      rgba(255, 255, 255, 0.35);
	backdrop-filter: none;
}
@keyframes kf-aparecer {
	from { opacity: 0; transform: translateY(6px); }
	to   { opacity: 1; transform: none; }
}
.kf-entrando {
	animation: kf-aparecer 0.3s ease both;
}
.kf-entrando:nth-child(2)  { animation-delay: 0.04s; }
.kf-entrando:nth-child(3)  { animation-delay: 0.08s; }
.kf-entrando:nth-child(4)  { animation-delay: 0.12s; }
.kf-entrando:nth-child(5)  { animation-delay: 0.16s; }
.kf-entrando:nth-child(6)  { animation-delay: 0.20s; }
.kf-entrando:nth-child(7)  { animation-delay: 0.24s; }
.kf-entrando:nth-child(8)  { animation-delay: 0.28s; }
.kf-entrando:nth-child(n+9){ animation-delay: 0.32s; }

/* ── Estado vacío ──────────────────────────────────────────────────────────── */
.kohler-empty-state {
	display:        flex;
	flex-direction: column;
	align-items:    center;
	gap:            16px;
}
.kohler-empty-title {
	margin:    0;
	font-size: 15px;
	color:     var(--kf-color-text);
}
.kohler-empty-chips {
	display:         flex;
	flex-wrap:       wrap;
	gap:             8px;
	justify-content: center;
}
.kohler-empty-actions {
	display: flex;
	gap:     12px;
}
.kohler-empty-remove-last,
.kohler-empty-clear {
	font-size:     13px;
	padding:       8px 16px;
	border-radius: var(--kf-border-radius);
	cursor:        pointer;
	transition:    background var(--kf-transition), color var(--kf-transition);
}
.kohler-empty-remove-last {
	color:      var(--kf-color-text);
	background: #fff;
	border:     1px solid var(--kf-color-border);
}
.kohler-empty-remove-last:hover {
	border-color: var(--kf-color-accent);
}
.kohler-empty-clear {
	color:      #fff;
	background: var(--kf-color-accent);
	border:     1px solid var(--kf-color-accent);
}
.kohler-empty-clear:hover {
	opacity: 0.85;
}

/* ── Foco visible (teclado) ────────────────────────────────────────────────── */
.kohler-filter-checkbox:focus-visible,
.kohler-filter-title:focus-visible,
.kohler-chip:focus-visible,
.kohler-show-more:focus-visible,
.kohler-sort-select:focus-visible,
.kohler-page-btn:focus-visible,
.kohler-filters-trigger:focus-visible,
.kohler-drawer-close:focus-visible,
.kohler-drawer-apply:focus-visible {
	outline:        2px solid var(--kf-color-accent);
	outline-offset: 2px;
}

/* ── Drawer móvil ──────────────────────────────────────────────────────────── */
.kohler-filters-trigger {
	display: none; /* solo móvil */
}
.kohler-drawer-header,
.kohler-drawer-footer {
	display: none; /* solo móvil */
}
body.kf-sin-scroll {
	overflow: hidden;
}
.kohler-drawer-backdrop {
	position:   fixed;
	inset:      0;
	background: rgba(0, 0, 0, 0.4);
	z-index:    9998;
	opacity:    1;
	transition: opacity var(--kf-transition);
}
.kohler-drawer-backdrop[hidden] {
	display: none;
}

@media (max-width: 1024px) {

	.kohler-filters-trigger {
		display:       inline-flex;
		align-items:   center;
		gap:           8px;
		font-size:     14px;
		font-weight:   500;
		color:         var(--kf-color-text);
		background:    #fff;
		border:        1px solid var(--kf-color-border);
		border-radius: var(--kf-border-radius);
		padding:       10px 16px;
		cursor:        pointer;
		transition:    border-color var(--kf-transition);
	}
	.kohler-filters-trigger:hover {
		border-color: var(--kf-color-accent);
	}
	.kohler-trigger-count {
		display: none;
		align-items:     center;
		justify-content: center;
		min-width:       18px;
		height:          18px;
		padding:         0 5px;
		font-size:       11px;
		font-weight:     600;
		color:           #fff;
		background:      var(--kf-color-accent);
		border-radius:   9px;
	}
	.kohler-trigger-count.kf-visible {
		display: inline-flex;
	}

	/* El panel se convierte en drawer: fijo, deslizando desde la derecha */
	.kohler-filters-panel {
		position:   fixed;
		top:        0;
		right:      0;
		bottom:     0;
		width:      min(86vw, 400px);
		z-index:    9999;
		background: #fff;
		box-shadow: -8px 0 32px rgba(0, 0, 0, 0.12);
		transform:  translateX(100%);
		/* visibility espera a que termine el deslizamiento de salida */
		transition: transform 0.28s ease, visibility 0s linear 0.28s;
		gap:        0;
		visibility: hidden;
	}
	.kohler-filters-panel.kf-drawer-abierto {
		transform:  translateX(0);
		visibility: visible;
		transition: transform 0.28s ease, visibility 0s;
	}

	.kohler-drawer-header {
		display:         flex;
		align-items:     center;
		justify-content: space-between;
		padding:         16px 20px;
		border-bottom:   1px solid var(--kf-color-border);
		flex-shrink:     0;
	}
	.kohler-drawer-title {
		font-size:      14px;
		font-weight:    600;
		text-transform: uppercase;
		letter-spacing: 0.06em;
		color:          var(--kf-color-text);
	}
	.kohler-drawer-close {
		font-size:  16px;
		line-height:1;
		color:      var(--kf-color-muted);
		background: none;
		border:     none;
		padding:    4px 8px;
		cursor:     pointer;
	}
	.kohler-drawer-close:hover {
		color: var(--kf-color-text);
	}

	.kohler-panel-scroll {
		flex:                       1;
		overflow-y:                 auto;
		-webkit-overflow-scrolling: touch;
		padding:                    16px 20px;
		display:                    flex;
		flex-direction:             column;
		gap:                        16px;
	}

	.kohler-drawer-footer {
		display:     block;
		padding:     12px 20px calc(12px + env(safe-area-inset-bottom));
		border-top:  1px solid var(--kf-color-border);
		flex-shrink: 0;
		background:  #fff;
	}
	.kohler-drawer-apply {
		width:         100%;
		font-size:     14px;
		font-weight:   600;
		color:         #fff;
		background:    var(--kf-color-accent);
		border:        none;
		border-radius: var(--kf-border-radius);
		padding:       14px;
		cursor:        pointer;
		transition:    opacity var(--kf-transition);
	}
	.kohler-drawer-apply:hover {
		opacity: 0.85;
	}
}

/* En escritorio, el contenedor interno no altera el layout del panel */
@media (min-width: 1025px) {
	.kohler-panel-scroll {
		display:        flex;
		flex-direction: column;
		gap:            24px;
	}
	.kohler-drawer-backdrop {
		display: none !important;
	}
}

/* ── Movimiento reducido: sin animaciones, resultados inmediatos ──────────── */
@media (prefers-reduced-motion: reduce) {
	.kf-entrando,
	.kohler-filters-panel,
	.kohler-drawer-backdrop,
	.kohler-spinner {
		animation:  none !important;
		transition: none !important;
	}
	.kf-cargando > *:not(.kohler-loading-overlay) {
		transition: none;
	}
}
