/* ==============================================
   Product Categories Sidebar Widget
   ============================================== */

.cpcs-wrap {
	--cpcs-accent: #2b4182;
	--cpcs-text: #1f2937;
	--cpcs-muted: #6b7280;
	--cpcs-line: #e5e7eb;
	width: 100%;
	font-family: inherit;
}

.cpcs-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.cpcs-item {
	border-bottom: 1px solid var(--cpcs-line);
	list-style: none;
}

.cpcs-item:last-child {
	border-bottom: none;
}

.cpcs-row {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 18px 0;
}

.cpcs-link {
	flex: 1;
	min-width: 0;
	display: flex;
	align-items: center;
	color: var(--cpcs-text);
	text-decoration: none;
	font-size: 16px;
	font-weight: 500;
	padding: 0;
	transition: color .25s ease;
}

.cpcs-toggle {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	background: transparent;
	border: none;
	cursor: pointer;
	color: var(--cpcs-text);
	border-radius: 4px;
	transition: color .25s ease, background-color .25s ease;
}

.cpcs-link:hover {
	color: var(--cpcs-accent);
}

.cpcs-toggle:hover {
	color: var(--cpcs-accent);
}

/* 整行悬停时也变色（提升可点击感） */
.cpcs-row:hover .cpcs-link {
	color: var(--cpcs-accent);
}

.cpcs-text {
	flex: 1;
	min-width: 0;
}

.cpcs-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: transform .3s ease, color .25s ease;
	color: inherit;
	line-height: 1;
	flex: none;
}

.cpcs-icon svg {
	width: 14px;
	height: 14px;
	fill: currentColor;
	transition: transform .3s ease;
}

.cpcs-icon i {
	font-size: 14px;
}

/* 展开时图标旋转 */
.cpcs-item.is-open > .cpcs-row .cpcs-icon {
	transform: rotate(90deg);
}

/* 子分类 - 高度过渡动画（max-height 由 JS 设置为实际 scrollHeight） */
.cpcs-children {
	list-style: none;
	margin: 0;
	padding: 0;
	max-height: 0;
	opacity: 0;
	overflow: hidden;
	transition:
		max-height .35s cubic-bezier(0.4, 0, 0.2, 1),
		opacity .25s ease,
		padding .35s ease;
}

.cpcs-item.is-open > .cpcs-children {
	opacity: 1;
	padding: 0 0 12px 0;
	/* max-height 由 JS 动态设置 */
}

.cpcs-children .cpcs-item {
	border-bottom: none;
}

.cpcs-children .cpcs-row {
	padding: 6px 0;
}

.cpcs-children .cpcs-link {
	font-size: 15px;
	font-weight: 500;
	color: #374151;
	padding-left: 20px;
}

.cpcs-children .cpcs-link:hover {
	color: var(--cpcs-accent);
}

.cpcs-view-all .cpcs-link {
	font-style: italic;
	color: var(--cpcs-muted);
	font-size: 13px;
}

/* "全部"项加粗 */
.cpcs-all .cpcs-link {
	font-weight: 700;
	letter-spacing: 0.5px;
	text-transform: uppercase;
}

/* === 手机按钮 + 抽屉 === */
.cpcs-mobile-btn {
	display: none;
	align-items: center;
	gap: 10px;
	background: #2b4182;
	color: #fff;
	border: none;
	padding: 14px 20px;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.5px;
	cursor: pointer;
	border-radius: 4px;
	transition: background .25s ease;
}

.cpcs-mobile-btn:hover {
	filter: brightness(0.92);
}

.cpcs-mobile-btn-icon {
	display: inline-flex;
	align-items: center;
}

/* 桌面端：隐藏抽屉相关元素 */
.cpcs-overlay {
	display: none;
}

.cpcs-close {
	display: none;
}

/* 抽屉模式（手机端，由 JS 添加 .is-mobile） */
.cpcs-wrap.is-mobile .cpcs-list-wrap {
	position: fixed;
	inset: 0;
	z-index: 9998;
	visibility: hidden;
	pointer-events: none;
}

.cpcs-wrap.is-mobile .cpcs-overlay {
	display: block;
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	opacity: 0;
	transition: opacity .3s ease;
	cursor: pointer;
}

.cpcs-wrap.is-mobile .cpcs-drawer {
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	width: 320px;
	max-width: 86vw;
	background: #fff;
	box-shadow: 6px 0 30px rgba(0, 0, 0, 0.15);
	transform: translateX(-100%);
	transition: transform .3s ease;
	overflow-y: auto;
	padding: 56px 20px 30px;
	pointer-events: auto;
}

.cpcs-wrap.is-mobile .cpcs-close {
	display: inline-flex;
	position: absolute;
	top: 12px;
	right: 12px;
	width: 36px;
	height: 36px;
	background: transparent;
	border: none;
	color: #1f2937;
	cursor: pointer;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	transition: background .2s ease;
}

.cpcs-wrap.is-mobile .cpcs-close:hover {
	background: rgba(0,0,0,0.06);
}

.cpcs-wrap.is-mobile.is-drawer-open .cpcs-list-wrap {
	visibility: visible;
	pointer-events: auto;
}

.cpcs-wrap.is-mobile.is-drawer-open .cpcs-overlay {
	opacity: 1;
}

.cpcs-wrap.is-mobile.is-drawer-open .cpcs-drawer {
	transform: translateX(0);
}

/* 锁定 body 滚动 */
body.cpcs-drawer-open {
	overflow: hidden;
}
