/* ==========================================
   简洁侧边栏样式
   Clean Sidebar Styles
   无嵌套框体设计，扁平化现代风格
   ========================================== */

/* 侧边栏容器 */
aside {
    width: 100%;
    max-width: 320px;
}

/* ==========================================
   用户信息区域
   ========================================== */

aside > div:first-child > div:first-child {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 18px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

aside > div:first-child > div:nth-child(2) {
    flex: 1;
    min-width: 0;
}

aside > div:first-child > div:nth-child(2) > div:first-child {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

aside > div:first-child > div:nth-child(2) > div:last-child {
    font-size: 14px;
}

/* ==========================================
   导航标题
   ========================================== */
aside nav h3 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
    padding-left: 4px;
}

/* ==========================================
   导航列表
   ========================================== */
aside nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

aside nav ul li {
    margin-bottom: 4px;
}

/* 导航链接 */
aside nav ul li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
}

aside nav ul li a:hover {
    background: #f1f5f9;
    color: #1e293b;
}

/* 激活状态 */
aside nav ul li a.bg-blue-500 {
    background: #3b82f6;
    color: white;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}

/* 图标 */
aside nav ul li a i:first-of-type {
    width: 20px;
    text-align: center;
    transition: color 0.2s ease;
}

aside nav ul li a:hover i:first-of-type {
    color: #64748b;
}

aside nav ul li a.bg-blue-500 i:first-of-type {
    color: white;
}

/* 文本 */
aside nav ul li a > span:first-of-type {
    flex: 1;
    font-weight: 500;
}

/* 计数徽章 */
aside nav ul li a > span:last-of-type {
    padding: 2px 8px;
    border-radius: 9999px;
    font-weight: 600;
}

aside nav ul li a.bg-blue-500 > span:last-of-type {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* ==========================================
   区块间距
   ========================================== */
aside nav {
    margin-bottom: 20px;
}

aside nav:last-child {
    margin-bottom: 0;
}

/* ==========================================
   响应式设计
   ========================================== */
@media (max-width: 1023px) {
    aside {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        max-width: 300px;
        z-index: 1000;
        background: white;
        padding: 24px 16px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
    }

    aside.mobile-open {
        transform: translateX(0);
    }

    aside > div:first-child {
        margin-bottom: 32px;
    }
}

/* ==========================================
   滚动条样式
   ========================================== */
@media (max-width: 1023px) {
    aside::-webkit-scrollbar {
        width: 6px;
    }

    aside::-webkit-scrollbar-track {
        background: #f1f5f9;
    }

    aside::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 3px;
    }

    aside::-webkit-scrollbar-thumb:hover {
        background: #94a3b8;
    }
}

/* ==========================================
   遮罩层
   ========================================== */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ==========================================
   无障碍支持
   ========================================== */
aside a:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* 减少动画 */
@media (prefers-reduced-motion: reduce) {
    aside nav ul li a,
    aside,
    .sidebar-overlay {
        transition: none;
    }
}

/* ==========================================
   打印样式
   ========================================== */
@media print {
    aside {
        display: none;
    }
}

/* ==========================================
   课程学习风格侧边栏样式（重新设计）
   Course Learning Style Sidebar Styles (Redesigned)
   无嵌套框体，扁平化现代设计
   ========================================== */

/* 侧边栏容器 */
.course-sidebar {
    width: 100%;
    max-width: 320px;
    position: sticky;
    top: 20px;
}

/* 响应式显示 */
@media (max-width: 1023px) {
    .course-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        max-width: 300px;
        z-index: 1000;
        background: white;
        padding: 24px 16px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
    }
    
    .course-sidebar.mobile-open {
        transform: translateX(0);
    }
}

/* ==========================================
   学习者信息区域
   ========================================== */
.learner-section {
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 5px;
}

.learner-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.avatar-wrapper {
    position: relative;
    flex-shrink: 0;
}

.learner-avatar {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.status-indicator {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 12px;
    height: 12px;
    background: #10b981;
    border: 2px solid white;
    border-radius: 50%;
}

.level-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    color: white;
    padding: 0 6px;
}

.learner-info {
    flex: 1;
    min-width: 0;
}

.learner-name {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 4px;
}

.learner-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.learner-role {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
}

