/* NVP Bộ lọc sản phẩm */

.nbl {
	--nbl-ink: #14233d;
	--nbl-brass: #b47c22;
	--nbl-line: #d8dfe8;
	--nbl-mist: #eef2f6;
	--nbl-text: #3c4a5d;
	position: relative;
	margin: 0 0 24px;
	color: var(--nbl-text);
	font-size: 15px;
	line-height: 1.4;
	clear: both;
}
body.nbl-on .nbl { font-family: inherit; }
.nbl *, .nbl *::before, .nbl *::after { box-sizing: border-box; }
.nbl p, .nbl ul { margin: 0; padding: 0; list-style: none; }

/* Ẩn ô sắp xếp và dòng đếm có sẵn của WooCommerce, vì bộ lọc đã có. */
body.nbl-on .woocommerce-ordering,
body.nbl-on .woocommerce-result-count { display: none !important; }

/* ---------- Thanh lọc (máy tính) ---------- */
.nbl .nbl-bar {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px 12px;
	padding: 12px 0;
	border-top: 1px solid var(--nbl-line);
	border-bottom: 1px solid var(--nbl-line);
}
.nbl .nbl-panel { display: contents; }
.nbl .nbl-panel-head,
.nbl .nbl-panel-foot { display: none; }
.nbl .nbl-groups { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex: 1 1 auto; }

