/**
 * QA Smart Panel CSS — 完整样式
 * 覆盖：模式选择 / 领域选 / 进度 / 评分卡 / Tab栏 /
 *       问题明细 / 审校详情 / 术语表 / 学习历史 / 段内高亮 / 闪烁动画
 *
 * Teal 主题 + Dark 模式全覆盖
 */

/* ========== 右侧非模态抽屉 ========== */
#qa-smart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  height: 100vh;
  z-index: 100010;
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.18);
  animation: qaDrawerSlideIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
[data-theme="dark"] #qa-smart-drawer { background: #1e293b; color: #e2e8f0; }

@keyframes qaDrawerSlideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes qaDrawerSlideOut {
  from { transform: translateX(0);    opacity: 1; }
  to   { transform: translateX(100%); opacity: 0; }
}
#qa-smart-drawer.qa-drawer-closing {
  animation: qaDrawerSlideOut 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.qa-smart-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: linear-gradient(135deg, #0D9488, #0F766E);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  flex-shrink: 0;
}
.qa-smart-header-actions { display: flex; gap: 8px; }
.qa-smart-close, .qa-smart-export {
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.15s;
  padding: 2px 4px;
}
.qa-smart-close:hover, .qa-smart-export:hover { opacity: 1; }

.qa-smart-dialog-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

/* ========== 面板控件 ========== */
.qa-smart-panel { display: flex; flex-direction: column; gap: 14px; }

