/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Microsoft YaHei', sans-serif;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
}

/* 头部样式 */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
}

nav {
    display: flex;
    gap: 10px;
}

.nav-btn {
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s;
}

/* 主内容区域 */
main {
    display: flex;
    flex: 1;
}

/* 侧边栏 */
#sidebar {
    width: 250px;
    padding: 20px;
    border-right: 1px solid rgba(0, 0, 0, 0.1);
    overflow-y: auto;
}

.sidebar-header {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.subject-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.subject-item {
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.subject-item:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.subject-item.active {
    font-weight: bold;
}

.chapter-list {
    margin-left: 15px;
    margin-top: 5px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.chapter-item {
    padding: 8px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chapter-item:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.chapter-item.active {
    font-weight: bold;
}

.mastery-indicator {
    width: 30px;
    height: 8px;
    border-radius: 4px;
    background-color: #e0e0e0;
}

/* 内容区域 */
#content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

/* 欢迎屏幕 */
.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%;
    padding: 20px;
}

.welcome-screen h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.welcome-screen p {
    font-size: 1.2rem;
    margin-bottom: 30px;
    opacity: 0.8;
}

.features {
    display: flex;
    gap: 30px;
    margin-bottom: 40px;
}

.feature {
    max-width: 200px;
}

.feature h3 {
    margin-bottom: 10px;
}

.feature p {
    font-size: 0.9rem;
    opacity: 0.7;
}

/* 学习区域 */
.learning-area {
    height: 100%;
}

.section {
    margin-bottom: 30px;
}

.section-title {
    font-size: 1.5rem;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

/* 知识内容 */
.knowledge-content {
    line-height: 1.6;
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.knowledge-content p {
    margin-bottom: 15px;
}

.knowledge-content img {
    max-width: 100%;
    margin: 15px 0;
    border-radius: 8px;
}

.knowledge-controls {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* 练习内容 */
.exercise-content {
    margin-bottom: 20px;
}

.exercise-question {
    font-size: 1.2rem;
    margin-bottom: 20px;
    line-height: 1.5;
}

/* 选择题 */
.choice-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.choice-option {
    padding: 12px 15px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s;
}

.choice-option:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.choice-option.selected {
    border-color: #4a90e2;
    background-color: rgba(74, 144, 226, 0.1);
}

.choice-option.correct {
    border-color: #4caf50;
    background-color: rgba(76, 175, 80, 0.1);
}

.choice-option.incorrect {
    border-color: #f44336;
    background-color: rgba(244, 67, 54, 0.1);
}

/* 填空题 */
.fill-blank {
    margin-bottom: 20px;
}

.fill-blank input {
    border: none;
    border-bottom: 2px solid #4a90e2;
    padding: 5px;
    font-size: 1rem;
    outline: none;
    background: transparent;
    margin: 0 5px;
    width: 120px;
}

/* 连线题 */
.connection-exercise {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.connection-left, .connection-right {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 45%;
}

.connection-item {
    padding: 10px 15px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s;
}

.connection-item.selected {
    border-color: #4a90e2;
    background-color: rgba(74, 144, 226, 0.1);
}

.connection-item.connected {
    border-color: #4caf50;
    background-color: rgba(76, 175, 80, 0.1);
}

.connection-canvas {
    position: absolute;
    pointer-events: none;
    z-index: 10;
}

/* 判断题 */
.true-false-options {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.true-false-option {
    padding: 10px 25px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
}

.true-false-option:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.true-false-option.selected {
    border-color: #4a90e2;
    background-color: rgba(74, 144, 226, 0.1);
}

.true-false-option.correct {
    border-color: #4caf50;
    background-color: rgba(76, 175, 80, 0.1);
}

.true-false-option.incorrect {
    border-color: #f44336;
    background-color: rgba(244, 67, 54, 0.1);
}

/* 简答题 */
.short-answer {
    margin-bottom: 20px;
}

.short-answer textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 1rem;
    resize: vertical;
    outline: none;
    transition: border-color 0.3s;
}

.short-answer textarea:focus {
    border-color: #4a90e2;
}

.voice-input-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    background-color: #4a90e2;
    color: white;
    cursor: pointer;
    margin-top: 10px;
}

.voice-input-btn:hover {
    background-color: #3a7bc8;
}

/* 练习控制 */
.exercise-controls {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* 结果内容 */
.result-content {
    margin-bottom: 20px;
}

.result-summary {
    font-size: 1.2rem;
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 6px;
    background-color: rgba(0, 0, 0, 0.05);
}

.result-details {
    margin-top: 20px;
}

.result-item {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.result-question {
    font-weight: bold;
    margin-bottom: 10px;
}

.result-answer {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.user-answer, .correct-answer {
    flex: 1;
    padding: 10px;
}

.answer-label {
    font-weight: bold;
    margin-bottom: 5px;
    opacity: 0.7;
}

.result-controls {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* 按钮样式 */
.primary-btn, .secondary-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

.primary-btn {
    background-color: #4a90e2;
    color: white;
}

.primary-btn:hover {
    background-color: #3a7bc8;
}

.secondary-btn {
    background-color: rgba(0, 0, 0, 0.1);
}

.secondary-btn:hover {
    background-color: rgba(0, 0, 0, 0.15);
}

/* 页脚样式 */
footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    text-align: center;
}

.progress-summary {
    display: flex;
    justify-content: center;
    gap: 30px;
}

/* 模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: white;
    padding: 25px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    position: relative;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.7;
}

.close-btn:hover {
    opacity: 1;
}

.modal h2 {
    margin-bottom: 15px;
}

.modal p {
    margin-bottom: 20px;
}

.modal input[type="file"] {
    margin-bottom: 20px;
    width: 100%;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* 语音识别状态 */
.voice-status {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: white;
    padding: 15px 20px;
    border-radius: 30px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 100;
}

.pulse-ring {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #4a90e2;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    70% {
        transform: scale(1.2);
        opacity: 0.7;
    }
    100% {
        transform: scale(0.8);
        opacity: 1;
    }
}

.status-text {
    font-weight: bold;
}

/* 通用工具类 */
.hidden {
    display: none !important;
}

/* 在style.css文件末尾添加以下代码 */

/* 侧边栏切换按钮 */
#sidebarToggle {
    display: none;
    position: fixed;
    left: 10px;
    top: 70px;
    z-index: 100;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 5px var(--shadow-color);
    transition: left 0.3s;
}

#sidebarToggle i {
    font-size: 1.2rem;
}

/* 侧边栏收缩状态 */
#sidebar.collapsed {
    transform: translateX(-250px);
}

/* 内容区域扩展状态 */
#content.expanded {
    margin-left: 0;
    padding-left: 60px; /* 添加左侧空白区域 */
}

/* 响应式布局 */
@media (max-width: 992px) {
    main {
        position: relative;
    }
    
    #sidebar {
        position: fixed;
        left: 0;
        top: 60px;
        bottom: 0;
        z-index: 90;
        transform: translateX(0);
        transition: transform 0.3s ease;
        box-shadow: 2px 0 5px var(--shadow-color);
    }
    
    #sidebarToggle {
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    #content {
        margin-left: 0;
        width: 100%;
        transition: margin-left 0.3s ease;
    }
	
	#content.expanded {
        margin-left: 0;
        padding-left: 60px; /* 添加适当的左侧间距 */
    }

    /* 侧边栏收缩状态下，切换按钮移动 */
    #sidebar.collapsed + #sidebarToggle {
        left: 10px;
    }
    
    /* 侧边栏展开状态下，切换按钮移动 */
    #sidebar:not(.collapsed) + #sidebarToggle {
        left: 260px;
    }
    /* 侧边栏切换按钮位置调整 */
    #sidebarToggle {
        left: 10px;
        transition: left 0.3s ease;
    }
}

