/**
 * MDPD Sidebar Filtros — CSS mínimo con variables para customización.
 */

:root {
	--sf-chip-bg: #0002;
	--sf-chip-border: #0003;
	--sf-chip-radius: 999px;
	--sf-gap: 0.4em;
	--sf-text: inherit;
	--sf-muted: #666;
	--sf-accent: #111;
	--sf-active-bg: #111;
	--sf-active-text: #fff;
	--sf-label-size: 0.7rem;
	--sf-control-line: 1.1rem;
	--sf-group-border: 1px dashed #0002;
}

/* Panel lateral */
.sf-panel {
	display: flex;
	flex-direction: column;
	gap: var(--sf-gap);
}

.sf-item {
	margin-bottom: 1.5em;
}

.sf-item__title,
.sf-chips-panel__heading,
.sf-chips-group__title {
	font-weight: 600;
	white-space: nowrap;
	font-size: var(--sf-label-size);
	text-transform: uppercase;
}

.sf-item__title {
	margin-bottom: 0.5rem;
	font-size: 1.1em;
}

.sf-toggle {
	display: flex;
	width: 100%;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	background: none;
	border: 0;
	padding: 0;
	margin: 0 !important;
	min-height: 0 !important;
	cursor: pointer;
	font: inherit;
	color: inherit;
	text-align: left;
	font-weight: 600;
	font-size: 1.1em;
	text-transform: uppercase;
}

.sf-item.sf-collapsible:not(.sf-open) .sf-item__body {
	display: none;
}

.sf-caret::after {
	content: "▾";
	display: inline-block;
	flex-shrink: 0;
	transition: transform 0.15s ease;
}

.sf-item.sf-collapsible:not(.sf-open) .sf-caret::after {
	transform: rotate(-90deg);
}

/* Checkboxes */
.sf-checklist {
	list-style: none;
	margin: 0;
	padding: 0;
}

.sf-checklist--level-1,
.sf-checklist--level-2,
.sf-checklist--level-3 {
	margin-left: 1rem;
}

.sf-check {
	display: flex;
	align-items: center;
	gap: 0.35rem;
	cursor: pointer;
	line-height: var(--sf-control-line);
	min-height: 0;
	margin: 0;
}

.sf-check input[type="checkbox"] {
	margin: 0 !important;
	line-height: inherit;
	min-height: 0;
}

.sf-count {
	color: var(--sf-muted);
	font-size: 0.85em;
	line-height: var(--sf-control-line);
}

/* Pill chips (sidebar) */
.sf-pillchips {
	display: flex;
	flex-wrap: wrap;
	gap: var(--sf-gap);
}

.sf-pill {
	background: var(--sf-chip-bg);
	border: 1px solid var(--sf-chip-border);
	border-radius: var(--sf-chip-radius);
	width: fit-content;
	max-width: none;
	white-space: nowrap;
	display: inline-flex;
	align-items: center;
	padding: 0.35em 0.55em;
	cursor: pointer;
	font: inherit;
	color: var(--sf-text);
	line-height: 0.7rem;
	font-size: 0.7rem;
	min-height: 0;
	margin: 0;
}

.sf-pill.sf-active {
	background: var(--sf-active-bg);
	border-color: var(--sf-active-bg);
	color: var(--sf-active-text);
}

/* Menú */
.sf-menu {
	list-style: none;
	margin: 0;
	padding: 0;
}

.sf-menu--level-1,
.sf-menu--level-2 {
	margin-left: 0.75rem;
}

.sf-menu__link {
	display: inline-flex;
	align-items: center;
	padding: 0.2em 0;
	text-decoration: none;
	color: inherit;
	line-height: var(--sf-control-line);
	min-height: 0;
}

.sf-menu__item.sf-active > .sf-menu__link {
	font-weight: 600;
	text-decoration: underline;
}

.sf-select {
	width: 100%;
	max-width: 100%;
	min-height: 0;
	margin: 0 !important;
	line-height: var(--sf-control-line);
}

/* Slider de precio */
.sf-price-slider {
	position: relative;
	height: 2rem;
	margin: 0.5rem 0 0.75rem;
}

.sf-price-track {
	position: absolute;
	top: 50%;
	left: 0;
	right: 0;
	height: 4px;
	background: #ddd;
	border-radius: 2px;
	transform: translateY(-50%);
}

.sf-price-range {
	position: absolute;
	height: 100%;
	background: var(--sf-accent);
	border-radius: 2px;
}

.sf-price-input {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	background: none;
	pointer-events: none;
	-webkit-appearance: none;
	appearance: none;
}

.sf-price-input--min {
	z-index: 3;
}

.sf-price-input--max {
	z-index: 4;
}

.sf-price-input::-webkit-slider-thumb {
	pointer-events: all;
	-webkit-appearance: none;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: var(--sf-accent);
	cursor: pointer;
	border: 2px solid #fff;
	box-shadow: 0 0 0 1px #ccc;
}

.sf-price-input::-moz-range-thumb {
	pointer-events: all;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: var(--sf-accent);
	cursor: pointer;
	border: 2px solid #fff;
	box-shadow: 0 0 0 1px #ccc;
}

.sf-price-values {
	display: flex;
	align-items: center;
	gap: 0.35rem;
	font-size: 0.75em;
	line-height: var(--sf-control-line);
}

.sf-price-sep {
	color: var(--sf-muted);
}

/* Panel de chips activos (dentro del sidebar) */
.sf-panel > .sf-chips-panel {
	flex-direction: column;
	align-items: stretch;
	gap: 0.5rem;
	margin-bottom: 1.25rem;
	padding-bottom: 1rem;
	border-bottom: 1px solid var(--sf-chip-border);
}

.sf-chips-panel {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 0.75rem 1rem;
}

