/*
 * 自测题库 - 样式表
 * 版本：V1.0
 * 配色方案：
 *   主色：#1f77b4 (RGB: 31, 119, 180)
 *   辅助色：#ff7f0e (RGB: 255, 127, 14)
 *   背景色：#fafafa (RGB: 250, 250, 250)
 *   文字色：#222222 (RGB: 34, 34, 34)
 */

/* ==================== 基础样式 ==================== */
:root {
    --primary-color: #1f77b4;
    --secondary-color: #ff7f0e;
    --background-color: #fafafa;
    --text-color: #222222;
    --text-light: #666666;
    --border-color: #e0e0e0;
    --success-color: #2ca02c;
    --error-color: #d62728;
    --warning-color: #ffbb78;
    --info-color: #17becf;
    --white: #ffffff;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 1em;
    line-height: 1.5;
    color: var(--text-color);
    background-color: var(--background-color);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ==================== 标题样式 ==================== */
h1, h2, h3, h4, h5, h6 {
    line-height: 1.5;
    margin-bottom: 1em;
}

h1 {
    font-size: 1.5em;
    font-weight: 600;
}

h2 {
    font-size: 1.25em;
    font-weight: 600;
}

h3 {
    font-size: 1.1em;
    font-weight: 600;
}

/* ==================== 按钮样式 ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 1em;
    font-weight: 500;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background-color: #1663a3;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--white);
}

.btn-secondary:hover {
    background-color: #e66c00;
}

.btn-link {
    background-color: transparent;
    color: var(--primary-color);
    padding: 5px 10px;
}

.btn-link:hover {
    background-color: rgba(31, 119, 180, 0.1);
    box-shadow: none;
}

.btn-block {
    width: 100%;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1.1em;
}

/* ==================== 表单样式 ==================== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"] {
    width: 100%;
    padding: 12px 16px;
    font-size: 1em;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--white);
    transition: var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(31, 119, 180, 0.1);
}

/* ==================== 文件上传样式 ==================== */
.file-input-wrapper {
    margin-bottom: 20px;
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.file-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.file-button {
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: var(--white);
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: var(--transition);
}

.file-button:hover {
    background-color: #1663a3;
}

.file-name {
    color: var(--text-light);
    font-size: 0.95em;
}

/* ==================== 提示消息样式 ==================== */
.flash-messages {
    margin-bottom: 20px;
}

.alert {
    padding: 12px 16px;
    border-radius: var(--border-radius);
    margin-bottom: 10px;
    font-size: 0.95em;
}

.alert-success {
    background-color: rgba(44, 160, 44, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(44, 160, 44, 0.3);
}

.alert-error {
    background-color: rgba(214, 39, 40, 0.1);
    color: var(--error-color);
    border: 1px solid rgba(214, 39, 40, 0.3);
}

.alert-warning {
    background-color: rgba(255, 187, 120, 0.2);
    color: #c77800;
    border: 1px solid rgba(255, 187, 120, 0.5);
}

.alert-info {
    background-color: rgba(23, 190, 207, 0.1);
    color: var(--info-color);
    border: 1px solid rgba(23, 190, 207, 0.3);
}

/* ==================== 登录页面样式 ==================== */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: var(--primary-color);
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-light);
    font-size: 0.95em;
}

.login-form {
    margin-bottom: 20px;
}

.login-footer {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.login-footer p {
    color: var(--text-light);
    font-size: 0.85em;
}

/* ==================== 页面头部样式 ==================== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.page-header h1 {
    margin-bottom: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info span {
    color: var(--text-light);
}

.quiz-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* ==================== 上传页面样式 ==================== */
.upload-container {
    display: flex;
    justify-content: center;
}

.upload-card {
    width: 100%;
    max-width: 600px;
    padding: 40px;
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.upload-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.upload-card h2 {
    text-align: center;
    margin-bottom: 10px;
}

.upload-desc {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 30px;
}

.upload-form {
    margin-bottom: 30px;
}

.format-hint {
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
}

.format-hint h3 {
    margin-bottom: 15px;
    font-size: 1em;
}

.format-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
}

.format-table th,
.format-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.format-table th {
    background-color: rgba(31, 119, 180, 0.05);
    font-weight: 600;
    color: var(--primary-color);
}

.format-table tr:hover {
    background-color: rgba(31, 119, 180, 0.02);
}

/* ==================== 答题页面样式 ==================== */
.quiz-container {
    max-width: 800px;
    margin: 0 auto;
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.questions-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.question-card {
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.question-header {
    padding: 15px 20px;
    background-color: rgba(31, 119, 180, 0.05);
    border-bottom: 1px solid var(--border-color);
}

.question-number {
    font-weight: 600;
    color: var(--primary-color);
}

.question-content {
    padding: 20px;
}

.question-text {
    font-size: 1.05em;
    margin-bottom: 20px;
    line-height: 1.6;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.option:hover {
    background-color: rgba(31, 119, 180, 0.05);
    border-color: var(--primary-color);
}

.option input[type="radio"] {
    margin-top: 2px;
    cursor: pointer;
}

.option-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background-color: var(--primary-color);
    color: var(--white);
    border-radius: 50%;
    font-size: 0.85em;
    font-weight: 600;
    flex-shrink: 0;
}

.option-text {
    flex: 1;
    line-height: 1.5;
}

.option:has(input:checked) {
    background-color: rgba(31, 119, 180, 0.1);
    border-color: var(--primary-color);
}

.quiz-actions {
    margin-top: 30px;
    text-align: center;
}

/* ==================== 结果模态框样式 ==================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    margin-bottom: 0;
    text-align: center;
}

.modal-body {
    padding: 30px 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    gap: 15px;
}

.score-display {
    text-align: center;
    margin-bottom: 30px;
}

.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), #1663a3);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
}

.score-circle span {
    font-size: 2em;
    font-weight: 700;
    color: var(--white);
}

.score-text {
    font-size: 1.1em;
    color: var(--text-light);
}

.score-text span {
    font-weight: 600;
    color: var(--primary-color);
}

.result-details {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.result-item {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
}

.result-item:last-child {
    border-bottom: none;
}

.result-item.correct {
    background-color: rgba(44, 160, 44, 0.05);
}

.result-item.incorrect {
    background-color: rgba(214, 39, 40, 0.05);
}

.result-question {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.result-number {
    font-weight: 600;
    color: var(--text-light);
}

.result-status {
    font-weight: 700;
}

.result-item.correct .result-status {
    color: var(--success-color);
}

.result-item.incorrect .result-status {
    color: var(--error-color);
}

.result-text {
    flex: 1;
    color: var(--text-color);
}

.result-answer {
    display: flex;
    gap: 20px;
    padding-left: 28px;
    font-size: 0.9em;
    color: var(--text-light);
}

/* ==================== 结果页面样式 ==================== */
.result-container {
    display: flex;
    justify-content: center;
    padding: 40px 20px;
}

.result-card {
    text-align: center;
}

.result-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

/* ==================== 错误页面样式 ==================== */
.error-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    padding: 20px;
}

.error-card {
    text-align: center;
}

.error-code {
    font-size: 6em;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 10px;
    line-height: 1;
}

.error-message {
    font-size: 1.2em;
    color: var(--text-light);
    margin-bottom: 30px;
}

/* ==================== 标签样式 ==================== */
.required-tag,
.optional-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.75em;
    font-weight: 500;
}

.required-tag {
    background-color: rgba(44, 160, 44, 0.1);
    color: var(--success-color);
}

.optional-tag {
    background-color: rgba(255, 127, 14, 0.1);
    color: var(--secondary-color);
}

/* ==================== 题目解析样式 ==================== */
.explanation-box {
    margin-top: 12px;
    padding: 12px 15px;
    background-color: rgba(31, 119, 180, 0.05);
    border-left: 3px solid var(--primary-color);
    border-radius: 0 4px 4px 0;
}

.explanation-label {
    font-size: 0.85em;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.explanation-text {
    font-size: 0.9em;
    color: var(--text-light);
    line-height: 1.5;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .login-card,
    .upload-card {
        padding: 30px 20px;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .quiz-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    .result-answer {
        flex-direction: column;
        gap: 5px;
    }
}