/* AI 作文批改 — 独立样式，不与作业管理共用布局 */

#page-essay-correction {
  --ec-primary: #e63323;
  --ec-primary-light: #fde8e6;
  --ec-primary-border: #f2796b;
  --ec-text: #1f2937;
  --ec-text-secondary: #6b7280;
  --ec-border: #e5e7eb;
  --ec-bg: #f5f7fb;
  --ec-white: #fff;
  --ec-success: #e63323;
  --ec-warning: #c0271b;
  --ec-purple-dot: #e63323;
  background: var(--ec-bg);
  min-height: 100%;
}

#page-essay-correction .ec-page {
  padding: 20px 24px 32px;
}

#page-essay-correction .hidden {
  display: none !important;
}

/* ---------- 列表页 ---------- */
.ec-list-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.ec-page-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--ec-text);
  margin: 0;
}

.ec-list-top-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ec-select {
  height: 32px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--ec-border);
  border-radius: 6px;
  background: var(--ec-white);
  font-size: 13px;
  color: var(--ec-text);
  cursor: pointer;
}

.ec-select-sm {
  min-width: 140px;
}

.ec-list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.ec-time-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.ec-time-label {
  font-size: 14px;
  color: var(--ec-text-secondary);
  margin-right: 4px;
}

.ec-time-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ec-pill {
  height: 28px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  font-size: 13px;
  color: var(--ec-text-secondary);
  cursor: pointer;
}

.ec-pill:hover {
  color: var(--ec-primary);
}

.ec-pill.active {
  background: var(--ec-primary-light);
  color: var(--ec-primary);
  border-color: var(--ec-primary-border);
}

.ec-list-toolbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.ec-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: none;
  background: none;
  font-size: 14px;
  color: var(--ec-text-secondary);
  cursor: pointer;
}

.ec-link-btn:hover {
  color: var(--ec-primary);
}

.ec-btn-assign {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #e63323, #e63323);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(192,39,27, 0.35);
}

.ec-btn-assign:hover {
  filter: brightness(1.05);
}

.ec-table-panel {
  background: var(--ec-white);
  border-radius: 12px;
  border: 1px solid var(--ec-border);
  overflow: hidden;
}

.ec-table-wrap {
  overflow-x: auto;
}

.ec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.ec-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 500;
  color: var(--ec-text-secondary);
  background: #fafafa;
  border-bottom: 1px solid var(--ec-border);
  white-space: nowrap;
}

.ec-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--ec-border);
  color: var(--ec-text);
  vertical-align: middle;
}

.ec-table tbody tr:hover {
  background: #fafbff;
}

.ec-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.ec-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.ec-status-ai .ec-status-dot {
  background: var(--ec-purple-dot);
}

.ec-status-ai {
  color: var(--ec-purple-dot);
}

.ec-status-done .ec-status-dot {
  background: var(--ec-success);
}

.ec-status-done {
  color: var(--ec-success);
}

.ec-row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.ec-action-link {
  border: none;
  background: none;
  padding: 0;
  font-size: 13px;
  color: var(--ec-primary);
  cursor: pointer;
}

.ec-action-link:hover {
  text-decoration: underline;
}

.ec-action-btn {
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--ec-border);
  border-radius: 6px;
  background: var(--ec-white);
  font-size: 12px;
  color: var(--ec-text);
  cursor: pointer;
  white-space: nowrap;
}

.ec-action-btn:hover {
  border-color: var(--ec-primary-border);
  color: var(--ec-primary);
}

.ec-action-more {
  width: 28px;
  padding: 0;
}

.ec-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--ec-text-secondary);
}

.ec-pagination-controls {
  display: flex;
  gap: 4px;
}

.ec-page-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--ec-border);
  border-radius: 4px;
  background: var(--ec-white);
  cursor: pointer;
}

.ec-page-btn.active {
  background: var(--ec-primary);
  border-color: var(--ec-primary);
  color: #fff;
}

.ec-page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ---------- 布置写作任务 ---------- */
.ec-page-form {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 80px);
}

.ec-form-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.ec-back-link {
  border: none;
  background: none;
  font-size: 14px;
  color: var(--ec-text-secondary);
  cursor: pointer;
  padding: 0;
}

.ec-back-link:hover {
  color: var(--ec-primary);
}

.ec-form-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.ec-form-sheet {
  flex: 1;
  background: var(--ec-white);
  border-radius: 12px;
  padding: 24px 28px;
  border: 1px solid var(--ec-border);
}

.ec-form-block {
  margin-bottom: 28px;
}

.ec-form-block:last-child {
  margin-bottom: 0;
}

.ec-block-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 14px;
  padding-left: 10px;
  border-left: 3px solid var(--ec-primary);
}

.ec-required {
  color: #ef4444;
}

.ec-pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.ec-pill-option {
  position: relative;
  min-width: 100px;
  height: 40px;
  padding: 0 20px;
  border: 1px solid var(--ec-border);
  border-radius: 8px;
  background: #f9fafb;
  font-size: 14px;
  color: var(--ec-text);
  cursor: pointer;
}

