/* ================================================================
   题目组（分步骤题） —— 学生端样式
   风格延续 styles.css 里 .exercise-item / .q-option-item 等既有语言：
   同样的圆角(12px)、同样的边框色(#e2e8f0)、同样的强调色(--primary/--secondary)。
   ================================================================ */

.stepgroup-card {
    border-radius: 14px;
    padding: 18px 20px 16px;
    margin-bottom: 22px;
    border: 1px solid #e2e8f0;
    border-left: 6px solid var(--primary-light);
    background: #fafbfc;
    transition: var(--transition);
}
.stepgroup-card.stepgroup-done {
    border-left-color: #27ae60;
}

.stepgroup-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}
.stepgroup-title {
    font-weight: 700;
    color: var(--primary);
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.stepgroup-badge {
    font-size: 12px;
    background: var(--primary);
    color: #fff;
    padding: 2px 12px;
    border-radius: 20px;
    font-weight: 500;
    flex-shrink: 0;
}
.stepgroup-meta {
    font-size: 12px;
    color: var(--text-light);
}
.stepgroup-done-tag {
    color: #27ae60;
    font-weight: 600;
}

/* 顶部步骤进度点 */
.stepgroup-progress {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    padding: 0 2px;
}
.stepgroup-dot {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    background: #e2e8f0;
    color: var(--text-light);
}
.stepgroup-dot.dot-active {
    background: var(--accent-light);
    color: var(--primary);
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.18);
}
.stepgroup-dot.dot-done {
    background: #27ae60;
    color: #fff;
}
.stepgroup-dot.dot-locked {
    background: #edf1f5;
    color: #b7c0cc;
}
.stepgroup-line {
    flex: 1;
    height: 2px;
    background: #e2e8f0;
    margin: 0 4px;
    min-width: 12px;
}

.stepgroup-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 单个步骤：三种状态 —— 锁定 / 已完成折叠 / 当前展开 */
.step-item {
    border-radius: 10px;
    transition: var(--transition);
}

.step-locked {
    padding: 12px 14px;
    background: #f1f3f6;
    border: 1px dashed #d3dae3;
}
.step-locked-row {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #98a3b0;
    font-size: 13px;
}
.step-lock-icon {
    font-size: 14px;
}

.step-collapsed {
    padding: 10px 14px;
    background: #fff;
    border: 1px solid #e2e8f0;
    cursor: pointer;
}
.step-collapsed:hover {
    border-color: var(--accent-light);
}
.step-collapsed-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}
.step-done-icon {
    flex-shrink: 0;
}
.step-collapsed-title {
    color: var(--text);
    font-weight: 500;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.step-collapsed-summary {
    color: var(--text-light);
    font-size: 12px;
    flex-shrink: 0;
}
.step-collapsed-arrow {
    color: var(--text-light);
    flex-shrink: 0;
}
.step-review-body {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #e2e8f0;
    font-size: 13px;
    color: var(--text-light);
}
.step-review-body.hidden {
    display: none;
}
.step-answer-review {
    background: #f8fafc;
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text);
    white-space: pre-wrap;
}
.step-answer-feedback {
    margin-top: 6px;
    color: var(--text-light);
}

.step-current {
    padding: 16px 18px;
    background: #fff;
    border: 1px solid var(--accent-light);
    box-shadow: 0 2px 10px rgba(201, 168, 76, 0.08);
}
.step-current-title {
    font-weight: 600;
    color: var(--primary);
    font-size: 14px;
    margin-bottom: 6px;
}
.step-current .q-text {
    font-size: 14px;
    color: var(--text);
    margin-bottom: 12px;
}
.step-current textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 70px;
    transition: var(--transition);
    background: #fff;
}
.step-current textarea:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(44, 74, 122, 0.06);
    outline: none;
}
.step-current .feedback-box {
    margin-top: 12px;
    padding: 12px 16px;
    background: #eef6f3;
    border-radius: 10px;
    font-size: 14px;
    border-left: 3px solid var(--secondary);
    display: none;
}
/* "下一步 / 完成" 按钮靠右下角放置，符合"往下走"的方向直觉；
   题组最后一步文案是"✅ 完成"，其余步骤是"下一步 →" */