/* 模式选择器 */
.qa-mode-selector { display: flex; gap: 6px; background: #f1f5f9; border-radius: 12px; padding: 3px; }
[data-theme="dark"] .qa-mode-selector { background: #334155; }

.qa-mode-btn {
  flex: 1; padding: 9px 6px; border: none; border-radius: 10px;
  background: transparent; cursor: pointer; font-size: 13px;
  font-weight: 500; color: #64748b; transition: all 0.2s;
}
.qa-mode-btn:hover { background: rgba(13,148,136,0.1); color: #0D9488; }
.qa-mode-btn.active { background: #0D9488; color: #fff; box-shadow: 0 2px 8px rgba(13,148,136,0.3); }

/* 分类筛选行（领域 + 分类并排） */
.qa-filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.qa-filter-row .qa-domain-row,
.qa-category-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.qa-filter-row .qa-domain-row label,
.qa-category-row label {
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
[data-theme="dark"] .qa-filter-row .qa-domain-row label,
[data-theme="dark"] .qa-category-row label { color: #94a3b8; }
.qa-filter-row .qa-domain-row select,
.qa-category-row select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 12px;
  background: #fff;
  cursor: pointer;
}
[data-theme="dark"] .qa-filter-row .qa-domain-row select,
[data-theme="dark"] .qa-category-row select { background: #334155; border-color: #475569; color: #e2e8f0; }

/* 可点击行 — 鼠标指针 */
.qa-clickable-row { cursor: pointer; }

/* 运行按钮 */
.qa-run-btn {
  width: 100%; padding: 11px; background: linear-gradient(135deg, #0D9488, #0F766E);
  color: #fff; border: none; border-radius: 10px; font-size: 14px;
  font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.qa-run-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(13,148,136,0.4); }
.qa-run-btn:disabled { opacity: 0.6; cursor: wait; }

/* 进度条 */
.qa-progress { display: flex; flex-direction: column; gap: 5px; }
.qa-progress-bar { height: 5px; background: #e2e8f0; border-radius: 3px; overflow: hidden; }
[data-theme="dark"] .qa-progress-bar { background: #334155; }
.qa-progress-fill { height: 100%; background: linear-gradient(90deg, #0D9488, #10b981); border-radius: 3px; transition: width 0.3s; }
.qa-progress-text { font-size: 11px; color: #64748b; text-align: center; }

/* ========== Tab 栏 ========== */
.qa-result-tabs {
  display: flex; gap: 2px; margin-bottom: 12px;
  border-bottom: 1px solid #e2e8f0; padding-bottom: 0;
}
[data-theme="dark"] .qa-result-tabs { border-bottom-color: #475569; }

.qa-result-tab {
  padding: 8px 12px; border: none; background: transparent; cursor: pointer;
  font-size: 12px; font-weight: 500; color: #64748b;
  border-bottom: 2px solid transparent; transition: all 0.15s;
  position: relative;
}
.qa-result-tab:hover { color: #0D9488; }
.qa-result-tab.active { color: #0D9488; border-bottom-color: #0D9488; }
.qa-tab-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px; padding: 0 4px; margin-left: 4px;
  background: #ef4444; color: #fff; border-radius: 8px; font-size: 10px; font-weight: 600;
}

/* ========== 概览 ========== */
.qa-score-card {
  text-align: center; padding: 16px; border-radius: 12px; margin-bottom: 10px;
  background: linear-gradient(135deg, #f0fdfa, #ccfbf1);
}
[data-theme="dark"] .qa-score-card { background: linear-gradient(135deg, #134e4a, #0f3d3a); }
.qa-score-grade { font-size: 44px; font-weight: 800; line-height: 1; }
.qa-score-value { font-size: 13px; color: #475569; margin-top: 3px; }
[data-theme="dark"] .qa-score-value { color: #94a3b8; }
.qa-score-dims { margin-top: 10px; display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.qa-dim-tag { font-size: 11px; padding: 2px 8px; background: rgba(13,148,136,0.15); border-radius: 10px; color: #0D9488; }
[data-theme="dark"] .qa-dim-tag { background: rgba(13,148,136,0.3); color: #5eead4; }

.qa-summary-cards { display: flex; gap: 8px; }
.qa-summary-card {
  flex: 1; text-align: center; padding: 10px 6px; border-radius: 10px; background: #f1f5f9;
}
[data-theme="dark"] .qa-summary-card { background: #334155; }
.qa-summary-card.qa-error { border-left: 3px solid #ef4444; }
.qa-summary-card.qa-warning { border-left: 3px solid #f59e0b; }
.qa-summary-card.qa-info { border-left: 3px solid #3b82f6; }
.qa-card-num { display: block; font-size: 22px; font-weight: 700; color: #1e293b; }
[data-theme="dark"] .qa-card-num { color: #e2e8f0; }
.qa-card-label { font-size: 11px; color: #64748b; }

.qa-detail-hint { font-size: 11px; color: #94a3b8; text-align: center; margin-top: 6px; }
.qa-empty-state { text-align: center; padding: 32px 16px; color: #94a3b8; font-size: 14px; }
.qa-error-msg { color: #ef4444; text-align: center; padding: 20px; font-size: 14px; }
.qa-loading { text-align: center; padding: 20px; color: #64748b; }

/* ========== 问题明细列表（G1） ========== */
.qa-issues-header { font-size: 12px; font-weight: 600; color: #64748b; margin-bottom: 8px; }
.qa-issues-list { max-height: 360px; overflow-y: auto; }

.qa-issue-row {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px;
  border-bottom: 1px solid #f1f5f9; cursor: pointer; transition: background 0.15s;
  font-size: 12px;
}
[data-theme="dark"] .qa-issue-row { border-bottom-color: #334155; }
.qa-issue-row:hover { background: #f8fafc; }
[data-theme="dark"] .qa-issue-row:hover { background: #334155; }
.qa-issue-row.qa-dismissed { opacity: 0.3; text-decoration: line-through; }

.qa-issue-seg { font-weight: 600; color: #475569; min-width: 32px; }
.qa-issue-sev { font-size: 10px; }
.qa-issue-cat { font-size: 12px; }
.qa-issue-msg { flex: 1; color: #334155; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-theme="dark"] .qa-issue-msg { color: #e2e8f0; }

.qa-issue-actions { display: flex; gap: 4px; flex-shrink: 0; }
.qa-issue-actions button, .qa-review-actions button, .qa-act-replace {
  border: none; background: none; cursor: pointer; font-size: 13px; padding: 2px 4px;
  border-radius: 4px; transition: background 0.15s;
}
.qa-issue-actions button:hover, .qa-review-actions button:hover, .qa-act-replace:hover {
  background: #f1f5f9;
}
[data-theme="dark"] .qa-issue-actions button:hover,
[data-theme="dark"] .qa-review-actions button:hover,
[data-theme="dark"] .qa-act-replace:hover { background: #475569; }

/* ========== 审校卡片（G2） ========== */
.qa-review-card {
  padding: 12px; margin-bottom: 8px; border-radius: 10px;
  background: #f8fafc; border-left: 3px solid #0D9488; transition: all 0.2s;
}
[data-theme="dark"] .qa-review-card { background: #334155; }
.qa-review-card.qa-dismissed { opacity: 0.3; }
.qa-review-card.qa-accepted { border-left-color: #10b981; background: #f0fdf4; }
[data-theme="dark"] .qa-review-card.qa-accepted { background: #052e16; }

.qa-review-card-header { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; color: #475569; margin-bottom: 6px; }
[data-theme="dark"] .qa-review-card-header { color: #94a3b8; }
.qa-review-type { background: #e0f2fe; color: #0369a1; padding: 1px 6px; border-radius: 6px; font-size: 11px; }
[data-theme="dark"] .qa-review-type { background: #1e3a5f; color: #7dd3fc; }

.qa-review-msg { font-size: 13px; color: #334155; margin-bottom: 8px; line-height: 1.5; }
[data-theme="dark"] .qa-review-msg { color: #e2e8f0; }

.qa-review-suggestion {
  padding: 8px 10px; background: #ecfdf5; border-radius: 8px; margin-bottom: 8px;
  font-size: 12px; line-height: 1.5;
}
[data-theme="dark"] .qa-review-suggestion { background: #064e3b; }
.qa-sug-label { font-weight: 600; color: #059669; }
[data-theme="dark"] .qa-sug-label { color: #34d399; }
.qa-sug-text { color: #065f46; }
[data-theme="dark"] .qa-sug-text { color: #a7f3d0; }

.qa-review-actions { display: flex; gap: 6px; }
.qa-review-actions button {
  font-size: 12px; padding: 4px 10px; border-radius: 6px;
  border: 1px solid #e2e8f0;
}
.qa-act-accept { background: #ecfdf5 !important; border-color: #10b981 !important; color: #059669 !important; }
.qa-act-accept:hover { background: #d1fae5 !important; }
[data-theme="dark"] .qa-act-accept { background: #064e3b !important; color: #34d399 !important; }

/* ========== 术语表（G3） ========== */
.qa-term-table { max-height: 360px; overflow-y: auto; }
.qa-term-header-row {
  display: grid; grid-template-columns: 40px 1fr 20px 1fr 20px 1fr 36px;
  gap: 4px; padding: 6px 8px; font-size: 11px; font-weight: 600;
  color: #64748b; background: #f1f5f9; border-radius: 6px; margin-bottom: 4px;
}
[data-theme="dark"] .qa-term-header-row { background: #334155; }

.qa-term-row {
  display: grid; grid-template-columns: 40px 1fr 20px 1fr 20px 1fr 36px;
  gap: 4px; padding: 6px 8px; border-bottom: 1px solid #f1f5f9;
  font-size: 12px; align-items: center;
}
[data-theme="dark"] .qa-term-row { border-bottom-color: #334155; }
.qa-term-seg { font-weight: 600; color: #475569; }
.qa-term-arrow { color: #94a3b8; text-align: center; }
.qa-term-bad { color: #ef4444; font-weight: 600; }
.qa-term-good { color: #10b981; font-weight: 600; }
.qa-term-source { color: #334155; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-theme="dark"] .qa-term-source { color: #e2e8f0; }

/* ========== 学习历史（G4） ========== */
.qa-learning-stats { display: flex; gap: 8px; margin-bottom: 12px; }
.qa-learning-stat-card {
  flex: 1; text-align: center; padding: 12px 8px; background: #f1f5f9;
  border-radius: 10px;
}
[data-theme="dark"] .qa-learning-stat-card { background: #334155; }
.qa-learning-hint { font-size: 12px; color: #64748b; text-align: center; margin-bottom: 12px; }
.qa-learning-query-btn {
  width: 100%; padding: 8px; background: #f1f5f9; border: 1px solid #e2e8f0;
  border-radius: 8px; cursor: pointer; font-size: 13px; color: #475569;
  transition: all 0.15s;
}
.qa-learning-query-btn:hover { background: #e2e8f0; }
[data-theme="dark"] .qa-learning-query-btn { background: #334155; border-color: #475569; color: #e2e8f0; }

.qa-history-item {
  padding: 8px 10px; margin-top: 6px; border-radius: 8px; background: #f8fafc;
  border-left: 2px solid #0D9488;
}
[data-theme="dark"] .qa-history-item { background: #334155; }
.qa-history-meta { display: flex; gap: 8px; font-size: 11px; color: #64748b; margin-bottom: 4px; }
.qa-history-type {
  background: #e0f2fe; color: #0369a1; padding: 0 4px; border-radius: 4px; font-size: 10px;
}
.qa-history-ratio { color: #f59e0b; }
.qa-diff-old { font-size: 12px; color: #ef4444; text-decoration: line-through; margin-bottom: 2px; opacity: 0.7; }
.qa-diff-new { font-size: 12px; color: #10b981; }

/* ========== 段内闪烁动画 (G5) ========== */
@keyframes qaFlash {
  0%, 100% { background: transparent; }
  50% { background: rgba(13, 148, 136, 0.15); }
}
tr.qa-flash { animation: qaFlash 0.5s ease 3; }
