/* NS Product Filters — layout responsivo, sem dependências externas. */

.ns-pf-filters, .ns-pf-filters *, .ns-pf-filters *::before, .ns-pf-filters *::after {
	box-sizing: border-box;
}

.ns-pf-layout {
	display: flex;
	align-items: flex-start;
	gap: 2rem;
	margin-bottom: 2rem;
}

.ns-pf-main {
	flex: 1 1 0%;
	min-width: 0;
}

/* ---------- painel de filtros ---------- */

.ns-pf-filters {
	flex: 0 0 260px;
	width: 260px;
	max-width: 100%;
	border: 1px solid #e2e2e2;
	border-radius: 8px;
	background: #fff;
	overflow: hidden;
}

.ns-pf-summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	font-weight: 600;
	font-size: 1.05em;
	cursor: pointer;
	list-style: none;
	user-select: none;
}
.ns-pf-summary::-webkit-details-marker { display: none; }
.ns-pf-summary::after {
	content: "\2212"; /* − quando aberto */
	font-weight: 400;
	color: #777;
}
.ns-pf-filters:not([open]) .ns-pf-summary::after {
	content: "+";
}

.ns-pf-filters-inner {
	padding: 0 16px 16px;
	border-top: 1px solid #eee;
}

/* `all: unset` primeiro: muitos temas WordPress aplicam a sua própria regra global a
   `button` (padding, border, box-shadow, box-sizing:content-box) com especificidade maior
   que a nossa, e isso é o que fazia o botão "sair" da caixa. Sem isto o botão herda o que
   o tema decidir; com isto o plugin fica visualmente igual em qualquer tema. */
.ns-pf-filters button.ns-pf-clear-btn {
	all: unset;
	box-sizing: border-box;
	display: block;
	width: 100%;
	margin: 14px 0 6px;
	padding: 8px 10px;
	background: transparent;
	border: 1px solid #ccc;
	border-radius: 5px;
	color: #444;
	font-size: 0.85em;
	line-height: normal;
	text-align: center;
	cursor: pointer;
	transition: background-color .15s ease, border-color .15s ease;
}
.ns-pf-filters button.ns-pf-clear-btn:hover {
	background: #f5f5f5;
	border-color: #999;
}
.ns-pf-filters button.ns-pf-clear-btn:focus-visible {
	outline: 2px solid #2c6ecb;
	outline-offset: 1px;
}

.ns-pf-group {
	padding: 14px 0;
	border-bottom: 1px solid #eee;
}
.ns-pf-group:last-child { border-bottom: none; }

.ns-pf-group h4 {
	margin: 0 0 10px;
	font-size: 0.85em;
	text-transform: uppercase;
	letter-spacing: .03em;
	color: #666;
}

.ns-pf-list {
	list-style: none;
	margin: 0;
	padding: 0;
	max-height: 220px;
	overflow-y: auto;
}
.ns-pf-list li { margin-bottom: 7px; }
.ns-pf-list label {
	display: flex;
	align-items: center;
	gap: 7px;
	font-size: 0.92em;
	cursor: pointer;
	color: #333;
}
.ns-pf-count { color: #999; font-size: 0.9em; }

/* ---------- slider de preço (dois <input type=range> sobrepostos) ---------- */

.ns-pf-price-slider {
	position: relative;
	height: 26px;
	margin: 6px 4px 4px;
}
.ns-pf-price-track {
	position: absolute;
	top: 50%;
	left: 0;
	right: 0;
	height: 4px;
	transform: translateY(-50%);
	background: #ddd;
	border-radius: 2px;
}
.ns-pf-price-fill {
	position: absolute;
	top: 0;
	bottom: 0;
	background: #2c6ecb;
	border-radius: 2px;
}
.ns-pf-price-input {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	margin: 0;
	background: transparent;
	pointer-events: none;
	-webkit-appearance: none;
	appearance: none;
}
.ns-pf-price-input::-webkit-slider-runnable-track { background: transparent; }
.ns-pf-price-input::-moz-range-track { background: transparent; }
.ns-pf-price-input::-webkit-slider-thumb {
	-webkit-appearance: none;
	pointer-events: auto;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: #2c6ecb;
	border: 2px solid #fff;
	box-shadow: 0 0 0 1px rgba(0,0,0,.15);
	cursor: pointer;
	margin-top: 5px;
}
.ns-pf-price-input::-moz-range-thumb {
	pointer-events: auto;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: #2c6ecb;
	border: 2px solid #fff;
	box-shadow: 0 0 0 1px rgba(0,0,0,.15);
	cursor: pointer;
}

.ns-pf-price-values {
	display: flex;
	justify-content: space-between;
	font-size: 0.88em;
	color: #444;
	margin-top: 4px;
}

/* ---------- layout topbar (barra horizontal, um dropdown por grupo) ---------- */

.ns-pf-layout--topbar { display: block; }
.ns-pf-layout--topbar .ns-pf-main { width: 100%; }

.ns-pf-filters.ns-pf-panel--topbar {
	flex: none;
	width: 100%;
	max-width: none;
	overflow: visible; /* os dropdowns têm de poder sair da caixa, ao contrário do sidebar */
	padding: 10px 14px;
	margin-bottom: 1.5rem;
}

.ns-pf-topbar-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
}