.step-next-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}
.step-next-btn {
    padding: 8px 26px;
    background: var(--primary-light);
    color: #fff;
    border: none;
    border-radius: 40px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}
.step-next-btn:hover:not(:disabled) {
    background: var(--primary);
    transform: scale(1.02);
}
.step-next-btn:disabled {
    background: #cbd3dc;
    cursor: not-allowed;
}

/* 回顾前置步骤的小方块（referencesSteps） */
.step-refs-box {
    background: #fff8e8;
    border: 1px solid var(--accent-light);
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 12px;
}
.step-refs-title {
    font-size: 12px;
    font-weight: 700;
    color: #a67c1e;
    margin-bottom: 6px;
}
.step-refs-item {
    font-size: 13px;
    color: var(--text);
    line-height: 1.7;
}
.step-refs-label {
    font-weight: 600;
    color: var(--primary);
}
.step-refs-snippet {
    color: var(--text-light);
}

/* AI对话步骤 */
.step-dialogue-box {
    max-height: 260px;
    overflow-y: auto;
    background: #f8fafc;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sd-empty {
    color: var(--text-light);
    font-size: 13px;
    text-align: center;
    padding: 10px 0;
}
.sd-msg {
    font-size: 13px;
    line-height: 1.6;
    padding: 8px 12px;
    border-radius: 10px;
    max-width: 88%;
}
.sd-msg.sd-ai {
    background: #fff;
    border: 1px solid #e2e8f0;
    align-self: flex-start;
}
.sd-msg.sd-user {
    background: var(--primary-light);
    color: #fff;
    align-self: flex-end;
}
.sd-msg .sd-role {
    display: block;
    font-size: 11px;
    font-weight: 700;
    opacity: 0.7;
    margin-bottom: 2px;
}
.sd-pending {
    opacity: 0.6;
}
.step-dialogue-review {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.step-dialogue-review .sd-msg {
    max-width: 100%;
}

.step-dialogue-input-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}
.step-dialogue-input-row input {
    flex: 1;
    padding: 8px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    font-size: 13px;
    font-family: inherit;
}
.step-dialogue-input-row input:focus {
    border-color: var(--primary-light);
    outline: none;
}
.step-dialogue-input-row button {
    padding: 8px 18px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
}
.step-dialogue-hint {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 4px;
}

/* 对话tab的未读红点——AI主动开口时不再强制切走学生所在的tab，
   只在这里留一个小红点提示，学生自己决定什么时候去看 */
.right-tabs button {
    position: relative;
}
.chat-tab-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: #e74c3c;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    border-radius: 8px;
    text-align: center;
}

/* AI对话步骤：学生"最终采纳说法"输入区 —— 视觉上和上方对话气泡区分开，
   用强调色边框标出这是需要学生自己下决定的关键动作，而不是随手一填 */
.step-final-choice-box {
    background: #fff8e8;
    border: 1px solid var(--accent);
    border-radius: 10px;
    padding: 10px 14px;
    margin: 10px 0;
}
.step-final-choice-title {
    font-size: 13px;
    font-weight: 700;
    color: #8a6416;
    margin-bottom: 4px;
}
.step-final-choice-hint {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 8px;
    line-height: 1.6;
}
.step-final-choice-box textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e2c98a;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 56px;
    background: #fff;
}
.step-final-choice-box textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.12);
    outline: none;
}
/* 折叠回看时展示的"你最终采纳的说法"，和上面对话气泡视觉呼应但单独标出 */
.sd-final-choice {
    margin-top: 4px;
    padding: 8px 12px;
    background: #fff8e8;
    border: 1px solid var(--accent-light);
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.6;
}
.sd-final-choice .sd-role {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #8a6416;
    margin-bottom: 2px;
}

