/* ===== 智能题库 — 出题页样式 ===== */

.exercise-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 16px 64px;
}

.exercise-page { display: none; }
.exercise-page.active { display: block; }

/* ── 表单卡片 ── */
.exercise-form-card {
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 12px;
    padding: 24px;
}

.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}
.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}
.form-row-3col .form-group {
    flex: 1;
}

.form-divider {
    height: 1px;
    background: #e8eaed;
    margin: 16px 0;
}

.required { color: #c5221f; }

/* ── 知识点多选 ── */
.tag-select {
    position: relative;
}

.tag-select select[multiple] {
    display: none; /* 隐藏原生多选，用自定义替代 */
}

.multi-select-trigger {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dadce0;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    text-align: left;
    font-size: 0.9375rem;
    color: #5f6368;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.multi-select-trigger:hover {
    border-color: #1a73e8;
}

.multi-select-trigger::after {
    content: '▾';
    font-size: 0.75rem;
    color: #9aa0a6;
}

.multi-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    background: #fff;
    border: 1px solid #dadce0;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    max-height: 240px;
    overflow-y: auto;
    padding: 6px 0;
    display: none;
}

.multi-select-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 0.875rem;
    color: #1a2332;
    transition: background 0.1s;
}
.multi-select-item:hover { background: #f0f7ff; }
.multi-select-item input[type=checkbox] { width: 16px; height: 16px; accent-color: #1a73e8; }

.tag-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: #e8f0fe;
    color: #1a73e8;
    border-radius: 14px;
    font-size: 0.8125rem;
    font-weight: 500;
}
.tag-chip-remove {
    cursor: pointer;
    font-weight: 700;
    font-size: 0.9375rem;
    color: #5f6368;
    line-height: 1;
}
.tag-chip-remove:hover { color: #c5221f; }

/* ── LLM 入口 ── */
.llm-entry {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed #dadce0;
    display: flex;
    align-items: center;
    gap: 12px;
}
.llm-hint {
    font-size: 0.8125rem;
    color: #9aa0a6;
}

/* ── 组卷模式选择器 ── */
.mode-selector {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e8eaed;
}
.mode-selector-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #1a2332;
    margin-bottom: 10px;
}
.mode-selector-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 16px;
    border: 1.5px solid #e8eaed;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 90px;
    flex: 1;
}
.mode-btn:hover {
    border-color: #d4a373;
    background: #fefcf7;
    transform: translateY(-1px);
}
.mode-btn.active {
    border-color: #d4783c;
    background: linear-gradient(135deg, #fef9f4, #fff7ef);
    box-shadow: 0 2px 8px rgba(212, 120, 60, 0.12);
}
.mode-btn .mode-icon {
    font-size: 1.3rem;
    line-height: 1.2;
}
.mode-btn .mode-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: #1a2332;
    white-space: nowrap;
}
.mode-btn .mode-desc {
    font-size: 0.68rem;
    color: #9aa0a6;
    white-space: nowrap;
}
.mode-btn.active .mode-name {
    color: #d4783c;
}
.mode-btn.active .mode-desc {
    color: #d4783c;
}
.mode-hint {
    margin-top: 8px;
    font-size: 0.78rem;
    color: #9aa0a6;
    padding-left: 2px;
}

/* ── 折叠按钮 ── */
.mode-fold-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 10px 12px;
    border: 1.5px dashed #dadce0;
    border-radius: 10px;
    background: #fafbfc;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 70px;
    flex: 0 0 auto;
    color: #5f6368;
}
.mode-fold-btn:hover {
    border-color: #1a73e8;
    background: #f0f7ff;
    color: #1a73e8;
}
.mode-fold-btn.expanded {
    border-color: #d4783c;
    background: #fefcf7;
    color: #d4783c;
}
.mode-fold-btn .mode-fold-icon {
    font-size: 0.75rem;
    line-height: 1;
    transition: transform 0.2s ease;
}
.mode-fold-btn .mode-fold-label {
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}

/* ── 折叠区 ── */
.mode-fold-content {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.35s ease, opacity 0.3s ease, margin 0.3s ease;
    margin-top: 0;
}
.mode-fold-content.expanded {
    max-height: 200px;
    opacity: 1;
    margin-top: 8px;
}

/* ── 开发中按钮 ── */
.mode-btn-coming {
    opacity: 0.55;
    cursor: default;
    filter: grayscale(0.5);
}
.mode-btn-coming:hover {
    transform: none !important;
    border-color: #e8eaed !important;
    background: #fff !important;
}

