/* ========================================
   STM32 辅助开发集成平台 - 侧边栏导航
   ======================================== */

#sidebar {
  padding: 8px 0;
  scrollbar-width: thin;
  scrollbar-color: #ccc transparent;
}

#sidebar::-webkit-scrollbar { width: 5px; }
#sidebar::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

/* --- 树形导航 --- */
.sidebar-tree {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-tree ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* 顶层节点 */
.sidebar-tree > li > .sidebar-tree__link {
  font-weight: 600;
  font-size: 15px;
}

/* 所有链接 */
.sidebar-tree__link {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  color: var(--text-primary);
  text-decoration: none !important;
  font-size: 14px;
  line-height: 1.4;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s;
}

.sidebar-tree__link:hover {
  background: #E8E8E8;
  color: var(--primary-dark);
}

/* 当前激活页 */
.sidebar-tree__link--active {
  background: var(--primary-light);
  color: var(--primary) !important;
  border-left-color: var(--primary);
  font-weight: 600;
}

/* 带子节点的父节点 — 显示展开/折叠指示器 */
.sidebar-tree__link--parent::after {
  content: '';
  margin-left: auto;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--text-muted);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.sidebar-tree__link--parent.expanded::after {
  transform: rotate(180deg);
}

/* 子列表 — 默认折叠 */
.sidebar-tree__children {
  display: none;
}

.sidebar-tree__children.open {
  display: block;
}

/* --- 子节点缩进 */
.sidebar-tree__children .sidebar-tree__link {
  padding-left: 36px;
  font-size: 13.5px;
}

/* 二级子节点 (大课/小课的叶子) - 更深缩进 */
.sidebar-tree__children .has-children2 .sidebar-tree__children .sidebar-tree__link {
  padding-left: 52px;
  font-size: 13px;
}

/* 子节点 active 样式 */
.sidebar-tree__children .sidebar-tree__link--active {
  padding-left: 36px;
}

/* 二级子节点 active */
.sidebar-tree__children .has-children2 .sidebar-tree__children .sidebar-tree__link--active {
  padding-left: 52px;
}