/* "全部完成、AI综合评价中"提示条 —— 批量批改要跑几秒，需要一个明确的等待反馈 */
.task-evaluating-banner {
    background: #eef3fb;
    border: 1px solid var(--primary-light);
    border-radius: 10px;
    padding: 10px 16px;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--primary);
    font-weight: 600;
}

/* 批改完成后的整体评价总结条 */
.task-evaluation-summary {
    background: #eafaf1;
    border: 1px solid #27ae60;
    border-radius: 10px;
    padding: 10px 16px;
    margin-bottom: 16px;
    font-size: 13px;
    color: #1e8449;
    font-weight: 600;
}

/* 多个题组共存时，题组卡片之间的间距沿用 .stepgroup-card 自身的
   margin-bottom，这里不用额外加；仅在此说明，避免以后误加重复间距 */

/* 顶部"全部提交"按钮的禁用态——内容没填全时按钮可见但不可点，
   用明显的灰色 + 不可点光标，让"为什么点不动"一目了然 */
.exercise-submit-all:disabled {
    background: #cbd3dc;
    cursor: not-allowed;
    transform: none;
}
.exercise-submit-all:disabled:hover {
    background: #cbd3dc;
    transform: none;
}
/* 已经点过"全部提交"、答案已锁定后，顶部原按钮位置换成这个静态标签，
   不再是可交互的按钮 */
.exercise-submit-all-locked {
    padding: 10px 24px;
    background: #eafaf1;
    color: #1e8449;
    border-radius: 40px;
    font-size: 14px;
    font-weight: 600;
}

/* ================================================================
   题目组编辑器（教师端 · 新建/修改任务表单）
   ================================================================ */

.stepgroup-editor {
    background: #fffaf0;
    border: 1px solid var(--accent);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 14px;
}
.stepgroup-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.stepgroup-editor-badge {
    font-size: 13px;
    font-weight: 700;
    color: #8a6416;
}
.stepgroup-editor-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 10px 0;
}
.stepgroup-editor-addrow {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 4px;
}

/* 单个步骤编辑卡片——复用 .modal-box .question-group 的 .q-row 视觉语言，
   因为 AI对话步骤的表单不嵌套在 .question-group 里（避免和"这是一道
   普通题目"产生语义混淆），这里单独把同一套 .q-row 样式扩展过来 */
.step-editor-item {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 14px;
}
.step-editor-item .question-group {
    margin-bottom: 0;
    background: #f8fafc;
}
.step-editor-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.step-editor-type-badge {
    font-size: 12px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 20px;
}
.step-editor-type-badge.answer {
    background: #eef3fb;
    color: var(--primary);
}
.step-editor-type-badge.dialogue {
    background: #fff3d6;
    color: #8a6416;
}
.step-editor-item-actions {
    display: flex;
    gap: 4px;
}
.step-editor-item-actions button {
    width: 26px;
    height: 26px;
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-light);
    transition: var(--transition);
}
.step-editor-item-actions button:hover {
    border-color: var(--primary-light);
    color: var(--primary);
}
.step-editor-item-actions button.danger {
    color: #e74c3c;
}
.step-editor-item-actions button.danger:hover {
    border-color: #e74c3c;
    background: #fdedec;
}

/* AI对话步骤表单字段（.q-row 布局从 question-group 场景搬过来，因为这里
   不套在 .question-group 容器内） */
.step-editor-item .q-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.step-editor-item .q-row > div {
    flex: 1;
    min-width: 120px;
}
.step-editor-item .q-row label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
    display: block;
    margin-bottom: 4px;
}
.step-editor-item .q-row input,
.step-editor-item .q-row select,
.step-editor-item .q-row textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    background: #fff;
    font-family: inherit;
}
.step-editor-item .q-row textarea {
    min-height: 60px;
    resize: vertical;
}