.sf-chips-panel__heading {
	width: 100%;
	margin: 0;
}

.sf-chips-panel__content {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: var(--sf-gap);
	width: 100%;
}

.sf-chips-panel.sf-hidden {
	display: none;
}

/* Destacar filtros activos cuando la búsqueda no devolvió productos (estilizar en el tema). */
.sf-chips-panel.no-results {
	/* hook para el tema */
}

.sf-chips-group {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--sf-gap);
	padding: var(--sf-gap);
	border: var(--sf-group-border);
	border-radius: var(--sf-gap);
}

.sf-chips-group__title {
	margin-right: 0.25rem;
}

.sf-chips-group__items {
	display: flex;
	flex-wrap: wrap;
	gap: var(--sf-gap);
	align-items: center;
}

.sf-chip {
	background: var(--sf-chip-bg);
	border: 1px solid var(--sf-chip-border);
	border-radius: var(--sf-chip-radius);
	width: fit-content;
	max-width: none;
	white-space: nowrap;
	display: inline-flex;
	align-items: center;
	gap: 0.35em;
	padding: 0.25em 0.5em 0.25em 0.65em;
	line-height: 1rem;
	text-transform: uppercase;
	font-size: 0.7em;
	min-height: 0 !important;
}

.sf-chip__label {
	display: inline;
	white-space: nowrap;
}

.sf-chip__remove {
	background: none;
	border: 0;
	padding: 0 !important;
	cursor: pointer;
	font-size: 1.1em;
	line-height: 1;
	color: inherit;
	opacity: 0.7;
	margin: 0 !important;
	min-height: 1rem !important;
	min-width: 1rem !important;
	vertical-align: middle;
}

.sf-chip__remove:hover {
	opacity: 1;
}

.sf-chip--archive {
	border-style: dashed;
}

.sf-chips-clear {
	background: none;
	border: 1px solid var(--sf-muted);
	padding: 0.25em 0.9em;
	cursor: pointer;
	text-decoration: none;
	font: inherit;
	color: var(--sf-muted);
	white-space: nowrap;
	border-radius: var(--sf-chip-radius);
	min-height: 0 !important;
	font-size: 0.75em;
	min-width: 0;
	font-weight: 600;
	margin: 0 !important;
}

.sf-chips-clear:hover {
	opacity: 0.85;
}

/* Categorías: enlaces y árbol */
.sf-cat-links,
.sf-cat-tree {
	list-style: none;
	margin: 0;
	padding: 0;
}

.sf-cat-links--level-1,
.sf-cat-links--level-2 {
	margin-left: 0.75rem;
}

.sf-cat-links__link {
	text-decoration: none;
	color: inherit;
	line-height: var(--sf-control-line);
}

.sf-cat-links__link:hover {
	text-decoration: underline;
}

.sf-cat-links__item.active > .sf-cat-links__link,
.sf-cat-links__link.active {
	font-weight: 600;
	text-decoration: underline;
}

/* Árbol desplegable (estilo menú WooCommerce) */
.sf-cat-tree--root > .sf-cat-tree__item {
	border-bottom: 1px solid rgba(0, 0, 0, 0.08);
	margin-left: 0 !important;
}

.sf-cat-tree--root > .sf-cat-tree__item:last-child {
	border-bottom: 0;
}

.sf-cat-tree__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	padding: 0.55rem 0;
	min-height: 2rem;
}

.sf-cat-tree__link {
	flex: 1;
	text-decoration: none;
	color: inherit;
	line-height: var(--sf-control-line);
	min-height: 0;
	padding: 0.2em 0;
}

.sf-cat-tree__link:hover {
	text-decoration: underline;
}

.sf-cat-tree__item.active > .sf-cat-tree__row > .sf-cat-tree__link,
.sf-cat-tree__link.active {
	font-weight: 600;
	text-decoration: underline;
}

.sf-cat-tree--child {
	margin: 0 0 0.35rem 0.65rem;
	padding: 0 !important;
	border-left: 1px solid rgba(0, 0, 0, 0.12);
}

.sf-cat-tree--child .sf-cat-tree__row {
	padding: 0;
	min-height: auto;
}

li.sf-cat-tree__item {
	margin: 0 0 0.25em 0.5em !important;
}

.sf-cat-tree--child > .sf-cat-tree__item {
	border-bottom: 0;
}

.sf-cat-tree__item.sf-has-children > .sf-cat-tree--child {
	display: none;
}

.sf-cat-tree__item.sf-has-children.sf-tree-open > .sf-cat-tree--child {
	display: block;
}

.sf-tree-toggle,
button.sf-tree-toggle {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.5rem;
	height: 1.5rem;
	background: none;
	border: 0;
	padding: 0 !important;
	margin: 0 !important;
	min-height: 0 !important;
	cursor: pointer;
	color: var(--sf-muted);
}

ul.sf-cat-tree.sf-cat-tree--level-1,
ul.sf-cat-tree.sf-cat-tree--level-2,
ul.sf-cat-tree.sf-cat-tree--level-3,
ul.sf-cat-tree.sf-cat-tree--level-4 {
	margin-left: 0.5em !important;
}

.sf-tree-chevron {
	display: block;
	width: 0.45rem;
	height: 0.45rem;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(45deg);
	transition: transform 0.15s ease;
	margin-top: -0.15rem;
}

.sf-cat-tree__item.sf-tree-open > .sf-cat-tree__row .sf-tree-chevron {
	transform: rotate(-135deg);
	margin-top: 0.1rem;
}

/* Grid del shortcode */
.sf-grid__count {
	margin-bottom: 0.75rem;
}

.sf-widget-header {
	margin-bottom: 0.75rem;
}

.sf-widget-header .widget-title {
	margin: 0;
}