.ec-pill-option.is-selected {
  border-color: var(--ec-primary);
  background: var(--ec-white);
  color: var(--ec-primary);
}

.ec-pill-option.is-selected::after {
  content: "✓";
  position: absolute;
  right: 4px;
  bottom: 2px;
  font-size: 10px;
  color: var(--ec-primary);
}

.ec-input-line {
  width: 100%;
  max-width: 480px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--ec-border);
  border-radius: 8px;
  font-size: 14px;
}

.ec-topic-tabs {
  display: flex;
  gap: 24px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--ec-border);
}

.ec-topic-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 0 10px;
  margin-bottom: -1px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  font-size: 14px;
  color: var(--ec-text-secondary);
  cursor: pointer;
}

.ec-topic-tab.active {
  color: var(--ec-primary);
  border-bottom-color: var(--ec-primary);
}

.ec-rubric-preview {
  padding: 14px 16px;
  background: #f3f4f6;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--ec-text);
}

.ec-rubric-preview-tall {
  margin-top: 12px;
  min-height: 120px;
}

.ec-upload-box {
  padding: 40px;
  border: 1px dashed var(--ec-border);
  border-radius: 8px;
  text-align: center;
}

.ec-upload-start {
  display: inline-block;
  margin-bottom: 12px;
  padding: 8px 20px;
  border: 1px solid var(--ec-primary);
  border-radius: 6px;
  background: var(--ec-white);
  color: var(--ec-primary);
  cursor: pointer;
}

.ec-upload-box p {
  margin: 4px 0;
  font-size: 12px;
  color: var(--ec-text-secondary);
}

.ec-standard-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.ec-btn-outline-green {
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--ec-primary);
  border-radius: 6px;
  background: var(--ec-white);
  color: var(--ec-primary);
  font-size: 13px;
  cursor: pointer;
}

.ec-standard-meta {
  font-size: 13px;
  color: var(--ec-text-secondary);
}

.ec-form-footer {
  display: flex;
  justify-content: flex-end;
  padding: 20px 0 0;
}

.ec-btn-submit {
  min-width: 120px;
  height: 40px;
  padding: 0 32px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #e63323, #e63323);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

/* ---------- 批改详情三栏 ---------- */
.ec-page-detail {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 56px);
  padding-bottom: 0;
}

.ec-detail-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.ec-detail-top .ec-page-title {
  flex: 1;
}

.ec-btn-save {
  height: 32px;
  padding: 0 16px;
  border: none;
  border-radius: 6px;
  background: linear-gradient(135deg, #e63323, #e63323);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}

.ec-detail-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  gap: 0;
  background: var(--ec-white);
  border-radius: 12px;
  border: 1px solid var(--ec-border);
  overflow: hidden;
}

.ec-student-col {
  width: 220px;
  flex-shrink: 0;
  border-right: 1px solid var(--ec-border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.ec-class-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--ec-border);
}

/* 设计稿：班级 Tab 无投影 */
.ec-class-tab {
  padding: 4px 8px;
  border: none;
  border-radius: 4px;
  background: transparent;
  font-size: 12px;
  color: var(--ec-text-secondary);
  cursor: pointer;
  box-shadow: none;
}

.ec-class-tab.active {
  background: var(--ec-primary-light);
  color: var(--ec-primary);
  font-weight: 500;
  box-shadow: none;
}

.ec-student-list {
  list-style: none;
  margin: 0;
  padding: 8px 0;
  overflow-y: auto;
  flex: 1;
}

.ec-student-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  cursor: pointer;
  border-left: 3px solid transparent;
}

.ec-student-item:hover {
  background: #fafafa;
}

.ec-student-item.is-active {
  background: var(--ec-primary-light);
  border-left-color: var(--ec-primary);
}

.ec-student-name {
  font-size: 14px;
  color: var(--ec-text);
}

.ec-student-meta {
  text-align: right;
}

.ec-student-tag {
  display: block;
  font-size: 11px;
  color: var(--ec-text-secondary);
}

.ec-student-score {
  font-size: 14px;
  font-weight: 600;
  color: var(--ec-primary);
}

.ec-essay-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--ec-border);
  background: #f8f9fc;
}

.ec-essay-topic {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  background: var(--ec-white);
  border-bottom: 1px solid var(--ec-border);
}

.ec-essay-toolbar {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  background: var(--ec-white);
  border-bottom: 1px solid var(--ec-border);
}

.ec-icon-tool {
  width: 28px;
  height: 28px;
  border: 1px solid var(--ec-border);
  border-radius: 4px;
  background: var(--ec-white);
  cursor: pointer;
}

.ec-essay-viewport {
  flex: 1;
  overflow: auto;
  padding: 16px;
}

.ec-essay-paper {
  min-height: 400px;
  background: #fffef8;
  border: 1px solid #e8e4d9;
  border-radius: 4px;
  padding: 24px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.ec-paper-placeholder {
  text-align: center;
  color: var(--ec-text-secondary);
  margin-top: 120px;
}

.ec-paper-hint {
  text-align: center;
  font-size: 12px;
  color: #9ca3af;
  margin-top: 16px;
}

.ec-feedback-col {
  width: 380px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--ec-white);
}

