/**
 * 学苑平台 - 学习系统样式
 * 
 * 专门针对在线学习系统的样式，包含课程卡片、课程详情、学习进度等
 */

/* ============================================================
   1. 课程卡片 (Course Card)
   ============================================================ */
.course-card {
    background: var(--bg-card);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    height: 100%;
    position: relative;
}

.course-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.12), 0 18px 36px -18px rgba(0, 0, 0, 0.1);
    border-color: rgba(142, 151, 117, 0.2);
}

.course-thumbnail {
    aspect-ratio: 16/9;
    overflow: hidden;
    position: relative;
    background-color: #f1f5f9;
}

.course-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 1.2s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.course-card:hover .course-thumbnail img {
    transform: scale(1.1) rotate(1deg);
    filter: brightness(0.85);
}

.course-content {
    padding: 1rem;
    /* 从 1.25rem 缩减 */
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    background: linear-gradient(to bottom, #ffffff, #fafafa);
}

.course-title {
    font-size: 0.95rem;
    /* 稍微缩小一点更精致 */
    line-height: 1.4;
    /* 从 1.5 缩减 */
    margin-bottom: 0.5rem;
    /* 从 0.75rem 缩减 */
    font-weight: 800;
    color: #1e293b;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.8em;
    /* 从 3em 缩减，对齐 1.4 行高 */
    transition: all 0.3s ease;
}

.course-title a {
    color: inherit;
    text-decoration: none;
}

.course-card:hover .course-title {
    color: var(--primary);
    transform: translateX(4px);
}

.instructor-label {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 10;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    font-weight: 800;
    color: #ffca28;
    /* 更亮丽的琥珀金 */
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.75) 0%, rgba(15, 23, 42, 0.9) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 0.4rem 0.9rem;
    border-radius: 50px;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    /* 极致双层边框：外层透明金 + 内层高亮线 */
    border: 1px solid rgba(255, 202, 40, 0.3);
    box-shadow:
        0 8px 20px -4px rgba(0, 0, 0, 0.4),
        inset 0 1px 1px rgba(255, 255, 255, 0.1),
        /* 顶部高亮，模拟光源 */
        0 0 15px rgba(255, 202, 40, 0.05);
    /* 极细微的金光 */
}

.course-card:hover .instructor-label {
    background: #1e293b;
    color: #ffca28;
    border-color: rgba(255, 202, 40, 0.8);
    transform: translateY(-2px);
    box-shadow:
        0 12px 24px -6px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(255, 202, 40, 0.2);
    /* 悬停时金光增强 */
}

.course-footer {
    margin-top: auto;
    padding-top: 0.5rem;
    /* 缩减上间距 */
}

/* 统一进度区域样式，高度优化 */
.progress-container {
    background: #f1f5f9;
    /* 稍微加深以区分卡片背景 */
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    margin: 0.4rem 0;
    min-height: 62px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 1px solid rgba(0, 0, 0, 0.02);
}

.progress-container.not-started {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    /* 强化虚线可见度 */
}

.not-started-text {
    color: #64748b;
    /* 加深文字 */
    font-size: 0.875rem;
    text-align: center;
    font-weight: 500;
}

/* ============================================================
   2. 课程列表布局
   ============================================================ */
.course-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.course-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

/* 按钮标准化与差异化 */
.course-footer .btn {
    height: 40px;
    /* 从 44px 降至 40px，整体更精致 */
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: 50px;
    font-weight: 700;
    width: 100%;
}

.btn-start {
    background: #8e9775 !important;
    /* 莫兰迪绿：对齐品牌色 */
    color: white !important;
}

.btn-start:hover {
    background: #7a8264 !important;
    box-shadow: 0 4px 12px rgba(142, 151, 117, 0.2);
}

.btn-continue {
    background: #92a9bd !important;
    /* 莫兰迪蓝：对齐品牌色 */
    color: white !important;
}

.btn-continue:hover {
    background: #7e94a8 !important;
    box-shadow: 0 4px 12px rgba(146, 169, 189, 0.2);
}

@media (max-width: 1200px) {
    .course-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .course-grid-4 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .course-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {

    .course-grid,
    .course-grid-4 {
        grid-template-columns: 1fr;
    }
}

.course-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 3rem;
    align-items: start;
}

@media (max-width: 1024px) {
    .course-layout {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   3. 侧边栏
   ============================================================ */
.sidebar {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2rem;
    border: 1px solid var(--border);
    position: sticky;
    top: 100px;
    box-shadow: var(--shadow-sm);
}

.sidebar:hover {
    box-shadow: var(--shadow-md);
}

.widget-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1.2rem;
    padding-bottom: 0.8rem;
    border-bottom: 2px solid var(--bg-body);
    color: var(--text-main);
}

/* ============================================================
   4. 课程详情页
   ============================================================ */
.course-detail-container {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 3rem;
    padding: 2rem 0;
}

.course-detail-main h1 {
    font-size: 2.25rem;
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

.course-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.course-detail-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    color: var(--text-light);
}

.course-detail-meta-item i {
    color: var(--primary);
}

/* 课程详情侧边栏卡片 */
.course-sidebar-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    position: sticky;
    top: 100px;
}