.ns-pf-panel--topbar .ns-pf-dynamic-inline { display: contents; }

.ns-pf-panel--topbar .ns-pf-group {
	position: relative;
	padding: 0;
	border-bottom: none;
}

.ns-pf-panel--topbar .ns-pf-group-toggle {
	all: unset;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 8px 12px;
	border: 1px solid #ddd;
	border-radius: 20px;
	font-size: 0.88em;
	color: #333;
	white-space: nowrap;
	cursor: pointer;
	transition: border-color .15s ease, color .15s ease;
}
.ns-pf-panel--topbar .ns-pf-group-toggle:hover { border-color: #999; }
.ns-pf-panel--topbar .ns-pf-group.is-open .ns-pf-group-toggle {
	border-color: #2c6ecb;
	color: #2c6ecb;
}
.ns-pf-panel--topbar .ns-pf-caret::after {
	content: "\25BE";
	font-size: 0.75em;
}
.ns-pf-panel--topbar .ns-pf-group.is-open .ns-pf-caret::after { content: "\25B4"; }

.ns-pf-panel--topbar .ns-pf-group-panel {
	display: none;
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	z-index: 20;
	min-width: 220px;
	max-width: 300px;
	max-height: 320px;
	overflow-y: auto;
	background: #fff;
	border: 1px solid #e2e2e2;
	border-radius: 8px;
	box-shadow: 0 8px 24px rgba(0,0,0,.1);
	padding: 14px;
}
.ns-pf-panel--topbar .ns-pf-group.is-open .ns-pf-group-panel { display: block; }
.ns-pf-panel--topbar .ns-pf-group-panel .ns-pf-list { max-height: none; }

/* chip do "apenas em stock" — checkbox solta, sem dropdown */
.ns-pf-panel--topbar .ns-pf-chip label {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 8px 12px;
	border: 1px solid #ddd;
	border-radius: 20px;
	font-size: 0.88em;
	color: #333;
	cursor: pointer;
	white-space: nowrap;
}

.ns-pf-panel--topbar .ns-pf-clear-btn {
	all: unset;
	box-sizing: border-box;
	margin-left: auto;
	padding: 8px 14px;
	border: 1px solid #ccc;
	border-radius: 20px;
	font-size: 0.85em;
	color: #444;
	cursor: pointer;
	white-space: nowrap;
}
.ns-pf-panel--topbar .ns-pf-clear-btn:hover { background: #f5f5f5; border-color: #999; }

@media (max-width: 600px) {
	.ns-pf-panel--topbar .ns-pf-clear-btn { margin-left: 0; }
}

/* ---------- estado a carregar ---------- */

.ns-pf-is-loading { opacity: .55; pointer-events: none; position: relative; }
.ns-pf-is-loading::after {
	content: "";
	position: absolute;
	top: 12px;
	right: 12px;
	width: 18px;
	height: 18px;
	border: 2px solid #ccc;
	border-top-color: #2c6ecb;
	border-radius: 50%;
	animation: ns-pf-spin .7s linear infinite;
}
@keyframes ns-pf-spin { to { transform: rotate(360deg); } }

/* ---------- responsivo ---------- */

@media (max-width: 782px) {
	.ns-pf-layout {
		flex-direction: column;
		gap: 1rem;
	}
	.ns-pf-filters {
		flex: 1 1 auto;
		max-width: none;
		width: 100%;
	}
	.ns-pf-main { width: 100%; }
}
