﻿/* ========== 课件系统样式 - 现代化设计升级 ========== */

/* 课件容器 */
.courseware-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 0;
    /* 92px = 52px(合并导航栏) + 16px(内容区顶部padding) + 24px(底部padding) */
    height: calc(100vh - 92px);
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.08);
    /* 使用纯淡入动画，避免布局偏移 */
    animation: simpleFadeIn 0.3s ease;
    transition: grid-template-columns 0.3s ease;
}

@keyframes simpleFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 左侧目录 */
.courseware-sidebar {
    background: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
    border-right: 1px solid rgba(99, 102, 241, 0.08);
    overflow-y: auto;
    padding: 24px 0;
    position: relative;
}

.courseware-sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, #6366f1 0%, #8b5cf6 50%, #06b6d4 100%);
}

.sidebar-header {
    padding: 0 16px 16px;
    border-bottom: 1px solid rgba(99, 102, 241, 0.08);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}


.sidebar-header h3 i {
    width: 22px;
    height: 22px;
    color: #6366f1;
    filter: drop-shadow(0 2px 4px rgba(99, 102, 241, 0.3));
}

.chapter-list {
    list-style: none;
    padding: 0 8px;
    margin: 0;
}

.chapter-item {
    margin-bottom: 6px;
}

.chapter-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 12px;
    margin: 0 8px;
    position: relative;
}

.chapter-header:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(139, 92, 246, 0.05) 100%);
    transform: translateX(4px);
}

.chapter-header.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(139, 92, 246, 0.08) 100%);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.1);
}

.chapter-header.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: linear-gradient(180deg, #6366f1, #8b5cf6);
    border-radius: 0 4px 4px 0;
}

