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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 页面切换 */
.page {
    display: none;
    width: 100%;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.page.active {
    display: block;
}

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

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 表单样式 */
.info-form {
    padding: 40px 30px;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
    font-size: 1rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 15px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #fff;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 按钮样式 */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 20px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

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

.btn-secondary {
    background: #f8f9fa;
    color: #6c757d;
    border: 2px solid #e9ecef;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #e9ecef;
    border-color: #dee2e6;
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 考试规则 */
.exam-rules {
    background: #f8f9fa;
    padding: 30px;
    border-top: 1px solid #e9ecef;
}

.exam-rules h3 {
    color: #495057;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.exam-rules ul {
    list-style: none;
}

.exam-rules li {
    padding: 8px 0;
    padding-left: 20px;
    position: relative;
    color: #6c757d;
    line-height: 1.5;
}

.exam-rules li:before {
    content: "•";
    color: #667eea;
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* 考试页面样式 */
.exam-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
}

.progress-bar {
    background: rgba(255, 255, 255, 0.2);
    height: 6px;
    border-radius: 3px;
    margin-bottom: 15px;
    overflow: hidden;
}

.progress {
    background: white;
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}

.exam-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1rem;
    flex-wrap: wrap;
    gap: 10px;
}

.completion-status {
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 8px;
    border-radius: 12px;
}

.question-type {
    background: #dc3545;  /* 红色背景 */
    color: white;
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

/* 题目容器 */
.question-container {
    padding: 40px 30px;
}

.question-text {
    font-size: 1.3rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 30px;
    line-height: 1.6;
}

/* 选项样式 */
.options {
    margin-bottom: 40px;
}

.option {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 15px 20px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    font-size: 1.1rem;
    user-select: none; /* 防止文本选择 */
}

.option:hover {
    border-color: #667eea;
    background: #f0f4ff;
    transform: translateX(2px); /* 轻微移动效果 */
}

.option:active {
    transform: translateX(1px) scale(0.98); /* 点击反馈 */
}

.option.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateX(2px);
}

.option input[type="radio"],
.option input[type="checkbox"] {
    margin-right: 12px;
    transform: scale(1.2);
    cursor: pointer;
}

.option label {
    cursor: pointer;
    flex: 1;
    margin: 0;
    line-height: 1.5;
}

/* 导航按钮 */
.navigation {
    display: flex;
    gap: 15px;
    justify-content: space-between;
}

.navigation .btn-primary,
.navigation .btn-secondary {
    flex: 1;
    margin-top: 0;
}

/* 结果页面 */
.result-container {
    padding: 40px 30px;
    text-align: center;
}

.result-header h2 {
    color: #333;
    font-size: 2rem;
    margin-bottom: 30px;
}

.score-display {
    margin: 40px 0;
}

.score-circle {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 3rem;
    font-weight: bold;
    margin: 0 auto;
    position: relative;
}

.score-circle small {
    font-size: 0.8rem;
    opacity: 0.9;
    margin-top: -5px;
}

.result-details {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    margin: 30px 0;
    text-align: left;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #e9ecef;
    font-size: 1.1rem;
}

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

.result-message {
    font-size: 1.2rem;
    font-weight: 600;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.result-message.pass {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.result-message.fail {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.result-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.result-actions .btn-primary,
.result-actions .btn-secondary {
    flex: 1;
    margin-top: 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header {
        padding: 30px 20px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .info-form,
    .question-container,
    .result-container {
        padding: 30px 20px;
    }
    
    .exam-header {
        padding: 15px 20px;
    }
    
    .question-text {
        font-size: 1.2rem;
    }
    
    .option {
        padding: 12px 15px;
        font-size: 1rem;
    }
    
    .navigation {
        flex-direction: column;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    .score-circle {
        width: 120px;
        height: 120px;
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.8rem;
    }
    
    .question-text {
        font-size: 1.1rem;
    }
    
    .option {
        font-size: 0.95rem;
    }
    
    .score-circle {
        width: 100px;
        height: 100px;
        font-size: 2rem;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page.active {
    animation: fadeIn 0.5s ease;
}

/* 加载状态 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 错题分析页面样式 */
.wrong-answers-container {
    padding: 30px;
    max-height: 80vh;
    overflow-y: auto;
}

.wrong-answers-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

.wrong-answers-header h2 {
    color: #dc3545;
    font-size: 1.5rem;
    margin: 0;
}

.wrong-summary {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    text-align: center;
}

.wrong-summary p {
    margin: 0;
    color: #856404;
    font-size: 1.1rem;
}

.wrong-item {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.wrong-item-header {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wrong-item-number {
    font-weight: bold;
    font-size: 1.1rem;
}

.wrong-item-type {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.9rem;
}

.wrong-item-score {
    font-weight: bold;
}

.wrong-item-question {
    padding: 15px 20px;
    font-size: 1.1rem;
    line-height: 1.6;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.wrong-item-options {
    padding: 15px 20px;
}

.wrong-option {
    padding: 10px 15px;
    margin: 5px 0;
    border-radius: 8px;
    border: 2px solid #e9ecef;
    background: #f8f9fa;
    font-size: 1rem;
}

.wrong-option.user-selected {
    border-color: #dc3545;
    background: #f8d7da;
    color: #721c24;
}

.wrong-option.correct-answer {
    border-color: #28a745;
    background: #d4edda;
    color: #155724;
}

.wrong-option.user-selected.correct-answer {
    border-color: #17a2b8;
    background: #d1ecf1;
    color: #0c5460;
}

.wrong-item-answers {
    padding: 15px 20px;
    background: #f8f9fa;
    display: flex;
    gap: 30px;
}

.user-answer, .correct-answer-info {
    flex: 1;
}

.answer-label {
    font-weight: 600;
    display: block;
    margin-bottom: 5px;
}

.answer-value {
    padding: 8px 12px;
    border-radius: 6px;
    font-weight: bold;
    display: inline-block;
    min-width: 80px;
    text-align: center;
}

.answer-value.wrong {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.answer-value.correct {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .wrong-answers-container {
        padding: 20px 15px;
    }
    
    .wrong-answers-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .wrong-item-header {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
    
    .wrong-item-answers {
        flex-direction: column;
        gap: 15px;
    }
    
    .wrong-item-question {
        padding: 12px 15px;
        font-size: 1rem;
    }
    
    .wrong-item-options {
        padding: 12px 15px;
    }
}