.learner-level {
    font-size: 11px;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 4px;
}

/* ==========================================
   学习进度条
   ========================================== */
.progress-section {
    margin-top: 12px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.progress-label {
    font-size: 12px;
    font-weight: 600;
}

.progress-counter {
    font-size: 12px;
    font-weight: bold;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar-fill {
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
    transition: width 1s ease-out;
}

.progress-text {
    font-size: 11px;
    text-align: center;
}

/* 激活指示器 */
.active-indicator {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background: #3b82f6;
    border-radius: 50%;
}

.categories-section {
    max-height:450px;
    padding: 20px;
    /* 核心：开启滚动，默认隐藏滚动条 */
    overflow: auto;
    
    /* Firefox：默认隐藏滚动条（thin 是细滚动条，none 是完全隐藏） */
    scrollbar-width: none;
}
/* Chrome/Safari/Edge：隐藏默认滚动条 */
.categories-section::-webkit-scrollbar {
    width: 0; /* 隐藏垂直滚动条宽度 */
    height: 0; /* 隐藏水平滚动条高度 */
}

/* 鼠标 hover 时显示滚动条 */
.categories-section:hover {
    /* Firefox：恢复细滚动条 */
    scrollbar-width: thin;
}

/* Chrome/Safari/Edge：hover 时显示滚动条并美化 */
.categories-section:hover::-webkit-scrollbar {
    width: 6px; /* 垂直滚动条宽度 */
    height: 6px; /* 水平滚动条高度 */
}

html {
    max-height:450px;
    /* 核心：开启滚动，默认隐藏滚动条 */
    overflow: auto;
    scrollbar-width: thin;
}
/* Chrome/Safari/Edge：隐藏默认滚动条 */
html::-webkit-scrollbar {
    width: 6px; /* 隐藏垂直滚动条宽度 */
    height: 6px; /* 隐藏水平滚动条高度 */
}

/* ==========================================
   移动端遮罩层
   ========================================== */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ==========================================
   滚动条样式
   ========================================== */
@media (max-width: 1023px) {
    .course-sidebar::-webkit-scrollbar {
        width: 6px;
    }

    .course-sidebar::-webkit-scrollbar-track {
        background: #f1f5f9;
    }

    .course-sidebar::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 3px;
    }

    .course-sidebar::-webkit-scrollbar-thumb:hover {
        background: #94a3b8;
    }
}

/* ==========================================
   动画效果
   ========================================== */
.course-sidebar.fade-in {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================
   响应式优化
   ========================================== */
@media (max-width: 767px) {
    .course-sidebar {
        max-width: 280px;
    }
    
    .course-sidebar {
        padding: 20px 16px;
    }
    
    .learner-avatar {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
    
    .level-badge {
        min-width: 20px;
        height: 20px;
        font-size: 9px;
    }
    
    .learner-name {
        font-size: 16px;
    }
    
    .statistics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .stat-card {
        padding: 10px;
    }
    
    .stat-icon-wrapper {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .stat-value {
        font-size: 16px;
    }
    
    .category-link {
        padding: 8px 10px;
    }
    
    .category-icon {
        width: 24px;
        height: 24px;
    }
    
    .category-name {
        font-size: 12px;
    }
    
    .category-meta {
        font-size: 10px;
    }
}

/* ==========================================
   可访问性增强
   ========================================== */
@media (prefers-reduced-motion: reduce) {
    .course-sidebar,
    .category-item,
    .stat-card,
    .tool-link,
    .footer-link,
    .progress-bar-fill {
        animation: none;
        transition: none;
    }
    
    .active-indicator {
        animation: none;
    }
}

/* ==========================================
   高对比度模式支持
   ========================================== */
@media (prefers-contrast: high) {
    .course-sidebar {
        border: 2px solid #e2e8f0;
    }
    
    .category-item.active {
        border: 2px solid #3b82f6;
    }
    
    .stat-card,
    .tool-link,
    .footer-link {
        border: 1px solid #e2e8f0;
    }
}

/* ==========================================
   打印样式
   ========================================== */
@media print {
    .course-sidebar {
        display: none;
    }
}

/* ==========================================
   焦点样式
   ========================================== */
.course-sidebar a:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