.nbl .nbl-group { position: relative; }
.nbl .nbl-group > summary,
.nbl .nbl-toggle,
.nbl .nbl-open {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 40px;
	padding: 8px 14px;
	border: 1px solid var(--nbl-line);
	border-radius: 999px;
	background: #fff;
	color: var(--nbl-ink);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	list-style: none;
	user-select: none;
	white-space: nowrap;
}
.nbl .nbl-group > summary::-webkit-details-marker { display: none; }
.nbl .nbl-group > summary::after {
	content: "";
	width: 7px;
	height: 7px;
	margin-left: 2px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: translateY(-2px) rotate(45deg);
	transition: transform .15s ease;
}
.nbl .nbl-group[open] > summary::after { transform: translateY(2px) rotate(-135deg); }
.nbl .nbl-group > summary:hover,
.nbl .nbl-toggle:hover { border-color: var(--nbl-ink); }
.nbl .nbl-group[data-has] > summary { background: var(--nbl-ink); border-color: var(--nbl-ink); color: #fff; }
.nbl .nbl-bar .nbl-open { display: none; }

.nbl .nbl-sel,
.nbl .nbl-badge {
	display: inline-grid;
	place-items: center;
	min-width: 20px;
	height: 20px;
	padding: 0 6px;
	border-radius: 999px;
	background: var(--nbl-brass);
	color: #fff;
	font-size: 12px;
	font-weight: 700;
}

.nbl .nbl-drop {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	z-index: 60;
	min-width: 260px;
	background: #fff;
	border: 1px solid var(--nbl-line);
	border-radius: 10px;
	box-shadow: 0 16px 40px -12px rgba(20, 35, 61, .3);
	padding: 8px;
}
.nbl .nbl-opts { max-height: 320px; overflow-y: auto; }
.nbl .nbl-opts label {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 10px;
	border-radius: 6px;
	cursor: pointer;
	color: var(--nbl-ink);
	font-weight: 400;
	margin: 0;
}
.nbl .nbl-opts label:hover { background: var(--nbl-mist); }
.nbl .nbl-opts label span { flex: 1; }
.nbl .nbl-opts em { font-style: normal; font-size: 13px; color: var(--nbl-text); }
.nbl input[type=checkbox],
.nbl input[type=radio] { width: 18px; height: 18px; margin: 0; accent-color: var(--nbl-ink); flex: none; }
.nbl .nbl-drop-foot { padding: 8px 2px 2px; border-top: 1px solid var(--nbl-line); margin-top: 6px; }

.nbl .nbl-apply,
.nbl .nbl-submit {
	width: 100%;
	min-height: 42px;
	border: 0;
	border-radius: 6px;
	background: var(--nbl-ink);
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}
.nbl .nbl-apply:hover,
.nbl .nbl-submit:hover { background: #0c1628; }

.nbl .nbl-toggles { display: flex; flex-wrap: wrap; gap: 8px; }
.nbl .nbl-toggle input { width: 16px; height: 16px; }
.nbl .nbl-toggle:has(input:checked) { background: var(--nbl-ink); border-color: var(--nbl-ink); color: #fff; }
.nbl .nbl-toggle:has(input:checked) input { accent-color: var(--nbl-brass); }

.nbl .nbl-count { margin-left: auto; font-size: 14px; white-space: nowrap; }
.nbl .nbl-sort { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.nbl .nbl-sort-label { font-size: 14px; white-space: nowrap; }
.nbl .nbl-sort select {
	min-height: 40px;
	padding: 6px 34px 6px 12px;
	border: 1px solid var(--nbl-line);
	border-radius: 6px;
	background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2314233d' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 12px center;
	-webkit-appearance: none;
	appearance: none;
	color: var(--nbl-ink);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	width: auto;
	margin: 0;
}

.nbl a:focus-visible,
.nbl button:focus-visible,
.nbl summary:focus-visible,
.nbl select:focus-visible,
.nbl input:focus-visible { outline: 3px solid var(--nbl-brass); outline-offset: 2px; }

/* ---------- Lựa chọn đang bật ---------- */
.nbl .nbl-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.nbl a.nbl-chip {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 6px 10px 6px 12px;
	border-radius: 999px;
	background: var(--nbl-mist);
	color: var(--nbl-ink);
	font-size: 14px;
	font-weight: 500;
	text-decoration: none;
}
.nbl a.nbl-chip::after {
	content: "";
	width: 14px;
	height: 14px;
	background:
		linear-gradient(45deg, transparent 43%, currentColor 43%, currentColor 57%, transparent 57%),
		linear-gradient(-45deg, transparent 43%, currentColor 43%, currentColor 57%, transparent 57%);
	opacity: .7;
}
.nbl a.nbl-chip:hover { background: var(--nbl-ink); color: #fff; }
.nbl a.nbl-clear { font-size: 14px; font-weight: 600; color: var(--nbl-ink); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Đang tải ---------- */
.nbl-loading ul.products,
.nbl-loading .woocommerce-pagination { opacity: .4; pointer-events: none; transition: opacity .15s ease; }

/* ---------- Không có kết quả ---------- */
.nbl-empty {
	padding: 40px 24px;
	text-align: center;
	border: 1px dashed #d8dfe8;
	border-radius: 10px;
	margin-bottom: 40px;
}
.nbl-empty p { margin: 0 0 8px; }
.nbl-empty .nbl-empty-title { font-size: 18px; font-weight: 700; color: #14233d; }
.nbl-empty a { color: #14233d; font-weight: 600; }

/* ---------- Đặt ở trang khác bằng shortcode ---------- */
.nbl.nbl-standalone { max-width: 1200px; margin: 24px auto; padding: 0 24px; }
.nbl.nbl-standalone .nbl-bar { border: 1px solid var(--nbl-line); border-radius: 10px; padding: 12px; background: #fff; }
@media (max-width: 760px) { .nbl.nbl-standalone { padding: 0 16px; } }

/* ---------- Điện thoại: nút "Bộ lọc" mở bảng trượt từ dưới lên ---------- */
@media (max-width: 860px) {
	.nbl .nbl-bar { gap: 8px; padding: 10px 0; }
	.nbl .nbl-count { order: 2; margin-left: 0; flex: 1; text-align: left; }
	.nbl .nbl-sort { order: 3; }
	.nbl .nbl-sort-label { display: none; }
	.nbl .nbl-sort select { max-width: 170px; }

	/* Khi chưa chạy được JavaScript: hiện bộ lọc ngay trên trang. */
	.nbl:not(.nbl-js) .nbl-panel { display: block; width: 100%; order: 4; }
	.nbl:not(.nbl-js) .nbl-panel-foot { display: flex; }

	.nbl.nbl-js .nbl-bar .nbl-open { display: inline-flex; order: 1; }
	.nbl-open-icon {
		width: 16px;
		height: 12px;
		background:
			linear-gradient(currentColor, currentColor) 0 0 / 100% 2px no-repeat,
			linear-gradient(currentColor, currentColor) center / 70% 2px no-repeat,
			linear-gradient(currentColor, currentColor) center bottom / 40% 2px no-repeat;
	}

	.nbl.nbl-js .nbl-panel {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 100001;
		display: flex;
		flex-direction: column;
		max-height: 88vh;
		background: #fff;
		border-radius: 16px 16px 0 0;
		box-shadow: 0 -10px 40px rgba(12, 22, 40, .25);
		transform: translateY(100%);
		visibility: hidden;
		transition: transform .25s ease, visibility 0s linear .25s;
	}
	.nbl.nbl-js.is-open .nbl-panel {
		transform: none;
		visibility: visible;
		transition: transform .25s ease;
	}
	.nbl.nbl-js.is-open::before {
		content: "";
		position: fixed;
		inset: 0;
		z-index: 100000;
		background: rgba(12, 22, 40, .5);
	}

	.nbl .nbl-panel-head {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 16px 18px;
		border-bottom: 1px solid var(--nbl-line);
	}
	.nbl .nbl-panel-title { font-size: 17px; font-weight: 700; color: var(--nbl-ink); }
	.nbl .nbl-close {
		position: relative;
		width: 40px;
		height: 40px;
		border: 0;
		border-radius: 50%;
		background: var(--nbl-mist);
		cursor: pointer;
		padding: 0;
	}
	.nbl .nbl-close::before,
	.nbl .nbl-close::after {
		content: "";
		position: absolute;
		left: 12px;
		top: 19px;
		width: 16px;
		height: 2px;
		background: var(--nbl-ink);
		transform: rotate(45deg);
	}
	.nbl .nbl-close::after { transform: rotate(-45deg); }

	.nbl .nbl-groups {
		display: block;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		padding: 4px 18px 12px;
		flex: 1 1 auto;
	}
	.nbl .nbl-group { border-bottom: 1px solid var(--nbl-line); }
	.nbl .nbl-group > summary,
	.nbl .nbl-group[data-has] > summary {
		display: flex;
		width: 100%;
		justify-content: flex-start;
		min-height: 54px;
		padding: 12px 0;
		border: 0;
		border-radius: 0;
		background: transparent;
		color: var(--nbl-ink);
		font-size: 16px;
	}
	.nbl .nbl-group > summary::after { margin-left: auto; }
	.nbl .nbl-drop {
		position: static;
		min-width: 0;
		border: 0;
		box-shadow: none;
		padding: 0 0 12px;
	}
	.nbl .nbl-opts { max-height: none; }
	.nbl .nbl-opts label { padding: 11px 4px; font-size: 16px; }
	.nbl .nbl-drop-foot { display: none; }
	.nbl .nbl-toggles { padding: 16px 0 4px; }

	.nbl .nbl-panel-foot {
		display: flex;
		align-items: center;
		gap: 12px;
		padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
		border-top: 1px solid var(--nbl-line);
	}
	.nbl a.nbl-reset {
		flex: none;
		padding: 0 6px;
		color: var(--nbl-ink);
		font-weight: 600;
		text-decoration: underline;
		text-underline-offset: 3px;
	}
	.nbl .nbl-submit { flex: 1; min-height: 48px; }

	html.nbl-lock, html.nbl-lock body { overflow: hidden; }
}

@media (prefers-reduced-motion: reduce) {
	.nbl *, .nbl *::before, .nbl *::after, .nbl-loading ul.products { transition: none !important; }
}
