/* 我的学习页面样式 */

.my-learning-container {
    min-height: 100vh;
    background: #f8fafc;
}

/* 页面头部 */
.page-header {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    padding: 32px 0;
}

.page-header .header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.page-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 24px;
}

/* 学习统计概览 */
.learning-stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    max-width: 800px;
}

.page-header .stat-item {
    text-align: center;
    padding: 20px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.page-header .stat-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: #1B4F8C;
    margin-bottom: 8px;
}

.page-header .stat-label {
    font-size: 14px;
    color: #64748b;
    font-weight: 500;
}

/* 内容容器 */
.content-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 40px; /* 与首页一致 */
}

/* 页面与首页对齐的顶部间距与对齐修正 */
.page-my-learning .homepage-container {
    padding: 40px; /* 与首页完全一致的内边距 */
    padding-top: 150px !important; /* 为固定顶栏留出空间（72px顶栏 + 约50px tabs + 28px合理间距） */
    align-items: start !important; /* 确保左右两栏顶对齐 */
}

.page-my-learning .continue-learning-section .section-header {
    margin-top: 0 !important;
    /* 与首页完全一致：延伸到包含右侧边栏的宽度 */
    width: calc(100% + 320px + 32px) !important; /* 延伸到包含右侧边栏的宽度 (320px边栏 + 32px间距) */
    position: relative !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 20px !important;
}

.page-my-learning .sidebar {
    /* 与左侧课程卡片顶对齐 */
    margin-top: 68px !important; /* 减少margin-top，让learning-overview-card上移与课程卡片顶对齐 */
    position: sticky !important; /* 滚动到顶部后固定 */
    top: calc(72px + 56px + 16px); /* 顶栏+Tabs+缓冲，避免干涉 */
    align-self: start !important; /* 与网格顶部对齐，确保sticky生效 */
}

/* 移除learning-overview-card的额外margin-top，因为sidebar已经有margin-top了 */
.page-my-learning .learning-overview-card {
    margin-top: 0 !important; /* 移除额外margin-top，让sidebar的margin-top生效 */
}

/* 当sidebar固定时，调整learning-overview-card的顶部间距与首页一致 */
.page-my-learning .sidebar.is-sticky .learning-overview-card {
    margin-top: 0 !important; /* 固定时移除margin-top，让间距与首页一致 */
}

/* 备用方案：直接使用sticky伪类 */
.page-my-learning .sidebar:not(.is-sticky) .learning-overview-card {
    margin-top: 0 !important; /* 非sticky状态也保持margin-top为0 */
}

/* 课程卡片容器样式 */
.continue-cards-container .learning-card.large {
    margin-bottom: 20px; /* 与首页一致的垂直间距 */
}

.continue-cards-container .learning-card.large:last-child {
    margin-bottom: 0;
}

/* 课程标签页 */
.course-tabs {
    display: inline-flex;
    gap: 8px;
    margin-bottom: 24px;
    background: #f1f5f9;
    border-radius: 999px; /* 胶囊容器 */
    padding: 4px;
}

/* iOS风格滑动开关容器 */
.course-tabs.small {
    display: flex !important;
    gap: 0 !important;
    background: white !important;
    border-radius: 999px !important;
    padding: 0 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08) !important;
    border: 1px solid #e2e8f0 !important;
    width: 200px !important;
    margin-bottom: 0 !important;
    flex-shrink: 0 !important;
    position: relative !important;
    overflow: hidden !important;
}

/* iOS风格滑动开关 */
.ios-toggle-switch {
    position: relative !important;
    display: flex !important;
    width: 100% !important;
    height: 40px !important;
    background: #f1f5f9 !important;
    border-radius: 20px !important;
    overflow: hidden !important;
}

.course-tabs.small .course-tab {
    flex: 1 !important;
    min-width: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #64748b !important;
    cursor: pointer !important;
    border-radius: 0 !important;
    transition: color 0.3s ease !important;
    white-space: nowrap !important;
    text-align: center !important;
    width: 50% !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
    z-index: 2 !important;
}

.course-tabs.small .course-tab.active {
    color: white !important;
}

.course-tabs.small .course-tab:not(.active) {
    color: #64748b !important;
}

/* 滑动背景 */
.toggle-slider {
    position: absolute !important;
    top: 2px !important;
    left: 2px !important;
    width: calc(50% - 2px) !important;
    height: calc(100% - 4px) !important;
    background: #0056d3 !important;
    border-radius: 18px !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 2px 4px rgba(0, 86, 211, 0.3) !important;
    z-index: 1 !important;
}

/* 滑动到右侧 */
.ios-toggle-switch.switched .toggle-slider {
    transform: translateX(100%) !important;
}

/* 悬停效果 */
.course-tabs.small .course-tab:not(.active):hover {
    color: #0056d3 !important;
}

/* 点击反馈效果 */
.course-tabs.small .course-tab:active {
    transform: scale(0.98) !important;
    transition: transform 0.1s ease !important;
}

/* 增强滑动动画 */
.toggle-slider {
    will-change: transform !important;
}

