/* =====================================================
   Left Sidebar Navigation - Wiki Cat Theme
   Wiki-style vertical accordion sidebar
   - 左侧菜单 280px 宽度
   - 菜单内容从左侧 20% (56px) 开始
   - 默认全部展开，点击箭头折叠
   - 一级菜单之间用横线隔开
   ===================================================== */

/* --- Left Sidebar Container --- */
#left-sidebar-nav {
	position: fixed;
	top: 0;
	left: 0;
	width: 280px;
	height: 100vh;
	background: #f5f6f8;
	z-index: 9998;
	overflow-y: auto;
	overflow-x: hidden;
	-webkit-overflow-scrolling: touch;
	border-right: 1px solid #e0e2e5;
}

/* --- Scrollbar Styling --- */
#left-sidebar-nav::-webkit-scrollbar {
	width: 4px;
}
#left-sidebar-nav::-webkit-scrollbar-track {
	background: transparent;
}
#left-sidebar-nav::-webkit-scrollbar-thumb {
	background: #c5c8cc;
	border-radius: 2px;
}
#left-sidebar-nav::-webkit-scrollbar-thumb:hover {
	background: #a0a4a8;
}

/* --- Sidebar Header --- */
.left-nav-header {
	padding: 16px 20px 12px 16px;
	border-bottom: 1px solid #e0e2e5;
	text-align: left;
}

.left-nav-title {
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.8px;
	color: #6b7280;
	padding-left: 14px;
}

/* --- Navigation List --- */
.left-nav-menu {
	padding: 8px 0 24px;
}

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

.left-nav-list li {
	margin: 0;
	padding: 0;
}

/* --- 一级菜单分隔线（横线） --- */
.left-nav-list > li {
	border-top: 1px solid #e0e2e5;
}
.left-nav-list > li:first-child {
	border-top: none;
}

/* --- Top-Level Items --- */
.left-nav-list > li > a {
	display: flex;
	align-items: center;
	text-align: left;
	/* padding-left: 56px ≈ 280*20% = 56 */
	padding: 9px 20px 9px 56px;
	color: #374151;
	text-decoration: none;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.4;
	transition: background 0.12s ease, color 0.12s ease;
	position: relative;
	border-left: 3px solid transparent;
}

.left-nav-list > li > a:hover {
	background: #e8eaed;
	color: #111827;
}

.left-nav-list > li.current-menu-item > a {
	background: #e2e4e8;
	color: #a03717;
	border-left-color: #a03717;
	font-weight: 600;
}

/* 祖先/父级一级菜单：箭头变色提示有活跃子项，但不显示背景 */
.left-nav-list > li.current-menu-parent > a,
.left-nav-list > li.current-menu-ancestor > a {
	color: #374151;
	border-left-color: transparent;
	font-weight: 700;
	background: transparent;
}

/* --- Menu Item Icons --- */
.nav-item-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	margin-right: 8px;
	margin-left: 0;
	font-size: 13px;
	color: #9ca3af;
	flex-shrink: 0;
	order: -1;
	transition: color 0.12s ease;
}

.left-nav-list > li > a:hover .nav-item-icon {
	color: #6b7280;
}

.left-nav-list > li.current-menu-item > a .nav-item-icon {
	color: #a03717;
}

/* --- 有子菜单的一级项：右侧折叠箭头 --- */
.left-nav-list > li.has-children > a {
	cursor: pointer;
	padding-right: 30px !important;
}

/* 默认展开（箭头旋转 90° 朝下） */
.left-nav-list > li.has-children > a:after {
	content: '▶';
	position: absolute;
	right: 10px;
	top: 50%;
	transform: translateY(-50%) rotate(90deg);
	font-size: 13px;
	color: #6b7280;
	transition: transform 0.25s ease, color 0.25s;
	font-family: Arial, sans-serif;
	line-height: 1;
	width: 18px;
	text-align: center;
}

