/* ============================================
   侧边栏样式 - 简约清新
   ============================================ */

/* ===== 侧边栏基础布局 ===== */
.sidebar {
    position: fixed;
    top: 60px;
    left: 0;
    width: fit-content;
    min-width: 180px;
    white-space: nowrap;
    height: calc(100vh - 60px);
    background: #fff;
    border-right: 1px solid #f0f0f0;
    z-index: 999;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    scrollbar-width: none;
    -ms-overflow-style: none;
    display: flex;
    flex-direction: column;
}

.sidebar::-webkit-scrollbar {
    display: none;
}

/* ===== 移动端侧边栏滑出 ===== */
@media (max-width: 767px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }

    .sidebar.sidebar-open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.06);
    }
}

/* ===== 侧边栏遮罩 ===== */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.1);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sidebar-open .sidebar-overlay,
.sidebar-overlay[style*="display: block"] {
    opacity: 1;
    pointer-events: auto;
}

@media (min-width: 768px) {
    .hamburger {
        display: none;
    }
    .sidebar-overlay {
        display: none !important;
    }
}

/* ===== 侧边栏头部 ===== */
.sidebar-header {
    padding: 28px 24px 20px;
    flex-shrink: 0;
}

.sidebar-header-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 14px;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #222;
    letter-spacing: 0.08em;
}

/* ===== 进度徽章 ===== */
.sidebar-progress-badge {
    font-size: 11px;
    font-weight: 400;
    color: #aaa;
    white-space: nowrap;
}

/* ===== 进度条 ===== */
.sidebar-progress-bar {
    width: 100%;
    height: 2px;
    background: #f5f5f5;
    border-radius: 2px;
    overflow: hidden;
}

.sidebar-progress-fill {
    height: 100%;
    background: #222;
    border-radius: 2px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== 顶部直接链接（无折叠） ===== */
.sidebar-direct-links ul {
    list-style: none;
    margin: 0;
    padding: 4px 0;
}

.sidebar-direct-links li {
    margin: 0;
}

.sidebar-direct-links .nav-item {
    display: block;
    padding: 10px 24px 10px 32px;
    color: #555;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    transition: color 0.2s ease;
}

.sidebar-direct-links .nav-item:hover {
    color: #111;
}

.sidebar-direct-links .nav-item.active {
    color: #111;
    font-weight: 600;
}

/* ===== 分类区块 ===== */
.sidebar-section {
    margin: 0;
}

/* ===== 分类标题按钮 ===== */
.section-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0;
    padding: 10px 24px;
    background: transparent;
    border: none;
    color: #555;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: color 0.2s ease;
    letter-spacing: 0.04em;
}

.section-toggle:hover {
    color: #222;
}

.section-toggle.active {
    color: #222;
}

/* ===== 分类标签文字 ===== */
.section-label {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ===== 分类计数徽章 ===== */
.section-count {
    font-size: 10px;
    font-weight: 400;
    color: #ccc;
    line-height: 1;
    margin-right: 4px;
}

.section-toggle.active .section-count {
    color: #aaa;
}

/* ===== 展开/收起箭头 - 细线 chevron ===== */
.section-toggle .arrow {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.section-toggle .arrow::before {
    content: "";
    display: block;
    width: 6px;
    height: 6px;
    border-right: 1.2px solid #ccc;
    border-bottom: 1.2px solid #ccc;
    transform: rotate(-45deg);
    transition: border-color 0.2s ease;
}

.section-toggle:hover .arrow::before {
    border-color: #999;
}

.section-toggle.active .arrow {
    transform: rotate(90deg);
}

.section-toggle.active .arrow::before {
    border-color: #666;
}

/* ===== 子菜单容器 ===== */
.section-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.section-content.open {
    max-height: 400px;
}

/* ===== 子菜单列表 ===== */
.section-content ul {
    list-style: none;
    margin: 0;
    padding: 4px 0 12px;
}

.section-content li {
    margin: 0;
}

/* ===== 子菜单链接 ===== */
.section-content .nav-item {
    display: block;
    padding: 7px 24px 7px 40px;
    color: #555;
    text-decoration: none;
    font-size: 13px;
    font-weight: 400;
    transition: color 0.2s ease;
}

.section-content .nav-item:hover {
    color: #111;
}

.section-content .nav-item.active {
    color: #111;
    font-weight: 600;
    background: #f7f7f7;
}

/* ===== 侧边栏底部 ===== */
.sidebar-footer {
    margin-top: auto;
    padding: 20px 24px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-motto {
    margin: 0;
    font-size: 11px;
    color: #999;
    font-weight: 400;
    letter-spacing: 0.12em;
}

/* ===== 页面内容偏移适配 ===== */
@media (min-width: 768px) {
    .layout,
    .content {
        margin-left: var(--sidebar-width, 200px);
    }
}

/* ===== 响应式适配 ===== */
@media (max-width: 767px) {
    .sidebar {
        width: 280px;
        white-space: normal;
    }
}

/* ===== 过渡动画优化 ===== */
@media (prefers-reduced-motion: reduce) {
    .sidebar,
    .section-content,
    .section-toggle .arrow,
    .sidebar-progress-fill,
    .sidebar-overlay,
    .section-content .nav-item {
        transition: none !important;
        animation: none !important;
    }
}