/* 确保滑动开关在移动端也有良好的触摸体验 */
@media (max-width: 768px) {
    .ios-toggle-switch {
        height: 44px !important;
    }
    
    .course-tabs.small .course-tab {
        font-size: 15px !important;
    }
    
    .toggle-slider {
        height: calc(100% - 4px) !important;
        border-radius: 20px !important;
    }
}

.course-tab {
    padding: 10px 18px;
    border: none;
    background: none;
    font-size: 16px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    border-radius: 999px; /* 胶囊按钮 */
    transition: all 0.2s ease;
}

.course-tab.active {
    background: #1B4F8C;
    color: white;
}

.course-tab:not(.active):hover {
    background: #f1f5f9;
    color: #1B4F8C;
}

/* 筛选区域 */
.filters-section {
    margin-bottom: 24px;
}

.filter-group {
    display: flex;
    gap: 16px;
    align-items: center;
}

.filter-select {
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    font-size: 14px;
    color: #475569;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease;
}

.filter-select:focus {
    border-color: #1B4F8C;
}

/* 课程内容区域 */
.courses-content {
    position: relative;
}

.course-section {
    display: none;
}

.course-section.active {
    display: block;
}

.courses-grid {
    display: grid;
    grid-template-columns: 1fr; /* 竖排多个课程卡片 */
    gap: 16px;
}

/* 课程卡片（我的学习页面版本） */
.my-course-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.2s ease;
    border: 1px solid #e2e8f0;
}

.my-course-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.my-course-card-header {
    position: relative;
    height: 180px;
    overflow: hidden;
}

.my-course-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.my-course-card:hover .my-course-card-image {
    transform: scale(1.05);
}

.course-progress-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: white;
    padding: 16px;
}

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

.progress-percentage {
    font-weight: 600;
    font-size: 14px;
}

.last-accessed {
    font-size: 12px;
    opacity: 0.9;
}

.mini-progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    overflow: hidden;
}

.mini-progress-fill {
    height: 100%;
    background: #22c55e;
    transition: width 0.3s ease;
}

.my-course-card-body {
    padding: 20px;
}

.my-course-title {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 8px;
}

.my-course-subtitle {
    color: #64748b;
    font-size: 14px;
    margin-bottom: 16px;
}

.course-status-tags {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.status-tag {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.status-tag.in-progress {
    background: #dbeafe;
    color: #1d4ed8;
}

.status-tag.assignment-due {
    background: #fef3c7;
    color: #d97706;
}

.status-tag.completed {
    background: #dcfce7;
    color: #16a34a;
}

.my-course-actions {
    display: flex;
    gap: 12px;
}

.btn-continue-course {
    flex: 1;
    background: #1B4F8C;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-continue-course:hover {
    background: #164a7a;
}

.btn-view-details {
    background: none;
    color: #1B4F8C;
    border: 1px solid #1B4F8C;
    border-radius: 8px;
    padding: 12px 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-view-details:hover {
    background: #1B4F8C;
    color: white;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #64748b;
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 20px;
    margin-bottom: 8px;
    color: #475569;
}

.empty-state p {
    margin-bottom: 24px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.btn-browse-courses {
    background: #1B4F8C;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s ease;
}

.btn-browse-courses:hover {
    background: #164a7a;
    transform: translateY(-1px);
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .content-container {
        padding: 24px 16px;
    }
    
    .learning-stats-overview {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    .courses-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .page-header {
        padding: 24px 0;
    }
    
    .page-header h1 {
        font-size: 24px;
        margin-bottom: 16px;
    }
    
    .learning-stats-overview {
        grid-template-columns: 1fr 1fr;
    }
    
    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-select {
        width: 100%;
    }
    
    .course-tabs {
        flex-direction: column;
    }
    
    /* 移动端的section-header样式 - 与首页保持一致 */
    .page-my-learning .continue-learning-section .section-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
        width: 100% !important; /* 移动端恢复正常宽度 */
    }
    
    .course-tabs.small {
        align-self: stretch;
        justify-content: center;
    }
    
    /* 移动端关闭sticky行为 */
    .page-my-learning .sidebar {
        position: static !important;
        top: auto !important;
    }
    
    .my-course-actions {
        flex-direction: column;
    }
}

/* 加载状态 */
.loading-courses {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    color: #64748b;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #f3f4f6;
    border-top: 3px solid #1B4F8C;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 12px;
}

/* 课程详情快速预览 */
.course-quick-preview {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
}

.my-course-card:hover .course-quick-preview {
    opacity: 1;
}

.course-quick-preview:hover {
    background: rgba(27, 79, 140, 0.9);
    transform: scale(1.1);
}

/* 成就徽章 */
.achievement-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #fbbf24;
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.achievement-badge.completed {
    background: #22c55e;
}

.achievement-badge.streak {
    background: #f59e0b;
}

/* 课程进度详情 */
.course-progress-details {
    margin-top: 12px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
    font-size: 14px;
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    color: #64748b;
}

.progress-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
}
