.collector-root {
  background: transparent;
  padding: 0;
  min-height: 0;
  color: var(--text-primary);
}
.collector-root * { box-sizing: border-box; }
.collector-container { max-width: 100%; margin: 0; }

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

/* Filter Bar Redesign */
.collector-root .filter-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
  background: var(--surface-color);
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.collector-root .filter-bar label {
  font-size: 14px;
  color: var(--text-primary);
  margin: 0;
  white-space: nowrap;
}

.collector-root .filter-bar select,
.collector-root .filter-bar input {
  padding: 4px 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 14px;
  height: 32px;
  background-color: var(--surface-color);
}

.collector-root .filter-bar input { width: 240px; }

/* Data List Redesign (Row Card as Table Row) */
.collector-root .row-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--surface-color);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.collector-root .row-card {
  background: var(--surface-color);
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  display: grid;
  grid-template-columns: 2fr 1fr 120px 180px; /* Adjust based on content */
  gap: 16px;
  align-items: center;
  transition: background-color 0.2s;
}

.collector-root .row-card:last-child {
  border-bottom: none;
}

.collector-root .row-card:hover {
  background-color: var(--bg-color);
}

.collector-root .row-header {
  display: contents; /* Flatten children into grid */
}

/* Column 1: Main Info (Topic, Prompt) */
.row-col-main {
  grid-column: 1 / 2;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}

.collector-root .row-topic {
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 20px;
  background: var(--bg-color);
  color: var(--text-secondary);
  width: fit-content;
}

