/**
 * Sidebar lọc ở trang Shop — widget "Danh mục sản phẩm".
 *
 * Chỉ nạp trên shop / archive sản phẩm (xem eduvalt_shop_sidebar_assets()
 * trong functions.php). Toàn bộ selector đều nằm dưới .shop-sidebar nên không
 * ảnh hưởng widget ở sidebar blog hay nơi khác.
 */

/* ------------------------------------------------------------------
 * Khoảng cách trên của khu vực shop — giảm 1 nửa (mặc định .section-py-120
 * là 120px) sau khi bỏ banner breadcrumb, cho nội dung đỡ xa header.
 * --------------------------------------------------------------- */
.shop-area.section-py-120 {
	padding-top: 60px;
}

/* ------------------------------------------------------------------
 * Khung widget — gọn hơn mặc định của theme (25px 30px)
 * --------------------------------------------------------------- */
.shop-sidebar .shop-widget {
	border-color: #eef1f5;
	border-radius: 12px;
	margin-bottom: 20px;
}

.shop-sidebar .shop-widget .widget-title {
	margin: 0 0 12px;
	color: #1b2a4a;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.35;
}

.shop-sidebar .shop-widget .widget-title::after {
	width: 26px;
	height: 3px;
	margin-top: 8px;
}

/* ------------------------------------------------------------------
 * Danh sách term: Danh mục sản phẩm (product_cat)
 * --------------------------------------------------------------- */
.shop-sidebar .product-categories {
	margin: 0;
	padding: 0;
	list-style: none;
}

.shop-sidebar .product-categories li {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 0;
	line-height: 1.45;
}

.shop-sidebar .product-categories > li + li {
	border-top: 1px solid #f2f5f8;
}

/* Trừ nút × của chip ra, nếu không nó bị flex kéo giãn hết chiều ngang. */
.shop-sidebar .product-categories li > a:not(.eduvalt-filter-remove) {
	display: block;
	flex: 1;
	min-width: 0;
	padding: 8px 0;
	color: #5a6b80;
	font-size: 12.5px;
	font-weight: 500;
	line-height: 1.45;
}

.shop-sidebar .product-categories li > a:not(.eduvalt-filter-remove):hover {
	color: var(--tg-theme-primary, #2f6fdb);
}

/*
 * Số lượng sản phẩm — thẻ tròn nhỏ bên phải.
 * Theme đặt .widget ul li span.float-right thành position:absolute (để dùng với
 * layout cũ có padding-right ở thẻ a). Ở layout flex này phải trả về static,
 * nếu không số đếm sẽ đè lên chip "đang lọc".
 */
.shop-sidebar .product-categories li .float-right,
.shop-sidebar .product-categories li .count {
	position: static;
	top: auto;
	right: auto;
	flex: 0 0 auto;
	min-width: 22px;
	padding: 1px 7px;
	border-radius: 10px;
	background: #f2f5f9;
	color: #90a0b3;
	font-size: 11px;
	font-weight: 600;
	line-height: 1.6;
	text-align: center;
}

/* Term con lùi vào trong */
.shop-sidebar .product-categories .children {
	flex: 1 0 100%;
	margin: 0 0 0 12px;
	padding: 0;
	border-top: 1px solid #f2f5f8;
	list-style: none;
}

.shop-sidebar .product-categories .children li a {
	font-size: 12px;
}

/* ------------------------------------------------------------------
 * Term đang được chọn — chip kèm nút gỡ
 * --------------------------------------------------------------- */
.shop-sidebar .product-categories li.eduvalt-filter-active {
	gap: 6px;
}

.shop-sidebar .eduvalt-filter-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	flex: 1;
	min-width: 0;
	margin: 6px 0;
	padding: 4px 8px;
	border-radius: 6px;
	background: #eaf1fd;
	color: #1b4f9e;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.4;
}

.shop-sidebar .eduvalt-filter-chip .eduvalt-filter-disabled {
	flex: 1;
	min-width: 0;
}

.shop-sidebar .product-categories li a.eduvalt-filter-remove {
	flex: 0 0 auto;
	align-items: center;
	width: 16px;
	height: 16px;
	min-width: 16px;
	padding: 0 !important;
	border-radius: 50%;
	background: rgba(27, 79, 158, .14);
	color: #1b4f9e;
	font-size: 12px;
	line-height: 1;
}

.shop-sidebar .product-categories li a.eduvalt-filter-remove:hover {
	background: #1b4f9e;
	color: #fff !important;
}

/* ------------------------------------------------------------------
 * Sidebar dính khi cuộn danh sách sản phẩm (chỉ desktop)
 *
 * Sidebar cao hơn màn hình nên kèm cuộn nội bộ, nếu không phần cuối
 * sẽ không bao giờ với tới được.
 * --------------------------------------------------------------- */
@media (min-width: 992px) {
	.shop-area .shop-sidebar {
		position: sticky;
		/* 56px thanh menu xanh đang dính + 16px thở */
		top: 72px;
		max-height: calc(100vh - 88px);
		overflow-y: auto;
		overscroll-behavior: contain;
		scrollbar-width: thin;
		scrollbar-color: #d3dae2 transparent;
	}

	body.admin-bar .shop-area .shop-sidebar {
		top: 104px;
		max-height: calc(100vh - 120px);
	}

	.shop-area .shop-sidebar::-webkit-scrollbar {
		width: 6px;
	}

	.shop-area .shop-sidebar::-webkit-scrollbar-track {
		background: transparent;
	}

	.shop-area .shop-sidebar::-webkit-scrollbar-thumb {
		border-radius: 3px;
		background: #d3dae2;
	}

	/* Chừa chỗ cho thanh cuộn để viền widget không bị sát mép */
	.shop-area .shop-sidebar .shop-widget {
		margin-right: 2px;
	}
}