.ec-feedback-tabs {
  display: flex;
  padding: 12px 12px 0;
  gap: 8px;
  flex-shrink: 0;
}

/* 设计稿：总评/句子/润色 Tab 描边样式，无错误投影 */
.ec-feedback-tab {
  flex: 1;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--ec-border);
  border-radius: 6px 6px 0 0;
  background: #f9fafb;
  font-size: 13px;
  color: var(--ec-text-secondary);
  cursor: pointer;
  box-shadow: none;
}

.ec-feedback-tab.active {
  background: var(--ec-white);
  border-color: var(--ec-primary);
  color: var(--ec-primary);
  font-weight: 500;
  border-bottom-color: var(--ec-white);
  margin-bottom: -1px;
  z-index: 1;
  box-shadow: none;
}

.ec-feedback-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  border-top: 1px solid var(--ec-border);
}

/* 分数区：避免文字裁切 */
.ec-score-block {
  text-align: center;
  padding: 8px 0 16px;
  line-height: 1.2;
  overflow: visible;
}

.ec-score-main {
  display: inline-block;
  font-size: 36px;
  font-weight: 700;
  color: var(--ec-primary);
  line-height: 1.15;
  padding-bottom: 2px;
}

.ec-score-total {
  font-size: 14px;
  color: var(--ec-text-secondary);
}

/* 设计稿：反馈卡片背景为白色 */
.ec-card-white {
  background: var(--ec-white);
  border: 1px solid var(--ec-border);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
}

.ec-card-white h4 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
}

.ec-card-white p,
.ec-card-white li {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--ec-text);
}

.ec-deduct-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ec-deduct-list li {
  padding: 6px 0;
  border-bottom: 1px dashed var(--ec-border);
  font-size: 13px;
}

.ec-deduct-list li:last-child {
  border-bottom: none;
}

.ec-sentence-group {
  margin-bottom: 20px;
}

.ec-sentence-group h4 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 10px;
  padding-left: 8px;
  border-left: 3px solid var(--ec-primary);
}

.ec-sentence-item {
  background: var(--ec-white);
  border: 1px solid var(--ec-border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}

.ec-sentence-item .ec-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #e63323;
  color: #fff;
  font-size: 11px;
  margin-right: 6px;
}

.ec-sentence-item.ec-good .ec-num {
  background: #e63323;
}

.ec-polish-toggle {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 2px;
  background: #f3f4f6;
  border-radius: 20px;
}

.ec-polish-toggle button {
  height: 28px;
  padding: 0 16px;
  border: none;
  border-radius: 16px;
  background: transparent;
  font-size: 13px;
  color: var(--ec-text-secondary);
  cursor: pointer;
}

.ec-polish-toggle button.active {
  background: var(--ec-primary);
  color: #fff;
}

.ec-polish-essay {
  background: var(--ec-white);
  border: 1px solid var(--ec-border);
  border-radius: 8px;
  padding: 16px 20px;
  font-size: 14px;
  line-height: 1.9;
}

.ec-polish-essay h3 {
  text-align: center;
  font-size: 16px;
  margin: 0 0 16px;
}

.ec-highlight {
  background: linear-gradient(transparent 60%, rgba(242,121,107, 0.45) 60%);
  text-decoration: underline;
  text-decoration-color: #c0271b;
}

/* ---------- 流程弹层 ---------- */
.ec-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ec-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.ec-flow-dialog {
  position: relative;
  width: min(920px, 94vw);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--ec-white);
  border-radius: 16px;
  padding: 32px 40px 40px;
  text-align: center;
}

.ec-flow-close {
  position: absolute;
  top: 12px;
  right: 16px;
  border: none;
  background: none;
  font-size: 24px;
  color: #9ca3af;
  cursor: pointer;
}

.ec-flow-hero h2 {
  font-size: 22px;
  margin: 8px 0 0;
}

.ec-flow-sparkle {
  color: var(--ec-primary);
  font-size: 18px;
}

.ec-flow-steps {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 28px 0;
}

.ec-flow-step {
  width: 140px;
}

.ec-flow-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 8px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f8a99e, #e63323);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ec-flow-step strong {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
}

.ec-flow-step p {
  margin: 0;
  font-size: 11px;
  color: var(--ec-text-secondary);
  line-height: 1.4;
}

.ec-flow-arrow {
  color: #f5c6c0;
  font-size: 18px;
  margin-top: 20px;
}

.ec-flow-tip {
  color: var(--ec-text-secondary);
  font-size: 13px;
  margin-bottom: 16px;
}

.ec-flow-cta {
  margin: 0 auto;
}

@media (max-width: 1100px) {
  .ec-detail-layout {
    flex-direction: column;
    overflow: auto;
  }

  .ec-student-col,
  .ec-feedback-col {
    width: 100%;
    max-height: 200px;
  }

  .ec-essay-col {
    min-height: 320px;
  }
}
