/* ===== 全局变量 ===== */
:root {
    --bg-primary: #f8f9fb;
    --bg-card: #ffffff;
    --bg-hover: #f0f4f8;
    --text-primary: #2c3e50;
    --text-secondary: #6c7a89;
    --text-light: #a0b0c0;
    --accent: #5b9bd5;
    --accent-light: #e8f1fc;
    --accent-hover: #4a8ac4;
    --success: #52c41a;
    --success-bg: #f0fff0;
    --danger: #e74c3c;
    --danger-bg: #fdf2f2;
    --warning: #f0ad4e;
    --warning-bg: #fffbeb;
    --border: #e8edf2;
    --shadow: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.1);
    --radius: 10px;
    --radius-sm: 6px;
    --transition: all 0.25s ease;
}
/* ===== 基础重置 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 14px;
}
/* ===== 导航栏 ===== */
.navbar {
    background: var(--bg-card);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    padding: 0 24px;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-brand {
    font-size: 18px;
    font-weight: 600;
    color: var(--accent);
    margin-right: 48px;
    white-space: nowrap;
}
.nav-menu {
    list-style: none;
    display: flex;
    gap: 4px;
}
.nav-item {
    padding: 8px 16px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: var(--transition);
    font-size: 14px;
    user-select: none;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--accent-light); color: var(--accent); font-weight: 500; }
/* ===== 主内容区 ===== */
.main-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px;
}
.view { display: none; }
.view.active { display: block; }
/* ===== 卡片 ===== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 16px;
    transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-lg); }
.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
/* ===== 按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
    font-family: inherit;
    white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-hover); color: var(--text-secondary); }
.btn-secondary:hover { background: #e0e8f0; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { opacity: 0.9; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
/* ===== 表单 ===== */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 13px;
}
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
    background: var(--bg-card);
    color: var(--text-primary);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}
.form-textarea { resize: vertical; min-height: 100px; }
/* ===== 题库列表 ===== */
.quiz-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.quiz-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}
.quiz-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.quiz-card-name { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.quiz-card-info { font-size: 12px; color: var(--text-light); display: flex; gap: 12px; }
.quiz-card-actions { margin-top: 12px; display: flex; gap: 8px; }
/* ===== 答题区域 ===== */
.question-block {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 16px;
}
.question-header {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 12px;
}
.question-type-tag {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}
.tag-choice { background: var(--accent-light); color: var(--accent); }
.tag-short { background: var(--warning-bg); color: var(--warning); }
.question-text { font-size: 15px; font-weight: 500; flex: 1; }
.question-options { margin-top: 12px; }
.option-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    cursor: pointer;
    transition: var(--transition);
}
.option-item:hover { background: var(--bg-hover); }
.option-item.selected { background: var(--accent-light); border-color: var(--accent); }
.option-item.correct { background: var(--success-bg); border-color: var(--success); }
.option-item.wrong { background: var(--danger-bg); border-color: var(--danger); }
.option-label { font-weight: 600; color: var(--accent); min-width: 20px; }
.option-text { flex: 1; }
/* ===== 评分结果 ===== */
.score-result {
    margin-top: 12px;
    padding: 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
}
.score-result.correct { background: var(--success-bg); }
.score-result.wrong { background: var(--danger-bg); }
.answer-analysis {
    margin-top: 8px;
    padding: 10px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
}
.ai-score-box {
    margin-top: 8px;
    padding: 12px;
    border-radius: var(--radius-sm);
    background: var(--accent-light);
    border: 1px solid var(--accent);
}
.ai-score-value { font-size: 20px; font-weight: 700; color: var(--accent); }
/* ===== 记录列表 ===== */
.record-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}
.record-item:hover { background: var(--bg-hover); }
.record-info { flex: 1; }
.record-name { font-weight: 500; }
.record-meta { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.record-score { font-size: 18px; font-weight: 700; color: var(--accent); }
/* ===== 模态框 ===== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 16px;
}
.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-light);
    transition: var(--transition);
}
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 20px; overflow-y: auto; }
/* ===== Toast提示 ===== */
.toast {
    position: fixed;
    top: 70px;
    right: 24px;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    opacity: 0;
    transform: translateX(100%);
    transition: var(--transition);
    font-size: 14px;
    max-width: 360px;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast.success { background: var(--success); color: #fff; }
.toast.error { background: var(--danger); color: #fff; }
.toast.info { background: var(--accent); color: #fff; }
/* ===== 工具样式 ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}
.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.flex-row { display: flex; gap: 12px; align-items: center; }
.flex-col { display: flex; flex-direction: column; gap: 12px; }
.flex-1 { flex: 1; }
.text-center { text-align: center; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-secondary { color: var(--text-secondary); }
.text-light { color: var(--text-light); }
.font-bold { font-weight: 600; }
.text-sm { font-size: 12px; }
.text-lg { font-size: 16px; }
.hidden { display: none !important; }
/* ===== 折叠面板 ===== */
.collapse-header {
    cursor: pointer;
    padding: 10px 14px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
    user-select: none;
}
.collapse-header:hover { background: var(--bg-hover); }
.collapse-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.collapse-content.open { max-height: 2000px; padding-top: 12px; }
/* ===== 复选框组 ===== */
.checkbox-group { display: flex; gap: 16px; flex-wrap: wrap; }
.checkbox-item {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.checkbox-item:hover { background: var(--bg-hover); }
.checkbox-item.checked { background: var(--accent-light); border-color: var(--accent); }
.checkbox-item input { accent-color: var(--accent); }
/* ===== 进度条 ===== */
.progress-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.3s ease;
}
/* ===== 加载动画 ===== */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .navbar { flex-direction: column; height: auto; padding: 12px; }
    .nav-menu { flex-wrap: wrap; justify-content: center; }
    .nav-brand { margin-right: 0; margin-bottom: 8px; }
    .quiz-grid { grid-template-columns: 1fr; }
}