/* Toggle de subcategorías Amazzing Filter (carga fuera del bundle CCC) */

/* Por debajo del carrito lateral (#weuCartOffcanvas z-index 1100 y backdrop 1090).
   El módulo pone 10001 y el botón FILTROS se solapaba encima del drawer. */
.has-compact-filter #amazzing_filter {
	z-index: 1050;
}

.af-compact-overlay {
	z-index: 1040;
}

/* Pestaña FILTROS: color de marca + sombra para que no pase desapercibida */
@keyframes weu-af-filtros-slide-in {
	from {
		opacity: 0;
		transform: rotate(-90deg) translateX(72px);
	}
	to {
		opacity: 1;
		transform: rotate(-90deg) translateX(0);
	}
}

.has-compact-filter #amazzing_filter .compact-toggle.sticky {
	height: 36px;
	line-height: 36px;
	padding: 0 14px 0 16px;
	letter-spacing: 0.12em;
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	color: #fff !important;
	background-color: var(--weu-color-primary) !important;
	border: 0 !important;
	border-radius: 10px 10px 0 0;
	box-shadow: -2px 4px 14px rgba(234, 30, 28, 0.35), 0 1px 0 rgba(255, 255, 255, 0.15) inset;
	transition: background-color 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
	animation: weu-af-filtros-slide-in 0.75s cubic-bezier(0.22, 1, 0.36, 1) 0.45s both;
}

@media (prefers-reduced-motion: reduce) {
	.has-compact-filter #amazzing_filter .compact-toggle.sticky {
		animation: none;
	}
}

/* Al abrir el panel, anula la animación para que el módulo pueda ocultar la pestaña */
.has-compact-filter.show-filter #amazzing_filter .compact-toggle.sticky {
	animation: none;
	opacity: 0;
}

.has-compact-filter #amazzing_filter .compact-toggle.sticky:hover,
.has-compact-filter #amazzing_filter .compact-toggle.sticky:focus-visible {
	background-color: #c91816 !important;
	box-shadow: -3px 6px 18px rgba(234, 30, 28, 0.45), 0 1px 0 rgba(255, 255, 255, 0.2) inset;
	filter: brightness(1.02);
}

.has-compact-filter #amazzing_filter .compact-toggle.sticky .compact-toggle-icon {
	margin-right: 6px;
	opacity: 0.95;
}

.has-compact-filter #amazzing_filter .compact-toggle.sticky .compact-toggle-icon.tbc-heroicon {
	display: inline-block;
	width: 14px;
	height: 14px;
	vertical-align: -2px;
	background-color: #fff;
	transform: rotate(90deg);
	flex-shrink: 0;
}

/* Cerrar filtros: mismo tamaño táctil que el menú móvil / carrito (44px) */
#amazzing_filter .compact-close.weu-offcanvas-close-btn,
#amazzing_filter .compact-close {
	width: 44px;
	height: 44px;
	min-width: 44px;
	min-height: 44px;
	margin: 0 -8px 0 0;
	background-image: none !important;
	background-size: auto;
}

#amazzing_filter .compact-close:after {
	width: 22px;
	height: 22px;
}

/* Subcategorías: el grid NO debe depender de .foldered (JS lo añade después;
   sin él el botón +/− cae a la línea siguiente y parece un guion suelto). */
#amazzing_filter .af_filter ul,
#amazzing_filter .af_filter li {
	list-style: none !important;
}

#amazzing_filter .af-parent-category > .af-filter-row,
#amazzing_filter .af-filter-row {
	display: grid !important;
	grid-template-columns: minmax(0, 1fr) auto !important;
	align-items: center !important;
	width: 100% !important;
	gap: 0;
}

#amazzing_filter .af-parent-category > .af-filter-row > label,
#amazzing_filter .af-filter-row > label {
	display: flex !important;
	grid-column: 1 !important;
	grid-row: 1 !important;
	min-width: 0 !important;
	width: auto !important;
	max-width: 100% !important;
	padding-right: 0 !important;
	margin: 0 !important;
}

#amazzing_filter .af-parent-category > .af-filter-row > .af-toggle-child,
#amazzing_filter .af-filter-row > .af-toggle-child {
	grid-column: 2 !important;
	grid-row: 1 !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: 1.25rem !important;
	height: 1.25rem !important;
	min-width: 1.25rem !important;
	min-height: 1.25rem !important;
	max-width: 1.25rem !important;
	padding: 0 !important;
	margin: 0 var(--weu-spacing-xs) 0 0 !important;
	border: 0 !important;
	background: transparent !important;
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
	box-shadow: none !important;
	line-height: 1 !important;
	flex-shrink: 0 !important;
	position: static !important;
	transform: none !important;
	float: none !important;
	clear: none !important;
}

#amazzing_filter .af-toggle-child-icon {
	display: block;
	width: 1rem;
	height: 1rem;
	background-image: url('../fonts/heroicons/plus.svg');
	background-size: contain;
	background-repeat: no-repeat;
	background-position: center;
}

#amazzing_filter .af-parent-category.open > .af-filter-row > .af-toggle-child .af-toggle-child-icon {
	background-image: url('../fonts/heroicons/minus.svg');
}

#amazzing_filter .af-toggle-child:hover,
#amazzing_filter .af-toggle-child:focus-visible {
	background-color: var(--weu-color-grey);
	outline: none;
}

/* Anular +/− legacy del módulo (content:'+' / '−') siempre */
#amazzing_filter .af-toggle-child:after {
	content: none !important;
	display: none !important;
}

#amazzing_filter .af-parent-category > label .name,
#amazzing_filter .af-parent-category > .af-filter-row > label .name {
	justify-content: flex-start;
	padding-right: 0;
	width: auto;
}

/* Indentación + colapso de subcategorías (no depende de .foldered del BO/JS).
   Sin esto las hijas quedan siempre visibles y el +/- parece que no hace nada. */
#amazzing_filter .af-parent-category > ul.child-categories {
	display: none !important;
	margin: 0 !important;
	padding: 0 0 0 1.25rem !important;
}

#amazzing_filter .af-parent-category.open > ul.child-categories {
	display: block !important;
}

@media (max-width: 767px) {
	#amazzing_filter .af-parent-category > .af-filter-row > .af-toggle-child,
	#amazzing_filter .af-filter-row > .af-toggle-child {
		width: 2.75rem !important;
		height: 2.75rem !important;
		min-width: 2.75rem !important;
		min-height: 2.75rem !important;
		max-width: 2.75rem !important;
		padding: 0 !important;
		margin: 0 !important;
		touch-action: manipulation;
		-webkit-tap-highlight-color: transparent;
	}

	#amazzing_filter .af-toggle-child-icon {
		width: 1rem;
		height: 1rem;
		flex-shrink: 0;
	}
}