@media (max-width: 768px) {
    header {
        padding: 10px;
    }
    
    .logo {
        font-size: 1.2rem;
    }
    
    .nav-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    .exercise-question {
        font-size: 1rem;
    }
    
    .choice-option, .connection-item, .true-false-option {
        padding: 8px 10px;
    }
    
    .features {
        flex-direction: column;
        gap: 15px;
    }
    
    .feature {
        max-width: 100%;
    }
    
    .knowledge-content {
        font-size: 1rem;
    }
    
    .exercise-controls, .knowledge-controls, .result-controls {
        flex-wrap: wrap;
    }
    
    .result-answer {
        flex-direction: column;
    }
    
    .user-answer, .correct-answer {
        width: 100%;
        padding: 10px 0;
    }

    /* 连线题在移动端特殊处理 */
    .connection-exercise {
        flex-direction: column;
    }
    
    .connection-left, .connection-right {
        width: 100%;
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    nav {
        width: 100%;
        justify-content: space-between;
    }
    
    .progress-summary {
        flex-direction: column;
        gap: 10px;
    }
    #content.expanded {
        padding-left: 40px; /* 小屏幕上减小左侧边距 */
    }
    
    #sidebarToggle {
        width: 36px;
        height: 36px;
    }
}

<!-- 在现有 style 标签内最后添加: -->

