/* =============================================================
   作者端 / 管理员端 通用后台样式（仅电脑）
   ============================================================= */

.dash-body {
  background: #f3f4f6;
  min-height: 100vh;
  font-family: var(--font-sans);
}

/* ---------- 顶部导航 ---------- */
.dash-header {
  height: 60px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.dash-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.dash-brand img { height: 32px; }
.dash-user { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-muted); }
.dash-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand-gradient); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
}

/* ---------- 整体布局 ---------- */
.dash-layout { display: flex; min-height: calc(100vh - 60px); }
.dash-side {
  width: 220px;
  background: #1F2937;
  color: #d1d5db;
  padding: 20px 0;
  flex-shrink: 0;
}
.dash-side-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 24px;
  color: #d1d5db;
  font-size: 14px;
  cursor: pointer;
  border: none;
  background: transparent;
  border-left: 3px solid transparent;
  transition: background 0.15s ease, color 0.15s ease;
}
.dash-side-item:hover { background: rgba(255,255,255,0.05); color: #fff; }
.dash-side-item.active {
  background: rgba(124,58,237,0.18);
  color: #fff;
  border-left-color: var(--brand);
}
.dash-content { flex: 1; padding: 24px; overflow-x: auto; }

/* ---------- 页面标题行 ---------- */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.page-head h2 { font-size: 20px; font-weight: 700; }

/* ---------- 编辑页：左右分栏 ---------- */
.editor-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.editor-left {
  width: 38%;
  min-width: 380px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 16px;
  position: sticky;
  top: 84px;
}
.editor-right {
  flex: 1;
  min-width: 0;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 20px;
}

/* 题目池 */
.question-pool { display: flex; flex-direction: column; gap: 10px; max-height: 60vh; overflow-y: auto; padding-bottom: 60px; }
.q-pool-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f5f3ef;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  cursor: pointer;
  min-height: 70px;
  border: 2px solid transparent;
  transition: border-color 0.15s ease;
}
.q-pool-item:hover { border-color: #ddd; }
.q-pool-item.active { border-color: var(--brand); background: #f5f0ff; }
.q-drag-handle { cursor: grab; color: #9CA3AF; font-size: 14px; letter-spacing: 1px; user-select: none; flex-shrink: 0; }
.q-drag-handle:active { cursor: grabbing; }
.q-num { font-weight: 700; color: var(--text-muted); font-size: 13px; flex-shrink: 0; }
.q-summary { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.q-edit-btn { color: var(--brand); font-size: 12px; flex-shrink: 0; }
.q-pool-add {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 14px 16px; background: #fff; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  color: var(--brand); font-weight: 600; border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.q-pool-add:hover { background: #fafbfc; }

/* 表单区域 */
.form-group { margin-bottom: 18px; }
.form-group > label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--text-dark); }
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; }

/* 折叠面板 */
.collapse {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  overflow: hidden;
}
.collapse-head {
  padding: 14px 18px;
  background: #fafbfc;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.collapse-head .arrow { transition: transform 0.2s ease; color: var(--text-muted); }
.collapse.open .collapse-head .arrow { transform: rotate(90deg); }
.collapse-body { padding: 16px 18px; display: none; }
.collapse.open .collapse-body { display: block; }

/* 选项行 */
.option-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  background: #fff;
}
.option-row .opt-label { font-weight: 700; color: var(--brand); width: 20px; text-align: center; }
.option-row .opt-text { flex: 1; }
.option-row .opt-del { color: var(--danger); cursor: pointer; font-size: 13px; background: none; border: none; }

/* 维度加分小标签 */
.score-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-left: 10px; }
.score-pill {
  font-size: 12px; padding: 2px 8px; border-radius: var(--radius-sm);
  background: #ede9fe; color: #6d28d9; display: inline-flex; align-items: center; gap: 6px;
}
.score-pill button { background: none; border: none; color: #6d28d9; cursor: pointer; font-weight: 700; }

/* 维度行 / 结果行 */
.dim-row, .result-row {
  display: flex; gap: 10px; align-items: center;
  padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 10px;
}
.dim-row .dim-key { width: 70px; }
.dim-row .dim-name { flex: 1; }
.dim-del, .result-del { color: var(--danger); cursor: pointer; font-size: 14px; }

.result-row-wrap { margin-bottom: 14px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); position: relative; }
.result-row-title { display: flex; gap: 10px; margin-bottom: 8px; }
.result-desc { margin-bottom: 8px; }
.condition-area { position: relative; }
.condition-insert { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.condition-insert button { font-size: 12px; }
.condition-insert .help { width: 100%; font-size: 11px; color: var(--text-disabled); }

/* 代码编辑器 */
.code-editor {
  width: 100%;
  height: 300px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  background: #1e1e2e;
  color: #e0def4;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px;
  resize: vertical;
  tab-size: 2;
  white-space: pre;
}
.vars-bar { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.vars-bar .hint { width: 100%; font-size: 11px; color: var(--text-disabled); }

/* 图片上传占位 */
.upload-box {
  width: 100%;
  height: 120px;
  display: flex; align-items: center; justify-content: center;
  border: 2px dashed var(--border); border-radius: var(--radius-md);
  color: var(--text-disabled); font-size: 13px; cursor: pointer;
  position: relative; overflow: hidden;
}
.upload-box img { width: 100%; height: 100%; object-fit: cover; }
.upload-remove {
  position: absolute; top: 6px; right: 6px;
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(0,0,0,0.5); color: #fff; border: none; cursor: pointer;
  display: none; align-items: center; justify-content: center; font-size: 14px;
}
.upload-box.has-image .upload-remove { display: flex; }

/* 空状态 */
.empty-state { padding: 60px 20px; }