/* 折叠后箭头朝右（旋转 0°） */
.left-nav-list > li.has-children.closed > a:after {
	transform: translateY(-50%) rotate(0deg);
}

.left-nav-list > li.has-children.open > a:after {
	transform: translateY(-50%) rotate(90deg);
	color: #a03717;
}

.left-nav-list > li.has-children.current-menu-parent > a:after,
.left-nav-list > li.has-children.current-menu-ancestor > a:after {
	color: #a03717;
}

/* --- 无子菜单的一级项对齐 --- */
.left-nav-list > li:not(.has-children) > a {
	padding-right: 30px !important;
	padding-left: 56px;
}

/* --- Sub Menu 默认全部展开 --- */
.left-nav-list .sub-menu {
	list-style: none;
	margin: 0;
	padding: 0;
	max-height: 800px; /* 默认展开 */
	overflow: hidden;
	transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 折叠状态 */
.left-nav-list > li.has-children.closed > .sub-menu {
	max-height: 0;
}

/* --- Sub Menu Items --- */
.left-nav-list .sub-menu li {
	/* 二级菜单不要分隔线 */
	border-top: none;
}

.left-nav-list .sub-menu li a {
	display: block;
	padding: 6px 20px 6px 68px;
	color: #4b5563;
	text-decoration: none;
	font-size: 12.5px;
	line-height: 1.5;
	transition: background 0.12s ease, color 0.12s ease;
	position: relative;
	text-align: left;
}

.left-nav-list .sub-menu li a:hover {
	background: #e8eaed;
	color: #111827;
}

.left-nav-list .sub-menu li.current-menu-item a,
.left-nav-list .sub-menu li.current-menu-parent a,
.left-nav-list .sub-menu li.current-menu-ancestor a {
	color: #a03717;
	font-weight: 600;
	background: rgba(160, 55, 23, 0.06);
}

/* --- Deep Sub Menus (3rd level) --- */
.left-nav-list .sub-menu .sub-menu li a {
	padding-left: 80px;
	font-size: 12px;
}

/* --- Body Offset for Left Sidebar --- */
body.left-nav-active #site-container {
	margin-left: 280px;
	transition: margin-left 0.3s ease;
}

/* --- Mobile styles --- */
.left-nav-mobile-trigger {
	display: none;
}

.left-nav-overlay {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.4);
	z-index: 9997;
	opacity: 0;
	transition: opacity 0.3s ease;
}

.left-nav-overlay.active {
	opacity: 1;
}

@media (max-width: 768px) {
	#left-sidebar-nav {
		width: 260px;
		left: -260px;
		visibility: hidden;
		opacity: 0;
		transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0.3s, opacity 0.3s ease;
		border-right: none;
		box-shadow: none;
	}

	#left-sidebar-nav.mobile-open {
		left: 0;
		visibility: visible;
		opacity: 1;
		box-shadow: 2px 0 12px rgba(0, 0, 0, 0.1);
		transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0s, opacity 0.3s ease;
	}

	body.left-nav-active #site-container {
		margin-left: 0;
	}

	.left-nav-mobile-trigger {
		display: flex !important;
		position: fixed;
		top: 12px;
		left: 12px;
		z-index: 9999;
		width: 40px;
		height: 40px;
		background: #ffffff;
		border: 1px solid #e0e2e5;
		border-radius: 8px;
		cursor: pointer;
		align-items: center;
		justify-content: center;
		box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
		transition: background 0.15s ease;
	}

	.left-nav-mobile-trigger:hover {
		background: #f0f1f3;
	}

	.left-nav-mobile-trigger .toggle-icon {
		color: #374151;
		font-size: 18px;
	}
}

@media (max-width: 480px) {
	#left-sidebar-nav {
		width: 85vw;
		left: -85vw;
	}
	#left-sidebar-nav.mobile-open {
		left: 0;
	}
}

@media (min-width: 769px) {
	.left-nav-overlay {
		display: none !important;
	}
}