/* 内容区域边框和样式 */
.content-wrapper {
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 30px;
    margin: 20px 0;
    background: var(--card-background);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* 字号和行距控制 */
.text-controls {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 100;
}

.text-controls label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
}

.text-controls input[type="range"] {
    width: 120px;
}

.text-controls .value-display {
    display: inline-block;
    min-width: 40px;
    text-align: right;
    margin-left: 10px;
}

/* 知识内容可调节样式 */
#knowledgeContent {
    font-size: var(--content-font-size, 16px);
    line-height: var(--content-line-height, 1.8);
}

#knowledgeContent h3 {
    font-size: calc(var(--content-font-size, 16px) * 1.5);
    line-height: calc(var(--content-line-height, 1.8) * 0.9);
}

#knowledgeContent h4 {
    font-size: calc(var(--content-font-size, 16px) * 1.25);
    line-height: calc(var(--content-line-height, 1.8) * 0.95);
}

#knowledgeContent p, #knowledgeContent li {
    font-size: var(--content-font-size, 16px);
    line-height: var(--content-line-height, 1.8);
}

/* 分页容器 */
.page-container {
    position: relative;
    min-height: 400px;
}

.page-content {
    display: none;
}

.page-content.active {
    display: block;
}

/* 图文排版 */
.content-with-image {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    margin: 20px 0;
}

.content-with-image.text-left {
    flex-direction: row;
}

.content-with-image.text-right {
    flex-direction: row-reverse;
}

.content-with-image .text-part {
    flex: 1;
    min-width: 0;
}

.content-with-image .image-part {
    flex: 1;
    min-width: 0;
}

/* 窄屏适配 */
@media (max-width: 768px) {
    .content-with-image {
        flex-direction: column !important;
    }
    
    .content-with-image.text-top {
        flex-direction: column;
    }
    
    .content-with-image.text-bottom {
        flex-direction: column-reverse;
    }
}

/* 翻页按钮 */
.pagination-controls {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    align-items: center;
    background: var(--card-background);
    padding: 12px 24px;
    border-radius: 25px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 1000;
}

.pagination-controls button {
    padding: 8px 16px;
    border-radius: 20px;
    border: none;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.pagination-controls button:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.pagination-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-controls .page-info {
    font-size: 14px;
    min-width: 80px;
    text-align: center;
}

/* 语音控制面板 */
.voice-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 15px;
    padding: 15px;
    background: var(--hover-background);
    border-radius: 8px;
}

.voice-controls select {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--card-background);
    cursor: pointer;
}

.voice-controls label {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 排版控制 */
.layout-controls {
    margin: 15px 0;
    padding: 12px;
    background: var(--hover-background);
    border-radius: 8px;
}

.layout-controls label {
    margin-right: 20px;
}

/* 统计页面样式 */
.stats-dashboard {
    padding: 20px;
}

.stats-card {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.stats-card h3 {
    margin-top: 0;
    color: var(--primary-color);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.stat-item {
    background: var(--hover-background);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.stat-item .label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.stat-item .value {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
}

.subject-progress {
    margin: 15px 0;
}

.progress-item {
    margin-bottom: 15px;
    padding: 12px;
    background: var(--hover-background);
    border-radius: 8px;
}

.progress-item .name {
    font-weight: bold;
    margin-bottom: 8px;
}

.progress-bar {
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-bar .fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-dark));
    transition: width 0.3s;
}

.progress-bar .text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    color: white;
    font-weight: bold;
}