/* 题库页面样式 */

/* 资源标签切换 */
.resource-tabs {
    padding: 32px 0 0;
    background: var(--bg-secondary);
}

.tabs-nav {
    display: flex;
    gap: 4px;
    background: white;
    padding: 6px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.tab-btn {
    flex: 1;
    padding: 14px 24px;
    border: none;
    background: transparent;
    border-radius: calc(var(--radius) - 4px);
    font-size: 15px;
    font-weight: 500;
    color: var(--text-light);
    cursor: pointer;
    transition: all var(--transition) ease;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--primary);
    background: var(--bg-secondary);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* 筛选区域 */
.quiz-filter {
    padding: 40px 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.filter-bar {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-size: 13px;
    color: var(--text-light);
    font-weight: 500;
}

.filter-group select {
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: white;
    min-width: 140px;
    cursor: pointer;
    transition: var(--transition);
}

.filter-group select:focus {
    outline: none;
    border-color: var(--accent);
}

/* 统计区域 */
.quiz-stats {
    padding: 32px 0;
    background: white;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.stat-card {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 16px 12px;
    text-align: center;
    transition: var(--transition);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.stat-card .stat-left { font-size: 28px; flex-shrink: 0; }
.stat-card .stat-right { text-align: left; }

.stat-icon {
    font-size: 0;
    display: none;
}

.stat-number {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary);
    margin: 0;
}

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

/* 答题区域 */
.quiz-area {
    padding: 60px 0;
    background: var(--bg-secondary);
    min-height: 600px;
}

.quiz-container {
    max-width: 800px;
    margin: 0 auto;
}

/* 进度条 */
.quiz-progress {
    background: white;
    border-radius: var(--radius);
    padding: 24px 32px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--text-light);
}

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

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

/* 题目卡片 */
.question-card {
    background: white;
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.question-number {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.question-type {
    font-size: 13px;
    padding: 6px 14px;
    background: rgba(230, 57, 70, 0.08);
    color: var(--accent);
    border-radius: 50px;
    font-weight: 600;
}

.question-content {
    font-size: 18px;
    line-height: 1.8;
    color: var(--text);
    margin-bottom: 32px;
}

/* 选项列表 */
.options-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    background: white;
}

.option-item:hover {
    border-color: var(--accent);
    background: rgba(230, 57, 70, 0.02);
}

.option-item.selected {
    border-color: var(--accent);
    background: rgba(230, 57, 70, 0.05);
}

.option-item.correct {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.05);
}

.option-item.wrong {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
}

.option-letter {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--text);
    flex-shrink: 0;
    transition: var(--transition);
}

.option-item.selected .option-letter {
    background: var(--accent);
    color: white;
}

.option-item.correct .option-letter {
    background: #10b981;
    color: white;
}

.option-item.wrong .option-letter {
    background: #ef4444;
    color: white;
}

.option-text {
    font-size: 16px;
    color: var(--text);
    flex: 1;
}

/* 答案反馈 */
.answer-feedback {
    margin-top: 24px;
    padding: 24px;
    border-radius: var(--radius-sm);
    animation: slideIn 0.3s ease;
}

.answer-feedback.correct {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.answer-feedback.wrong {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

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

.feedback-content {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.feedback-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.feedback-text {
    flex: 1;
}

.feedback-text strong {
    display: block;
    font-size: 16px;
    margin-bottom: 8px;
    color: var(--primary);
}

.feedback-text p {
    color: var(--text-light);
    margin-bottom: 12px;
}

.explanation {
    padding: 16px;
    background: white;
    border-radius: var(--radius-sm);
    font-size: 14px;
    line-height: 1.7;
    color: var(--text);
    border-left: 4px solid var(--accent);
}

/* 操作按钮 */
.quiz-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
}

.quiz-actions .btn {
    min-width: 140px;
}

/* 练习结果 */
.quiz-result {
    padding: 80px 0;
    background: var(--bg-secondary);
    min-height: 600px;
}

.result-card {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    border-radius: var(--radius);
    padding: 48px;
    box-shadow: var(--shadow);
    text-align: center;
}

.result-header {
    margin-bottom: 40px;
}

.result-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.result-header h2 {
    font-size: 32px;
    color: var(--primary);
    margin-bottom: 8px;
}

.result-header p {
    color: var(--text-light);
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 40px;
}

.result-item {
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.result-item.correct {
    background: rgba(16, 185, 129, 0.08);
}

.result-item.wrong {
    background: rgba(239, 68, 68, 0.08);
}

.result-item.score {
    background: rgba(230, 57, 70, 0.08);
}

.result-label {
    display: block;
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.result-value {
    display: block;
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
}

.result-item.correct .result-value {
    color: #10b981;
}

.result-item.wrong .result-value {
    color: #ef4444;
}

.result-item.score .result-value {
    color: var(--accent);
}

.result-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* 章节预览 */
.chapters-preview {
    padding: 56px 0;
    background: white;
}

.chapters-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.chapter-card {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 16px;
    text-align: left;
    flex: 0 1 calc(33.333% - 8px);
    min-width: 220px;
    max-width: 320px;
    box-sizing: border-box;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chapter-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--accent);
    background: white;
}

.chapter-card .card-top { display: flex; align-items: center; gap: 10px; }

.chapter-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.chapter-card h3 {
    font-size: 15px;
    color: var(--primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chapter-card p {
    font-size: 12px;
    color: var(--text-light);
    margin: 0;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.chapter-count {
    display: inline-block;
    padding: 2px 10px;
    background: rgba(230, 57, 70, 0.08);
    color: var(--accent);
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
}

/* 阅读文章区域 */
.reading-section {
    padding: 40px 0;
    background: var(--bg-secondary);
}

.reading-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.reading-filters .filter-btn {
    padding: 6px 16px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: white;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-light);
}

.reading-filters .filter-btn:hover,
.reading-filters .filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.reading-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.reading-card {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: var(--transition);
}

.reading-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.reading-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px 0;
}

.reading-header .level-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    background: rgba(243, 156, 18, 0.1);
    color: #f39c12;
}

.reading-header .category-tag {
    font-size: 12px;
    color: var(--text-light);
}

.reading-content {
    padding: 12px 16px 16px;
}

.reading-content h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    margin: 0 0 6px;
}

.reading-desc {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.5;
    margin: 0 0 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.reading-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 12px;
}

.reading-actions {
    display: flex;
    gap: 8px;
}

.reading-actions .btn {
    padding: 6px 14px;
    font-size: 13px;
}

/* 隐藏旧的 cover-icon 区域 */
.reading-cover { display: none; }

/* 响应式设计 */
@media (max-width: 1200px) {
    .chapter-card {
        flex: 0 1 calc(33.333% - 16px);
    }
}

@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .chapter-card {
        flex: 0 1 calc(50% - 12px);
    }
    
    .result-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .chapter-card {
        flex: 1 1 100%;
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-group select {
        width: 100%;
    }
    
    .question-card {
        padding: 24px;
    }
    
    .question-content {
        font-size: 16px;
    }
    
    .option-item {
        padding: 16px;
    }
    
    .quiz-actions {
        flex-direction: column;
    }
    
    .quiz-actions .btn {
        width: 100%;
    }
    
    
    .result-card {
        padding: 32px 24px;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    .result-actions .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 24px;
    }
    
    .result-stats {
        grid-template-columns: 1fr;
    }
}