.course-sidebar-preview img {
    width: 100%;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
}

@media (max-width: 1024px) {
    .course-detail-container {
        grid-template-columns: 1fr;
    }

    .course-sidebar-card {
        position: static;
        margin-top: 2rem;
    }
}

/* ============================================================
   5. 课程大纲 (Curriculum)
   ============================================================ */
.curriculum {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    margin-bottom: 2rem;
}

.curriculum-section {
    border-bottom: 1px solid var(--border);
}

.curriculum-section:last-child {
    border-bottom: none;
}

.section-header {
    padding: 1.25rem 1.5rem;
    background: var(--bg-body);
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-header:hover {
    background: #f3f4f6;
}

.section-title {
    font-weight: 600;
    color: var(--text-main);
    font-size: 1.05rem;
}

.section-toggle {
    transition: transform 0.3s;
}

.section-header.active .section-toggle {
    transform: rotate(180deg);
}

.section-lessons {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.section-header.active+.section-lessons {
    max-height: 1000px;
}

.lesson-item {
    padding: 1rem 1.5rem 1rem 2.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

.lesson-item:last-child {
    border-bottom: none;
}

.lesson-item:hover {
    background: var(--bg-body);
}

.lesson-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.lesson-icon {
    color: var(--primary);
    font-size: 1.2rem;
}

.lesson-title {
    font-weight: 500;
    color: var(--text-main);
}

.lesson-duration {
    color: var(--text-light);
    font-size: 0.875rem;
}

.lesson-status {
    color: var(--secondary);
    font-size: 1.2rem;
}

/* ============================================================
   6. 学习进度条 (Progress Bar)
   ============================================================ */
/* 进度条样式已移至上方课程卡片部分统一管理 */

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.progress-label {
    font-weight: 600;
    color: var(--text-main);
}

.progress-percentage {
    font-weight: 700;
    color: var(--primary);
}

.progress-bar-wrapper {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* ============================================================
   7. 用户资料页 (Profile)
   ============================================================ */
.profile-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 0;
}

.profile-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 992px) {
    .profile-layout {
        grid-template-columns: 1fr;
    }
}

.profile-main {
    min-width: 0;
    /* 防止内容溢出 */
}

.profile-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.profile-header {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
}

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
}

.profile-info h2 {
    margin-bottom: 0.5rem;
}

.profile-email {
    color: var(--text-light);
}

.profile-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.375rem;
    background: var(--bg-body);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
}

.profile-nav a {
    padding: 0.375rem 1rem;
    border-radius: var(--radius-md);
    color: var(--text-main);
    text-decoration: none;
    transition: all 0.2s;
    font-weight: 500;
}

.profile-nav a:hover,
.profile-nav a.active {
    background: #eff6ff;
    color: var(--primary);
}

.profile-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem;
}

/* 垂直统计列表 */
.stats-vertical {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.stats-vertical .stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stats-vertical .stat-value {
    font-size: 1.25rem;
    margin-bottom: 0;
}

.stats-vertical .stat-label {
    margin-bottom: 0;
    font-weight: 600;
}

/* ============================================================
   8. 登录/注册页面
   ============================================================ */
.auth-container {
    max-width: 900px;
    margin: 4rem auto;
    background: var(--bg-card);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.auth-section {
    padding: 3rem;
}

.auth-section h3 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--text-main);
}

.auth-section input {
    margin-bottom: 1.25rem;
}

.auth-section .btn {
    margin-top: 1rem;
}

@media (max-width: 768px) {
    .auth-container {
        grid-template-columns: 1fr;
        margin: 2rem auto;
    }

    .auth-section {
        padding: 2rem;
    }
}

/* ============================================================
   9. 学习页面 (Learning Interface)
   ============================================================ */
.learning-container {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 0;
    height: calc(100vh - 70px);
}

.video-area {
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-player {
    width: 100%;
    height: auto;
    max-height: 100%;
}

.lesson-sidebar {
    background: var(--bg-card);
    overflow-y: auto;
    border-left: 1px solid var(--border);
}

.lesson-sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 10;
}

.lesson-list-item {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s;
}

.lesson-list-item:hover {
    background: var(--bg-body);
}

.lesson-list-item.active {
    background: rgba(79, 70, 229, 0.1);
    border-left: 3px solid var(--primary);
}

@media (max-width: 1024px) {
    .learning-container {
        grid-template-columns: 1fr;
        height: auto;
    }
}

/* ============================================================
   10. 统计卡片 (Stats Card)
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.stat-label {
    color: var(--text-light);
    font-size: 0.95rem;
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}