/* "回顾前面哪些步骤"——横向chip标签，比原来纵向一行一个更紧凑，
   一眼能扫完所有可选步骤，点击整个标签即可切换选中，不用精确点在
   小小的checkbox上 */
.sd-refsteps-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}
.sd-refstep-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px 5px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    background: #fff;
    font-size: 12px;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}
.sd-refstep-chip:hover {
    border-color: var(--primary-light);
}
.sd-refstep-chip.checked {
    background: var(--primary-light);
    border-color: var(--primary-light);
    color: #fff;
    font-weight: 600;
}
/* checkbox 本身仍然是真实存在、功能完整的表单控件（收集逻辑靠它的
   checked状态），只是视觉上缩小藏在标签左侧，不做成不可见（accessibility：
   保留可被键盘tab到、可被屏幕阅读器识别） */
.sd-refstep-chip input[type="checkbox"] {
    width: 13px;
    height: 13px;
    margin: 0;
    cursor: pointer;
    accent-color: #fff;
}
.sd-refstep-chip-num {
    font-weight: 700;
    opacity: 0.7;
}

/* 文章库来源切换（单选） */
.article-source-toggle {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
.article-source-toggle label {
    font-size: 14px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-weight: 500;
}

/* "✨ 根据题干生成"按钮——教师端AI辅助生成开场白 */
.ai-gen-btn {
    padding: 5px 14px;
    border: 1px solid var(--accent);
    background: #fff8e8;
    color: #8a6416;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    white-space: nowrap;
}
.ai-gen-btn:hover:not(:disabled) {
    background: var(--accent-light);
}
.ai-gen-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* "主要考查素养"改用下拉菜单（.q-ability-select），复用 .question-group
   .q-row select 的通用表单样式，不需要额外定义——单选radio+chip标签的旧
   方案已弃用（曾经出现过"同一题4个选项name不互斥、能同时勾选"的问题，
   下拉菜单从控件层面就不存在这类互斥性bug，故换成下拉）。

   这里只需要给"AI推荐"按钮旁的提示文案定义样式。 */
.q-ability-suggest-hint {
    font-size: 12px;
    margin-top: 4px;
    display: none;
}

/* AI服务连通状态徽标（教师端头部）——三种故障态用不同颜色区分，
   让教师能一眼看出问题出在哪一步：红=后端完全连不上，黄=后端启动了
   但没配Key，绿=一切正常；检测中用中性灰蓝色，避免和三种结果色混淆 */
.ai-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    user-select: none;
}
.ai-status-badge:hover {
    transform: scale(1.03);
}
.ai-status-badge.ai-status-checking {
    background: #eef1f5;
    color: #64748b;
}
.ai-status-badge.ai-status-ok {
    background: #eafaf1;
    color: #1e8449;
}
.ai-status-badge.ai-status-warn {
    background: #fff8e1;
    color: #b8860b;
}
.ai-status-badge.ai-status-off {
    background: #fdedec;
    color: #c0392b;
}

/* 多篇对比阅读——教师端新建任务表单里勾选多篇文章。改成卡片网格样式
   （原来是竖排"圆点+一行标题"，信息单薄、纵向占地方还不好看）：
   每张卡片是一个可点击的整体，含小书本图标、标题、作者/文本类型副标题，
   选中态用主题色高亮背景+右上角勾选标记，一眼能看清选了哪几篇。 */
.article-multi-check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    max-height: 320px;
    overflow-y: auto;
    padding: 4px 2px;
    margin-top: 6px;
}
.article-multi-chip {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 12px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: var(--transition);
}
.article-multi-chip:hover {
    border-color: var(--primary-light);
}
.article-multi-chip.checked {
    border-color: var(--primary);
    background: #eef3fb;
}
.article-multi-chip input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.amc-check-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1.5px solid #cbd3dc;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: transparent;
    transition: var(--transition);
}
.article-multi-chip.checked .amc-check-icon {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}
.amc-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-right: 20px;
}
.amc-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
}
.amc-meta {
    font-size: 12px;
    color: var(--text-light);
}