/* ── Toast 提示 ── */
.mode-toast {
    margin-top: 6px;
    padding: 8px 14px;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 8px;
    font-size: 0.82rem;
    color: #b06000;
    text-align: center;
    transition: opacity 0.25s ease;
}
.mode-toast.hidden {
    display: none;
}

@media (max-width: 640px) {
    .mode-btn {
        min-width: 60px;
        padding: 8px 10px;
    }
    .mode-btn .mode-desc {
        display: none;
    }
    .mode-fold-btn {
        min-width: 50px;
        padding: 8px 8px;
    }
    .mode-fold-btn .mode-fold-label {
        font-size: 0.65rem;
    }
}

/* ── 结果页 ── */
.result-header {
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 16px;
}
.result-header h2 { font-size: 1.25rem; font-weight: 600; color: #1a2332; }
.result-meta {
    font-size: 0.875rem;
    color: #5f6368;
    margin: 6px 0 14px;
}
.result-actions {
    display: flex;
    gap: 10px;
}
.result-actions .btn { font-size: 0.875rem; }

.export-group {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}
.export-filename-input {
    width: 130px;
    padding: 6px 10px;
    border: 1px solid var(--gray-300, #dadce0);
    border-radius: 6px;
    font-size: 0.85rem;
    background: #fff;
    color: #1a2332;
    outline: none;
    transition: border-color 0.15s;
}
.export-filename-input:focus {
    border-color: #1a73e8;
}
.export-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #5f6368;
    display: block;
    margin-bottom: 2px;
    white-space: nowrap;
}
.export-mode-select {
    border: 1px solid var(--gray-300, #dadce0);
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 0.85rem;
    background: #fff;
    color: #1a2332;
    outline: none;
    cursor: pointer;
}

.result-stats {
    font-size: 0.875rem;
    color: #5f6368;
    margin-bottom: 16px;
    padding: 0 4px;
}
.stat-hit strong,
.stat-returned strong {
    color: #1a73e8;
}

/* ── 题目卡片（结果页） ── */
.exercise-question-card {
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 10px;
    padding: 18px 20px;
    margin-bottom: 10px;
    transition: box-shadow 0.15s;
}
.exercise-question-card:hover {
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}

.eq-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.eq-number {
    font-weight: 700;
    color: #1a2332;
    font-size: 0.9rem;
}
.eq-type {
    font-size: 0.78rem;
    padding: 1px 8px;
    border-radius: 10px;
    background: #f0f7ff;
    color: #1a73e8;
}
.eq-difficulty {
    font-size: 0.78rem;
    padding: 1px 8px;
    border-radius: 10px;
    font-weight: 500;
}
.diff-easy { background: #e6f4ea; color: #137333; }
.diff-medium { background: #fef7e0; color: #b06000; }
.diff-hard { background: #fce8e6; color: #c5221f; }
.diff-very-hard { background: #fce8e6; color: #c5221f; font-weight: 700; }

.q-topic-tag {
    font-size: 0.72rem;
    padding: 1px 8px;
    border-radius: 10px;
    background: #f8f9fa;
    color: #5f6368;
    border: 1px solid #e8eaed;
}

.eq-body {
    margin-bottom: 10px;
}
.eq-text {
    font-size: 0.9375rem;
    line-height: 1.7;
    color: #1a2332;
    white-space: pre-wrap;
    word-break: break-word;
}

.eq-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.eq-actions .btn-toggle {
    font-size: 0.78rem;
    padding: 3px 12px;
}

.eq-answer {
    margin-top: 10px;
    padding: 12px 14px;
    background: #f0f7ff;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #1a73e8;
    border: 1px solid #d2e3fc;
    white-space: pre-wrap;
}

.eq-explanation {
    margin-top: 8px;
    padding: 12px 14px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 0.875rem;
    line-height: 1.65;
    color: #1a2332;
    border: 1px solid #e8eaed;
    white-space: pre-wrap;
}

.eq-answer.hidden,
.eq-explanation.hidden {
    display: none;
}

/* ── 空状态 ── */
.empty-state {
    text-align: center;
    padding: 48px 16px;
    color: #9aa0a6;
    font-size: 0.9375rem;
}

/* ── 响应式 ── */
@media (max-width: 640px) {
    .form-row {
        flex-direction: column;
        gap: 12px;
    }
    .form-row-3col {
        flex-direction: column;
    }
    .exercise-form-card {
        padding: 16px;
    }
    .result-header {
        padding: 16px;
    }
}