.chapter-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.chapter-icon.completed {
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.chapter-icon.current {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.chapter-icon.locked {
    background: linear-gradient(135deg, #e2e8f0 0%, #f1f5f9 100%);
    color: #94a3b8;
}

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

.chapter-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
    /* 允许换行显示完整标题 */
    white-space: normal;
    line-height: 1.4;
    transition: color 0.2s ease;
}

.chapter-header:hover .chapter-title,
.chapter-header.active .chapter-title {
    color: #6366f1;
}

.chapter-progress {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chapter-progress::before {
    content: '';
    display: inline-block;
    width: 40px;
    height: 3px;
    background: #e2e8f0;
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

/* 章节展开内容 */
.section-list {
    list-style: none;
    padding: 0 0 0 48px;
    margin: 0 16px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 2px dashed rgba(99, 102, 241, 0.2);
}

.chapter-item.expanded .section-list {
    max-height: 500px;
    margin-top: 8px;
    margin-bottom: 8px;
}

.section-item {
    padding: 10px 16px;
    font-size: 0.85rem;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 8px;
    margin-bottom: 4px;
    position: relative;
}

.section-item::before {
    content: '';
    position: absolute;
    left: -18px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: #e2e8f0;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.section-item:hover {
    background: rgba(99, 102, 241, 0.08);
    color: #6366f1;
    transform: translateX(4px);
}

.section-item:hover::before {
    background: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.section-item.active {
    color: #6366f1;
    font-weight: 600;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.06) 100%);
}

.section-item.active::before {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.section-item i {
    width: 16px;
    height: 16px;
}

/* 右侧课件内容区 */
.courseware-content {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 课件顶部工具栏 */
.content-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 20px;
    background: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
    border-bottom: 1px solid rgba(99, 102, 241, 0.08);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.02);
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.content-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #64748b;
}

.content-breadcrumb span {
    color: #6366f1;
    font-weight: 600;
    padding: 2px 10px;
    background: rgba(99, 102, 241, 0.08);
    border-radius: 6px;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-toolbar.primary {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

.btn-toolbar.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-toolbar.secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid rgba(99, 102, 241, 0.08);
}

.btn-toolbar.secondary:hover {
    background: #e2e8f0;
    border-color: rgba(99, 102, 241, 0.15);
    transform: translateY(-1px);
}

.btn-toolbar i {
    width: 16px;
    height: 16px;
}

/* 课件主内容 */
.content-main {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
    background: linear-gradient(180deg, #fafbfc 0%, #f1f5f9 100%);
}

/* 课件卡片样式 */
.lesson-card {
    background: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
    border-radius: 16px;
    padding: 28px 32px;
    margin-bottom: 20px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(99, 102, 241, 0.08);
    /* 使用纯淡入动画，避免布局偏移 */
    animation: simpleFadeIn 0.3s ease;
}

.lesson-card h2 {
    font-size: 1.85rem;
    font-weight: 800;
    color: #1e293b;
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.lesson-card h2 .chapter-badge {
    font-size: 0.75rem;
    padding: 6px 14px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    border-radius: 20px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.lesson-intro {
    color: #64748b;
    font-size: 1.05rem;
    line-height: 1.8;
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 2px dashed rgba(99, 102, 241, 0.15);
}

/* 知识点区块 */
.knowledge-block {
    margin-bottom: 32px;
    padding: 28px 32px;
    background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
    border-radius: 16px;
    border-left: 5px solid;
    border-image: linear-gradient(180deg, #6366f1, #8b5cf6) 1;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.06);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.knowledge-block::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.04) 0%, transparent 70%);
    border-radius: 50%;
}

.knowledge-block:hover {
    transform: translateX(4px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.1);
}

.knowledge-block h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 18px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.knowledge-block h3 i {
    width: 26px;
    height: 26px;
    color: #6366f1;
    filter: drop-shadow(0 2px 4px rgba(99, 102, 241, 0.3));
}

.knowledge-block p {
    color: #475569;
    line-height: 1.9;
    margin: 0 0 14px 0;
    font-size: 1rem;
}

.knowledge-block ul, .knowledge-block ol {
    color: #475569;
    line-height: 2;
    margin: 0;
    padding-left: 24px;
}

.knowledge-block li {
    margin-bottom: 10px;
    position: relative;
}

.knowledge-block ul li::marker {
    color: #6366f1;
}

/* 公式展示框 */
.formula-box {
    background: linear-gradient(135deg, #fafbfc 0%, #f1f5f9 100%);
    border: 2px solid rgba(99, 102, 241, 0.15);
    border-radius: 16px;
    padding: 28px 32px;
    margin: 20px 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.formula-box::before {
    content: 'f(x)';
    position: absolute;
    top: 10px;
    right: 16px;
    font-size: 0.7rem;
    font-weight: 700;
    color: rgba(99, 102, 241, 0.3);
    font-family: monospace;
}

.formula-box .formula {
    font-size: 1.4rem;
    font-weight: 600;
    color: #4f46e5;
    margin: 12px 0;
}

/* KaTeX 公式样式 */
.formula-box .formula .katex-display {
    margin: 0;
}

.formula-box .formula .katex {
    font-size: 1.5em;
    color: #4f46e5;
}

.formula-box .formula-note {
    font-size: 0.9rem;
    color: #64748b;
    margin-top: 12px;
    font-weight: 500;
}

/* 情境场景图库 - 图片卡片布局 */
.scenario-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 20px 0;
    padding: 20px;
    background: linear-gradient(135deg, #f0f4ff 0%, #e0e7ff 100%);
    border-radius: 16px;
    border: 2px solid rgba(99, 102, 241, 0.15);
}

.scenario-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

.scenario-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.15);
}

.scenario-image {
    position: relative;
    width: 100%;
    height: 120px;
    overflow: hidden;
}

.scenario-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.scenario-card:hover .scenario-image img {
    transform: scale(1.05);
}

.scenario-overlay {
    position: absolute;
    top: 8px;
    left: 8px;
}

.scenario-tag {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(99, 102, 241, 0.9);
    color: white;
    font-size: 11px;
    font-weight: 500;
    border-radius: 20px;
    backdrop-filter: blur(4px);
}

.scenario-content {
    padding: 12px;
}

.scenario-content h4 {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 6px 0;
}

.scenario-content p {
    font-size: 12px;
    color: #64748b;
    line-height: 1.5;
    margin: 0;
}

.scenario-summary {
    grid-column: 1 / -1;
    text-align: center;
    padding: 14px;
    background: white;
    border-radius: 10px;
    font-size: 15px;
    color: #475569;
    margin-top: 4px;
    font-weight: 500;
}

/* 响应式：小屏幕时改为单列 */
@media (max-width: 768px) {
    .scenario-gallery {
        grid-template-columns: 1fr;
    }
    
    .scenario-image {
        height: 160px;
    }
}

/* 图示区域 */
.illustration-box {
    background: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
    border: 1px solid rgba(99, 102, 241, 0.1);
    border-radius: 16px;
    padding: 24px;
    margin: 20px 0;
    text-align: center;
    transition: all 0.3s ease;
}

.illustration-box:hover {
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.08);
}

.illustration-box img {
    max-width: 100%;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.illustration-box canvas {
    max-width: 100%;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.illustration-box .caption {
    font-size: 0.9rem;
    color: #64748b;
    margin-top: 16px;
    font-weight: 500;
}

/* 示例区块 */
.example-block {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 16px;
    padding: 24px 28px;
    margin: 20px 0;
    position: relative;
    overflow: hidden;
}

.example-block::before {
    content: '◇';
    position: absolute;
    top: -10px;
    right: 20px;
    font-size: 48px;
    opacity: 0.15;
    color: #b45309;
}

.example-block h4 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #b45309;
    margin: 0 0 14px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.example-block h4 i {
    width: 20px;
    height: 20px;
    filter: drop-shadow(0 1px 2px rgba(180, 83, 9, 0.3));
}

.example-block .example-content {
    color: #78350f;
    line-height: 1.9;
    font-size: 0.95rem;
}

/* 练习题区块 */
.practice-block {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 16px;
    padding: 24px 28px;
    margin: 20px 0;
    position: relative;
    overflow: hidden;
}

.practice-block::before {
    content: '◈';
    position: absolute;
    top: -10px;
    right: 20px;
    font-size: 48px;
    opacity: 0.15;
    color: #059669;
}

.practice-block h4 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #15803d;
    margin: 0 0 14px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.practice-block h4 i {
    width: 20px;
    height: 20px;
    filter: drop-shadow(0 1px 2px rgba(21, 128, 61, 0.3));
}

/* AI辅助按钮组 */
.ai-assist-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed #e2e8f0;
}

.btn-ai-assist {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #93c5fd;
    border-radius: 20px;
    color: #1d4ed8;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-ai-assist:hover {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.btn-ai-assist i {
    width: 16px;
    height: 16px;
}

.btn-ai-assist.highlight {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-color: transparent;
    color: #fff;
}

.btn-ai-assist.highlight:hover {
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
}

/* AI对话浮窗 */
.ai-chat-popup {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 480px;
    height: 520px;
    min-width: 360px;
    min-height: 400px;
    max-width: calc(100vw - 48px);
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
    animation: slideUp 0.3s ease;
    resize: both;
    overflow: auto;
}

/* 最大化状态 */
.ai-chat-popup.maximized {
    width: calc(100vw - 360px) !important;
    height: calc(100vh - 120px) !important;
    bottom: 60px;
    right: 24px;
    border-radius: 16px;
    resize: none;
}

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

.ai-chat-popup.show {
    display: flex;
}

.ai-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
}

.ai-chat-header h4 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
}

.ai-chat-header h4 i {
    width: 20px;
    height: 20px;
}

/* 对话框头部操作按钮组 */
.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-maximize-chat,
.btn-close-chat {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-maximize-chat:hover,
.btn-close-chat:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.btn-maximize-chat i,
.btn-close-chat i {
    width: 18px;
    height: 18px;
}

/* 最大化状态下图标变化 */
.ai-chat-popup.maximized .btn-maximize-chat i {
    /* 切换到还原图标 - 通过JS动态更换 */
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    min-height: 0; /* 让flex子元素能正确收缩 */
}

.ai-chat-messages .message {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.ai-chat-messages .message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-chat-messages .message.assistant .message-avatar {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
}

.ai-chat-messages .message.user .message-avatar {
    background: #f1f5f9;
    color: #64748b;
}

.ai-chat-messages .message-avatar i {
    width: 18px;
    height: 18px;
}

.ai-chat-messages .message-content {
    flex: 1;
    background: #f8fafc;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.7;
    color: #334155;
}

.ai-chat-messages .message.user .message-content {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    color: #1e40af;
}

/* 流式输出打字光标效果 */
.ai-chat-messages .message.streaming .message-content {
    min-height: 24px;
}

.typing-cursor {
    display: inline-block;
    color: #6366f1;
    animation: blink 0.8s ease-in-out infinite;
    font-weight: 600;
    margin-left: 2px;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* 流式消息过渡效果 */
.ai-chat-messages .message.streaming {
    animation: messageAppear 0.3s ease-out;
}

@keyframes messageAppear {
    from {
        opacity: 0.5;
    }
    to {
        opacity: 1;
    }
}

.ai-chat-input {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}

.ai-chat-input textarea {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.9rem;
    resize: none;
    outline: none;
    transition: border-color 0.2s ease;
}

.ai-chat-input textarea:focus {
    border-color: #6366f1;
}

.ai-chat-input .btn-send-chat {
    padding: 10px 18px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.ai-chat-input .btn-send-chat:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.ai-chat-input .btn-send-chat i {
    width: 16px;
    height: 16px;
}

/* AI浮动按钮 */
.ai-fab {
    position: fixed;
    bottom: 80px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    border: none;
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 999;
}

.ai-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.5);
}

.ai-fab i {
    width: 26px;
    height: 26px;
}

.ai-fab.hidden {
    display: none;
}

/* 笔记侧栏 */
.notes-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 360px;
    height: 100vh;
    background: #fff;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.notes-panel.show {
    transform: translateX(0);
}

.notes-header {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notes-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.notes-header h3 i {
    width: 20px;
    height: 20px;
    color: #f59e0b;
}

.notes-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.notes-body textarea {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    font-size: 0.9rem;
    line-height: 1.8;
    resize: none;
    color: #334155;
}

.notes-body textarea::placeholder {
    color: #94a3b8;
}

.btn-close-notes {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    color: #64748b;
    transition: all 0.2s ease;
}

.btn-close-notes:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.btn-close-notes i {
    width: 18px;
    height: 18px;
}

/* 底部导航栏 */
.content-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 24px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
}

.nav-progress {
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-bar {
    width: 200px;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.85rem;
    color: #64748b;
}

.nav-buttons {
    display: flex;
    gap: 12px;
}

.btn-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-nav.prev {
    background: #f1f5f9;
    color: #475569;
}

.btn-nav.prev:hover {
    background: #e2e8f0;
}

.btn-nav.next {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
}

.btn-nav.next:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-nav i {
    width: 16px;
    height: 16px;
}

.btn-nav:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* 提示标签 */
.tip-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #fef3c7;
    color: #b45309;
    border-radius: 20px;
    font-size: 0.75rem;
    margin-left: 8px;
}

.tip-tag i {
    width: 12px;
    height: 12px;
}

/* 表格样式 */
.content-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
}

.content-table th,
.content-table td {
    padding: 12px 16px;
    text-align: center;
    border: 1px solid #e2e8f0;
}

.content-table th {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    font-weight: 600;
}

.content-table tr:nth-child(even) {
    background: #f8fafc;
}

.content-table tr:hover {
    background: #f1f5f9;
}

/* ============================================
   专注模式样式
   ============================================ */

/* 专注模式：隐藏目录和工具栏 */
.courseware-container.focus-mode {
    grid-template-columns: 1fr;
}

.courseware-container.focus-mode .courseware-sidebar {
    display: none;
}

.courseware-container.focus-mode .content-toolbar {
    display: none;
}

.courseware-container.focus-mode .content-main {
    padding: 32px 48px;
}

/* 专注模式 - 隐藏顶部导航栏（合并式） */
.app-page.focus-mode-active .app-header-unified {
    display: none;
}

/* 兼容旧类名 */
.app-page.focus-mode-active .app-header {
    display: none;
}

.app-page.focus-mode-active .module-tabs {
    display: none;
}

/* 专注模式下内容区域撑满整个视口 */
.app-page.focus-mode-active .module-content {
    height: 100vh;
}

.app-page.focus-mode-active .courseware-container {
    height: 100vh;
}

/* 专注模式下隐藏body外层滚动条 */
body.focus-mode-active {
    overflow: hidden;
}

body.focus-mode-active .app-page {
    overflow: hidden;
}

/* 专注模式下课件内容区布局 - 使用固定定位精确控制 */
.courseware-container.focus-mode .courseware-content {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    padding-top: 0;
    margin-top: 0;
    z-index: 100;
    background: linear-gradient(180deg, #fafbfc 0%, #f1f5f9 100%);
}

/* 确保内容区域可滚动 */
.courseware-container.focus-mode .content-main {
    overflow-y: auto;
    flex: 1;
    min-height: 0; /* 重要：让flex子元素可以收缩 */
    padding-top: 70px; /* 为顶部专注模式提示条留出空间 */
}

/* 专注模式下底部导航固定显示 */
.courseware-container.focus-mode .content-footer {
    flex-shrink: 0;
    position: relative;
    z-index: 10;
    background: #fff; /* 确保背景不透明 */
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

/* 专注模式下的退出提示 */
.focus-mode-hint {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(99, 102, 241, 0.95);
    color: #fff;
    padding: 10px 20px;
    border-radius: 24px;
    font-size: 0.85rem;
    display: none;
    align-items: center;
    gap: 10px;
    z-index: 1000;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.focus-mode-hint.show {
    display: flex;
}

.focus-mode-hint i {
    width: 16px;
    height: 16px;
}

.focus-mode-hint .btn-exit-focus {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    padding: 4px 12px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.8rem;
    margin-left: 8px;
    transition: background 0.2s ease;
}

.focus-mode-hint .btn-exit-focus:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 专注模式按钮激活状态 */
.btn-toolbar.focus-active {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    border-color: transparent;
}

/* 响应式调整 */
@media (max-width: 900px) {
    .courseware-container {
        grid-template-columns: 1fr;
    }
    
    .courseware-sidebar {
        display: none;
    }
    
    /* 小屏幕下专注模式隐藏退出提示，因为已经没有工具栏 */
    .focus-mode-hint {
        display: none !important;
    }
    
    /* 小屏幕下工具栏简化 */
    .content-toolbar {
        padding: 8px 16px;
    }
    
    .btn-toolbar span {
        display: none;
    }
    
    .btn-toolbar {
        padding: 8px 12px;
    }
    
    /* 内容区域更大的边距 */
    .content-main {
        padding: 16px 16px;
    }
    
    .lesson-card {
        padding: 20px 16px;
        border-radius: 12px;
    }
    
    .ai-chat-popup {
        width: calc(100% - 32px);
        right: 16px;
        bottom: 16px;
    }
}

@media (max-width: 600px) {
    .content-toolbar .toolbar-left {
        display: none;
    }
    
    .content-toolbar {
        justify-content: flex-end;
    }
    
    .content-footer {
        padding: 12px 16px;
        flex-direction: column;
        gap: 12px;
    }
    
    .nav-progress {
        width: 100%;
        justify-content: center;
    }
    
    .nav-buttons {
        width: 100%;
        justify-content: space-between;
    }
    
    .btn-nav {
        flex: 1;
        justify-content: center;
    }
}

/* ============================================
   随堂练习交互样式
   ============================================ */

/* 练习题容器 */
.exercise-item {
    margin-bottom: 24px;
    padding: 16px 20px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.exercise-item:last-child {
    margin-bottom: 0;
}

/* 题目序号和内容 */
.exercise-question {
    font-size: 1rem;
    color: #1e293b;
    margin-bottom: 16px;
    line-height: 1.6;
}

.exercise-question .exercise-number {
    display: inline-block;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    text-align: center;
    line-height: 24px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-right: 10px;
}

/* 选择题选项 */
.exercise-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.exercise-option {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.exercise-option:hover {
    border-color: #6366f1;
    background: #f5f3ff;
}

.exercise-option.selected {
    border-color: #6366f1;
    background: #f5f3ff;
}

.exercise-option.correct {
    border-color: #22c55e;
    background: #f0fdf4;
}

.exercise-option.incorrect {
    border-color: #ef4444;
    background: #fef2f2;
}

.exercise-option.correct-answer {
    border-color: #22c55e;
    background: #f0fdf4;
}

.exercise-option .option-radio {
    width: 20px;
    height: 20px;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.exercise-option.selected .option-radio {
    border-color: #6366f1;
    background: #6366f1;
}

.exercise-option.selected .option-radio::after {
    content: '';
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
}

.exercise-option.correct .option-radio {
    border-color: #22c55e;
    background: #22c55e;
}

.exercise-option.correct .option-radio::after {
    content: '✓';
    color: #fff;
    font-size: 12px;
    font-weight: bold;
}

.exercise-option.incorrect .option-radio {
    border-color: #ef4444;
    background: #ef4444;
}

.exercise-option.incorrect .option-radio::after {
    content: '✗';
    color: #fff;
    font-size: 12px;
    font-weight: bold;
}

.exercise-option .option-label {
    font-weight: 600;
    color: #6366f1;
    margin-right: 8px;
    min-width: 20px;
}

.exercise-option .option-text {
    color: #334155;
}

/* 填空题输入框 */
.exercise-fillblank {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.exercise-fillblank input {
    padding: 10px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    min-width: 150px;
    max-width: 300px;
    outline: none;
    transition: all 0.2s ease;
}

.exercise-fillblank input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.exercise-fillblank input.correct {
    border-color: #22c55e;
    background: #f0fdf4;
}

.exercise-fillblank input.incorrect {
    border-color: #ef4444;
    background: #fef2f2;
}

.exercise-fillblank input:disabled {
    background: #f8fafc;
    cursor: not-allowed;
}

/* 提交按钮 */
.btn-submit-exercise {
    padding: 8px 20px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-submit-exercise:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-submit-exercise:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-submit-exercise i {
    width: 16px;
    height: 16px;
}

/* 反馈区域 */
.exercise-feedback {
    margin-top: 16px;
    padding: 14px 18px;
    border-radius: 10px;
    display: none;
    width: 100%;
    box-sizing: border-box;
}

.exercise-feedback.show {
    display: block;
    animation: feedbackFadeIn 0.3s ease forwards;
}

@keyframes feedbackFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.exercise-feedback.correct {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid #86efac;
}

.exercise-feedback.incorrect {
    background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
    border: 1px solid #fca5a5;
}

.exercise-feedback .feedback-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    margin-bottom: 8px;
}

.exercise-feedback.correct .feedback-title {
    color: #16a34a;
}

.exercise-feedback.incorrect .feedback-title {
    color: #dc2626;
}

.exercise-feedback .feedback-title i {
    width: 20px;
    height: 20px;
}

.exercise-feedback .feedback-explanation {
    color: #475569;
    font-size: 0.95rem;
    line-height: 1.6;
}

.exercise-feedback .correct-answer-hint {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #cbd5e1;
    color: #16a34a;
    font-weight: 500;
}

/* ==================== 例题答案折叠样式 ==================== */

.example-answer-toggle {
    margin: 16px 0;
    text-align: center;
}

.btn-show-answer {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-show-answer:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-show-answer:active {
    transform: translateY(0);
}

.btn-show-answer.active {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    box-shadow: 0 2px 8px rgba(100, 116, 139, 0.3);
}

.btn-show-answer.active:hover {
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
}

.btn-show-answer i {
    width: 18px;
    height: 18px;
}

/* 答案区域 */
.example-answer {
    padding: 16px 20px;
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    border-left: 4px solid #22c55e;
    border-radius: 0 8px 8px 0;
    margin-top: 12px;
    animation: fadeInAnswer 0.3s ease;
}

.example-answer.hidden {
    display: none;
}

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

/* 动画 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