.collector-root .row-preview {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Column 2: Stats */
.row-col-stats {
  grid-column: 2 / 3;
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  gap: 12px;
}

/* Column 3: Score */
.row-col-score {
  grid-column: 3 / 4;
}

/* Column 4: Actions */
.collector-root .row-actions {
  grid-column: 4 / 5;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.collector-root .row-actions button {
  background: none;
  border: none;
  color: var(--primary-color);
  font-size: 13px;
  padding: 0;
  cursor: pointer;
}

.collector-root .row-actions button:hover {
  text-decoration: underline;
}

.collector-root .row-actions button.btn-danger {
  color: var(--danger-color);
  background: none;
  border: none;
}

.collector-root .score-badge {
  display: inline-block;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 20px;
  font-weight: 500;
}
.collector-root .score-badge.score-5 { background: #E8FFEA; color: #00B42A; }
.collector-root .score-badge.score-4 { background: #E8FFEA; color: #00B42A; }
.collector-root .score-badge.score-3 { background: #FFF7E8; color: #FF7D00; }
.collector-root .score-badge.score-2 { background: #FFECE8; color: #F53F3F; }
.collector-root .score-badge.score-1 { background: #FFECE8; color: #F53F3F; }
.collector-root .score-badge.score-none { background: var(--bg-color); color: var(--text-secondary); }

.collector-root .empty-state { text-align: center; padding: 60px 20px; color: #888; }
.collector-root .empty-state p { margin-bottom: 20px; }

.collector-root .modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; overflow-y: auto; }
.collector-root .modal-overlay.active { display: flex; justify-content: center; align-items: flex-start; padding: 40px 20px; }
.collector-root .modal { background: white; border-radius: 8px; width: 100%; max-width: 700px; max-height: 90vh; overflow-y: auto; }
.collector-root .modal-header { padding: 16px 20px; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: white; z-index: 1; }
.collector-root .modal-header h2 { font-size: 18px; }
.collector-root .modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: #666; padding: 0; }
.collector-root .modal-body { padding: 20px; }
.collector-root .modal-footer { padding: 16px 20px; border-top: 1px solid #eee; display: flex; justify-content: flex-end; gap: 10px; position: sticky; bottom: 0; background: white; }
.collector-root .modal-large { max-width: 1100px; max-height: 95vh; }
.collector-root .modal-large .modal-body { max-height: calc(95vh - 140px); overflow-y: auto; }

.collector-root .form-group { margin-bottom: 16px; }
.collector-root .form-group label { display: block; margin-bottom: 6px; font-weight: 500; color: #333; }
.collector-root .form-group input,
.collector-root .form-group select,
.collector-root .form-group textarea { width: 100%; padding: 6px 12px; border: 1px solid #ddd; border-radius: 4px; font-size: 14px; line-height: 1.4; }
.collector-root .form-group select { padding-right: 28px; }
.collector-root .form-group textarea { min-height: 80px; resize: vertical; font-family: inherit; }
.collector-root .form-group input:focus,
.collector-root .form-group select:focus,
.collector-root .form-group textarea:focus { outline: none; border-color: #4a90d9; }
.collector-root .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.collector-root .required::after { content: ' *'; color: #dc3545; }

.collector-root .rubric-list { margin-top: 16px; }
.collector-root .rubric-item { background: #f8f9fa; border-radius: 6px; padding: 12px; margin-bottom: 10px; border-left: 3px solid #4a90d9; }
.collector-root .rubric-item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.collector-root .rubric-item-id { font-weight: 600; color: #4a90d9; }
.collector-root .rubric-item-criterion { color: #333; margin-bottom: 8px; }
.collector-root .rubric-item-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.collector-root .rubric-tag { font-size: 11px; padding: 2px 6px; border-radius: 3px; background: #e9ecef; color: #495057; }

.collector-root .markdown-body { font-size: 14px; line-height: 1.8; color: #333; }
.collector-root .markdown-body h1,
.collector-root .markdown-body h2,
.collector-root .markdown-body h3 { margin-top: 1.2em; margin-bottom: 0.6em; font-weight: 600; }
.collector-root .markdown-body pre { background: #f6f8fa; border-radius: 6px; padding: 16px; overflow-x: auto; margin: 1em 0; }
.collector-root .markdown-body code { background: #f0f0f0; padding: 2px 6px; border-radius: 4px; font-family: 'Consolas', 'Monaco', monospace; font-size: 0.9em; }
.collector-root .markdown-body pre code { background: transparent; padding: 0; }
.collector-root .markdown-body blockquote { border-left: 4px solid #4a90d9; padding-left: 16px; color: #666; margin: 1em 0; background: #f9f9f9; padding: 12px 16px; border-radius: 0 6px 6px 0; }
.collector-root .markdown-body table { border-collapse: collapse; width: 100%; margin: 1em 0; }
.collector-root .markdown-body th,
.collector-root .markdown-body td { border: 1px solid #ddd; padding: 10px 14px; text-align: left; }
.collector-root .markdown-body th { background: #f5f5f5; font-weight: 600; }

.collector-root .detail-section { margin-bottom: 24px; }
.collector-root .detail-section-title { font-size: 14px; font-weight: 600; color: #666; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.collector-root .detail-section-title::after { content: ''; flex: 1; height: 1px; background: #e5e5e5; }
.collector-root .detail-card { background: #f8f9fa; border-radius: 8px; padding: 16px; border-left: 4px solid #4a90d9; }
.collector-root .detail-card.prompt-card { border-left-color: #8b5cf6; }

/* Judge 结果展示 */
.judge-result-meta {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  color: #334155;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.judge-result-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.judge-result-card {
  border-radius: 10px;
  padding: 12px 14px;
  border-left: 4px solid transparent;
}
.judge-result-card.judge-yes {
  background: #ecfdf3;
  border-left-color: #16a34a;
}
.judge-result-card.judge-no {
  background: #fef2f2;
  border-left-color: #ef4444;
}
.judge-result-card.judge-partial {
  background: #fff7ed;
  border-left-color: #f59e0b;
}
.judge-result-card.judge-unknown {
  background: #f8fafc;
  border-left-color: #94a3b8;
}
.judge-result-tags {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.judge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.judge-pill.judge-yes {
  background: #dcfce7;
  color: #15803d;
}
.judge-pill.judge-no {
  background: #fee2e2;
  color: #b91c1c;
}
.judge-pill.judge-partial {
  background: #fef3c7;
  color: #b45309;
}
.judge-pill.judge-unknown {
  background: #e2e8f0;
  color: #475569;
}
.judge-pill.meta {
  background: #e2e8f0;
  color: #334155;
  font-weight: 500;
}
.judge-result-criterion {
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 6px;
}
.judge-result-analysis {
  font-size: 13px;
  color: #334155;
  line-height: 1.6;
  white-space: pre-wrap;
}
.collector-root .detail-card.rubric-card { border-left-color: #10b981; }
.collector-root .detail-card.response-card { border-left-color: #f59e0b; }

.collector-root .response-list { display: flex; flex-direction: column; gap: 16px; }
.collector-root .response-item { background: white; border: 1px solid #e5e5e5; border-radius: 8px; overflow: hidden; }
.collector-root .response-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: #fafafa; border-bottom: 1px solid #e5e5e5; }
.collector-root .response-model { font-weight: 600; color: #333; display: flex; align-items: center; gap: 8px; }
.collector-root .response-model-tag { background: #e0f2fe; color: #0369a1; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 500; }
.collector-root .response-content { padding: 16px; }
.collector-root .response-actions { display: flex; gap: 6px; }
.collector-root .detail-copy-btn {
  padding: 4px 10px;
  font-size: 12px;
  background: transparent;
  border: none; /* Changed from 1px solid transparent */
  border-radius: 4px;
  cursor: pointer;
  color: #666;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.collector-root .detail-copy-btn:hover {
  background: #f3f4f6;
  color: var(--primary-color);
}

.collector-root .detail-copy-btn:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

/* Loading Button Styles */
.btn-loading {
  position: relative;
  pointer-events: none;
  padding-left: 28px !important; /* Make space for spinner */
}

.btn-loading::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  top: 50%;
  left: 8px; /* Position to left */
  margin-top: -7px;
  border: 2px solid #6b7280;
  border-top-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.8s linear infinite;
}

@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

.collector-root .response-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.collector-root .response-form-actions {
  display: flex;
  gap: 8px;
}
.collector-root .response-form-compact {
  margin-bottom: 8px;
}

/* Response Tabs 样式 */
.response-tabs {
  display: flex;
  gap: 4px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 8px;
  overflow-x: auto;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
}

.response-tabs::-webkit-scrollbar {
  height: 4px;
}

.response-tabs::-webkit-scrollbar-track {
  background: transparent;
}

.response-tabs::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 2px;
}

.response-tab {
  flex-shrink: 0;
  padding: 8px 14px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.response-tab:hover {
  background: rgba(255, 255, 255, 0.6);
  color: #334155;
}

.response-tab.active {
  background: #fff;
  color: #1e293b;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.response-tab-more {
  flex-shrink: 0;
  position: relative;
}

.response-tab-more select {
  padding: 8px 28px 8px 12px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s;
  min-width: 100px;
  height: auto;
}

.response-tab-more select:hover {
  background: rgba(255, 255, 255, 0.6);
  color: #334155;
}

.response-tab-more.active select {
  background: #fff;
  color: #1e293b;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.collector-root .detail-nav { display: flex; gap: 4px; margin-top: 0; margin-bottom: 20px; background: #f0f0f0; padding: 4px; border-radius: 8px; position: sticky; top: 0; z-index: 10; }
.collector-root .detail-nav-btn { padding: 10px 20px; border: none; background: transparent; cursor: pointer; border-radius: 6px; font-size: 14px; font-weight: 500; color: #666; transition: all 0.2s; }
.collector-root .detail-nav-btn:hover { color: #333; background: rgba(255,255,255,0.5); }

/* 全局 Toast 样式（元素已移到 body 末尾） */
#collectorToast { 
  position: fixed; 
  bottom: 20px; 
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937; 
  color: white; 
  padding: 12px 24px; 
  border-radius: 8px; 
  font-size: 14px;
  z-index: 99999;  /* 确保在所有弹窗之上 */
  opacity: 0; 
  pointer-events: none;
  transition: opacity 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
#collectorToast.show { 
  opacity: 1; 
  pointer-events: auto;
}

/* Full Page Editor Styles */
.edit-page {
  background: var(--bg-color);
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.edit-page-header {
  height: 56px;
  background: var(--surface-color);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
}

.edit-page-header .header-left,
.edit-page-header .header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.edit-page-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

.edit-card {
  background: var(--surface-color);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.edit-card .card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.edit-card .form-group {
  margin-bottom: 20px;
}

.edit-card .form-group:last-child {
  margin-bottom: 0;
}

.edit-card label {
  font-weight: 500;
  margin-bottom: 8px;
}

.edit-card .required::after {
  content: " *";
  color: var(--danger-color);
}

/* Rubric Styles in Editor */
.rubric-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

#collectorInlineRubricList {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Ensure form grids work inside edit card */
.edit-card .form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

/* ==================== Detail Page Styles ==================== */
.detail-page {
  background: #f5f7fa; /* 浅灰背景 */
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.detail-page-header {
  height: 56px;
  background: var(--surface-color);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
}

.detail-page-header .header-left,
.detail-page-header .header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.detail-page-tabs {
  display: flex;
  gap: 0;
  background: var(--surface-color);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  flex-shrink: 0;
}

.detail-tab {
  padding: 12px 20px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.detail-tab:hover {
  color: var(--text-primary);
}

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

.detail-tab-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.detail-tab-content:not(.active) {
  display: none;
}

.detail-page-content {
  flex: 1;
  overflow-y: auto;
  padding: 32px 24px;
  max-width: 1400px; /* 增加宽度 */
  margin: 0 auto;
  width: 100%;
}

/* Header Area */
.detail-header-area {
  margin-bottom: 24px;
  text-align: left; /* 改为左对齐 */
}

.detail-title {
  display: none; /* 隐藏标题 */
}

.detail-meta-tags {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-meta-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: #e5e7eb;
  color: #374151;
}

.detail-meta-tag.topic {
  background: #e0f2fe;
  color: #0369a1;
}

.detail-meta-tag.owner {
  background: #f3f4f6;
  color: #4b5563;
}

.detail-meta-tag.time {
  background: transparent;
  color: #9ca3af;
  padding: 4px 0;
}

/* Info Cell Styles */
.info-cell {
  background: #f9fafb;
  border-radius: 8px;
  padding: 12px 16px;
  border: 1px solid #f3f4f6;
}

.info-cell label {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
  display: block;
  font-weight: 500;
}

.view-field-value {
  font-size: 14px;
  color: #111827;
  font-weight: 500;
  min-height: 20px;
}

/* Rubric Card Styles */
.rubric-item-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.rubric-item-card:hover {
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  border-color: #d1d5db;
}

.rubric-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.rubric-card-id {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  background: #f3f4f6;
  padding: 2px 8px;
  border-radius: 4px;
}

.rubric-card-content {
  font-size: 15px;
  color: #1f2937;
  line-height: 1.6;
  margin-bottom: 12px;
}

.rubric-card-footer {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.rubric-pill {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 500;
}

.rubric-pill.type { background: #eff6ff; color: #1d4ed8; }
.rubric-pill.necessity { background: #f0fdf4; color: #15803d; }
.rubric-pill.priority { background: #fef2f2; color: #b91c1c; }
.rubric-pill.dimension { background: #fdf4ff; color: #86198f; }

/* Detail Card Block Padding Adjustment */
.detail-block-content {
  padding: 20px 24px;
}
.detail-content-flow {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.detail-card-block {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
  border: 1px solid #e5e7eb;
  overflow: hidden;
}

.detail-block-header {
  padding: 16px 24px;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
}

.detail-block-title {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-block-content {
  padding: 24px;
}

/* Override existing detail-card styles within block content */
.detail-block-content .detail-card {
  border: none;
  background: transparent;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
}

.detail-block-content .markdown-body {
  font-size: 15px;
  line-height: 1.7;
  color: #374151;
}

/* 题目详情页表格样式 */
.detail-block-content table,
.markdown-body table,
.prose-content table {
  display: table;
  width: 100%;
  border-collapse: collapse;
  margin: 0.8em 0;
  font-size: 14px;
}

.detail-block-content table th,
.detail-block-content table td,
.markdown-body table th,
.markdown-body table td,
.prose-content table th,
.prose-content table td {
  border: 1px solid #e5e7eb;
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
  line-height: 1.6;
}

.detail-block-content table th,
.markdown-body table th,
.prose-content table th {
  background: #f1f5f9;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
}

.detail-block-content table tr:nth-child(even),
.markdown-body table tr:nth-child(even),
.prose-content table tr:nth-child(even) {
  background: #fafbfc;
}

.detail-block-content table tr:hover,
.markdown-body table tr:hover,
.prose-content table tr:hover {
  background: #f8fafc;
}
