/* 心理学题库系统样式 */

/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Microsoft YaHei", sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* 主容器 */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px 20px;
    border-radius: 12px;
    margin-bottom: 30px;
    text-align: center;
}

.header h1 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 10px;
}

.header p {
    font-size: 14px;
    opacity: 0.9;
}

/* 分类卡片 */
.category-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.category-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #667eea;
}

/* 章节列表 */
.chapter-list {
    display: grid;
    gap: 12px;
}

.chapter-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.chapter-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.chapter-info {
    flex: 1;
}

.chapter-name {
    font-size: 15px;
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
}

.chapter-count {
    font-size: 13px;
    color: #6c757d;
}

.chapter-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chapter-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* 答题页面样式 */
.quiz-container {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
}

.quiz-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.quiz-progress {
    font-size: 14px;
    color: #667eea;
    font-weight: 500;
}

/* 题目样式 */
.question-section {
    margin-bottom: 30px;
}

.question-type {
    display: inline-block;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 12px;
    font-weight: 500;
}

.type-judge {
    background: #fff3cd;
    color: #856404;
}

.type-single {
    background: #d4edda;
    color: #155724;
}

.type-multiple {
    background: #cce5ff;
    color: #004085;
}

.type-essay {
    background: #f8d7da;
    color: #721c24;
}

.question-content {
    font-size: 16px;
    line-height: 1.8;
    color: #333;
    margin-bottom: 20px;
}

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

.option-item {
    display: flex;
    align-items: flex-start;
    padding: 14px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.option-item:hover {
    background: #e9ecef;
}

.option-item.selected {
    background: #e7f1ff;
    border-color: #667eea;
}

.option-item.correct {
    background: #d4edda;
    border-color: #28a745;
}

.option-item.wrong {
    background: #f8d7da;
    border-color: #dc3545;
}

.option-key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: white;
    border-radius: 50%;
    font-weight: 600;
    font-size: 14px;
    margin-right: 12px;
    border: 2px solid #dee2e6;
    flex-shrink: 0;
}

.option-item.selected .option-key {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.option-item.correct .option-key {
    background: #28a745;
    color: white;
    border-color: #28a745;
}

.option-item.wrong .option-key {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

.option-value {
    font-size: 15px;
    line-height: 1.6;
}

/* 判断题选项 */
.judge-options {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.judge-option {
    flex: 1;
    max-width: 200px;
    padding: 16px;
    text-align: center;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    font-size: 18px;
    font-weight: 600;
}

.judge-option:hover {
    background: #e9ecef;
}

.judge-option.selected {
    background: #e7f1ff;
    border-color: #667eea;
    color: #667eea;
}

.judge-option.correct {
    background: #d4edda;
    border-color: #28a745;
    color: #28a745;
}

.judge-option.wrong {
    background: #f8d7da;
    border-color: #dc3545;
    color: #dc3545;
}

/* 问答题样式 */
.essay-section {
    margin-top: 20px;
}

.essay-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.essay-reference {
    background: #f0f7ff;
    border-left: 4px solid #667eea;
    padding: 16px;
    border-radius: 0 8px 8px 0;
    margin-top: 16px;
}

.essay-reference-title {
    font-size: 14px;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 8px;
}

.essay-reference-content {
    font-size: 14px;
    line-height: 1.8;
    color: #333;
    white-space: pre-wrap;
}

/* 答案解析 */
.answer-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.answer-label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
}

.answer-result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.answer-result.correct {
    background: #d4edda;
    color: #155724;
}

.answer-result.wrong {
    background: #f8d7da;
    color: #721c24;
}

.answer-icon {
    font-size: 24px;
}

.answer-text {
    font-size: 15px;
    font-weight: 500;
}

.answer-detail {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 8px;
    margin-top: 12px;
}

.answer-detail-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.answer-detail-content {
    font-size: 14px;
    line-height: 1.8;
    color: #666;
}

/* 导航按钮 */
.quiz-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.nav-btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.nav-btn-prev {
    background: #f8f9fa;
    color: #333;
}

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

.nav-btn-next {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.nav-btn-next:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.nav-btn-submit {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.nav-btn-submit:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

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

/* 结果页面 */
.result-container {
    background: white;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

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

.result-title {
    font-size: 28px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
}

.result-score {
    font-size: 48px;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 8px;
}

.result-total {
    font-size: 16px;
    color: #666;
    margin-bottom: 30px;
}

.result-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 30px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 24px;
    font-weight: 600;
    color: #333;
}

.stat-label {
    font-size: 13px;
    color: #666;
    margin-top: 4px;
}

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

.result-btn {
    padding: 12px 32px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    text-decoration: none;
}

.result-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.result-btn-secondary {
    background: #f8f9fa;
    color: #333;
}

.result-btn:hover {
    transform: scale(1.05);
}

/* 返回按钮 */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #667eea;
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.back-btn:hover {
    color: #764ba2;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 错误状态 */
.error {
    text-align: center;
    padding: 60px 20px;
    color: #dc3545;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }

    .header {
        padding: 20px 16px;
        border-radius: 8px;
    }

    .header h1 {
        font-size: 22px;
    }

    .category-card {
        padding: 16px;
        border-radius: 8px;
    }

    .chapter-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .chapter-btn {
        width: 100%;
    }

    .quiz-container {
        padding: 16px;
    }

    .quiz-header {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }

    .question-content {
        font-size: 15px;
    }

    .judge-options {
        flex-direction: column;
    }

    .judge-option {
        max-width: 100%;
    }

    .quiz-nav {
        flex-direction: column;
        gap: 12px;
    }

    .nav-btn {
        width: 100%;
    }

    .result-container {
        padding: 24px 16px;
    }

    .result-score {
        font-size: 36px;
    }

    .result-stats {
        flex-direction: column;
        gap: 20px;
    }

    .result-actions {
        flex-direction: column;
    }

    .result-btn {
        width: 100%;
    }
}
