/* css/sidebar.css */

.main-wrapper {
    min-height: calc(100vh - var(--header-height, 70px) - var(--footer-height, 200px)); /* 减去头部和底部高度 */
}

/* Sidebar Styling */
.sidebar {
    width: 280px; /* 固定侧边栏宽度 */
    flex-shrink: 0; /* 防止侧边栏被压缩 */
    top: var(--header-height, 70px); /* 保持在头部下方 */
    bottom: 0;
    position: sticky; /* 使侧边栏在滚动时固定 */
    overflow-y: auto; /* 允许侧边栏内容滚动 */
    padding-bottom: 20px; /* 底部留白 */
}

.sidebar-header {
    background-color: var(--light-color); /* 与主内容区背景区分 */
}


.sidebar-category {
    list-style: none;
    margin-bottom: 0.5rem;
}

.sidebar-category-toggle {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--dark-color);
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1rem;
    transition: background-color 0.2s ease, color 0.2s ease;
    border-radius: 8px; /* 边角圆润 */
    margin: 0 0.75rem; /* 左右留白 */
}

.sidebar-category-toggle:hover {
    background-color: var(--light-color);
    color: var(--primary-color);
}

.sidebar-category-toggle.collapsed .sidebar-arrow {
    transform: rotate(0deg);
}

.sidebar-category-toggle .sidebar-arrow {
    margin-left: auto; /* Push arrow to the right */
    transition: transform 0.2s ease;
}

.sidebar-category-toggle:not(.collapsed) .sidebar-arrow {
    transform: rotate(180deg); /* Rotate up when expanded */
}


.sidebar-icon {
    font-size: 1.5rem; /* Icon size */
    margin-right: 0.75rem;
    color: var(--secondary-color); /* Icon default color */
}
.sidebar-category-toggle:hover .sidebar-icon,
.sidebar-category-toggle.active .sidebar-icon {
    color: var(--primary-color); /* Icon color on hover/active */
}


.sidebar-submenu {
    padding-left: 2rem; /* Indent submenu items */
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.sidebar-submenu li {
    list-style: none;
}

.sidebar-link {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text-color);
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
    border-radius: 6px;
}

.sidebar-link:hover {
    background-color: #f0f4f8; /* Lighter hover background */
    color: var(--primary-color);
}

.sidebar-link.active {
    background-color: var(--primary-color);
    color: white;
    font-weight: bold;
}

/* Adjust main content area to accommodate sidebar */
.function-section {
    padding-left: 1.5rem; /* Adjust padding for visual alignment with sidebar */
    padding-right: 1.5rem;
}

/* Responsive adjustments for sidebar */
@media (max-width: 991.98px) { /* Bootstrap's 'lg' breakpoint */
    .sidebar {
        display: none !important; /* Hide sidebar on smaller screens */
    }
    .main-wrapper {
        flex-direction: column; /* Stack main content vertically */
    }
}

/* 左导航栏 自动滚动 */
.sidebar-nav {
  max-height: 100vh;
  overflow-y: auto;

  /* Firefox */
  scrollbar-width: thin;
  scrollbar-color: #999 transparent;
}

/* Chrome / Edge / Safari */
.sidebar-nav::-webkit-scrollbar {
  width: 8px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent; /* 或 rgba(0, 0, 0, 0.05); */
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background-color: rgba(150, 150, 150, 0.5);
  border-radius: 8px;
  background-clip: content-box;
  border: 2px solid transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background-color: rgba(100, 100, 100, 0.7);
}
