/* 模块：AI 植保助手抽屉、Patch 审查面板、富文本工具栏与多步图片采集 (assets/ai-editor-steps.css) */
/* 4. AI 智能助手 FAB 与侧拉抽屉 (对应 AI Console) */
.ai-assistant-fab {
  position: fixed;
  bottom: 84px;
  right: 28px;
  z-index: 95;
  background: var(--primary);
  color: var(--text-on-primary);
  border: none;
  border-radius: 99px;
  padding: 10px 18px 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(62, 197, 131, 0.35);
  transition: transform 0.2s, box-shadow 0.2s;
}
.ai-assistant-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(62, 197, 131, 0.45);
}
.ai-assistant-fab.active {
  background: var(--primary-dark);
}
.ai-assistant-drawer {
  position: fixed;
  top: 52px;
  right: -420px;
  width: 400px;
  bottom: 0;
  background: var(--surface);
  border-left: 1px solid var(--border-hairline);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.08);
  z-index: 96;
  display: flex;
  flex-direction: column;
  transition: right 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
.ai-assistant-drawer.open {
  right: 0;
}
.ai-drawer-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-hairline);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface-muted);
}
.ai-drawer-head h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}
.ai-badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary);
}
.ai-model-tag {
  font-size: 10px;
  color: var(--ink3);
  background: var(--border-hairline);
  padding: 2px 6px;
  border-radius: 4px;
}
.ai-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.ai-prompt-section label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink2);
  margin-bottom: 8px;
  display: block;
}
.ai-chips-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ai-chip {
  text-align: left;
  background: var(--surface-muted);
  border: 1px solid var(--border-hairline);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  color: var(--ink1);
  cursor: pointer;
  transition: all 0.15s;
}
.ai-chip:hover {
  background: rgba(62, 197, 131, 0.08);
  border-color: var(--primary);
  color: var(--primary-dark);
}
.ai-stream-panel {
  background: #1B211E;
  color: #D1E7DD;
  border-radius: 8px;
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stream-head {
  color: var(--primary);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 4px;
}
.stream-idle {
  color: #6C757D;
  font-style: italic;
}
.stream-step {
  color: #E2E8F0;
  line-height: 1.5;
  animation: fadeIn 0.25s ease-in;
}
.stream-success {
  color: #6EE7B7;
  font-weight: 600;
}
.thinking-spinner {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 2px solid var(--primary);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: -1px;
  margin-right: 4px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 5. Patch 审查面板 */
.ai-patch-panel {
  border: 1px solid var(--border-hairline);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}
.patch-panel-head {
  padding: 10px 14px;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border-hairline);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}
.ai-patch-list {
  max-height: 260px;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.patch-item {
  background: var(--surface-muted);
  border-radius: 8px;
  padding: 10px;
  border: 1px solid var(--border-hairline);
}
.patch-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.patch-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
}
.patch-tag {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(62, 197, 131, 0.15);
  color: var(--primary-dark);
}
.patch-diff {
  font-size: 11px;
  line-height: 1.4;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.diff-old {
  color: var(--ink3);
  text-decoration: line-through;
}
.diff-new {
  color: var(--primary-dark);
  background: rgba(62, 197, 131, 0.08);
  padding: 4px 6px;
  border-radius: 4px;
}
.patch-actions {
  padding: 10px 14px;
  border-top: 1px solid var(--border-hairline);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: var(--surface-muted);
}

/* 6. 表单字段采纳高光反馈动效 */
.field-patch-highlight {
  animation: patchGlow 1.8s ease-out;
}
@keyframes patchGlow {
  0% { background: #FEF08A; border-color: #EAB308; }
  100% { background: var(--surface); border-color: var(--border-hairline); }
}

/* 7. Quill 富文本工具栏与排版区 */
.quill-mock-wrapper {
  border: 1px solid var(--border-hairline);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}
.quill-toolbar {
  padding: 8px 12px;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.toolbar-group {
  display: flex;
  gap: 2px;
}
.toolbar-sep {
  width: 1px;
  height: 18px;
  background: var(--border-hairline);
  margin: 0 4px;
}
.tb-btn {
  background: none;
  border: 1px solid transparent;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  color: var(--ink2);
  transition: all 0.15s;
}
.tb-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink1);
}
.tb-btn.active {
  background: var(--surface);
  border-color: var(--border-hairline);
  color: var(--primary-dark);
  font-weight: 700;
}
.quill-editor-body {
  padding: 16px;
  min-height: 240px;
  outline: none;
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink1);
}
.quill-editor-body h2 {
  font-size: 18px;
  margin: 16px 0 8px;
  color: var(--ink1);
}
.quill-editor-body p {
  margin: 0 0 10px;
}

/* 8. 多步骤图片采集 (对齐 Flutter PestImageSection _StepChip 并升级为高工艺分段胶囊) */
.image-step-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--surface-muted, #f1f5f9);
  border: 1px solid var(--border-soft, rgba(0, 0, 0, 0.06));
  border-radius: 999px;
  margin-bottom: 16px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
  box-sizing: border-box;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.image-step-tabs:empty {
  display: none;
}
.image-step-tabs::-webkit-scrollbar {
  display: none;
}
.image-step-tab {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid transparent;
  outline: none;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--ink2, #475569);
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  position: relative;
}
.image-step-tab:hover {
  color: var(--ink1, #0f172a);
  background: rgba(255, 255, 255, 0.65);
  transform: translateY(-0.5px);
}
.image-step-tab:active {
  transform: scale(0.98);
}
.image-step-tab.active {
  background: #ffffff;
  color: var(--primary-dark, #1b4332);
  font-weight: 600;
  border-color: rgba(45, 106, 79, 0.22);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(45, 106, 79, 0.08);
}
.step-tab-icon {
  font-size: 13px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
  transition: transform 0.2s ease;
}
.image-step-tab.active .step-tab-icon {
  opacity: 1;
  transform: scale(1.08);
}
.step-tab-label {
  font-size: 13px;
  font-weight: inherit;
  white-space: nowrap;
}
.step-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink3, #94a3b8);
  transition: all 0.2s ease;
}
.step-count-badge.has-count {
  background: rgba(45, 106, 79, 0.1);
  color: var(--primary, #2d6a4f);
}
.image-step-tab.active .step-count-badge {
  background: rgba(45, 106, 79, 0.12);
  color: var(--primary-dark, #1b4332);
}
.image-step-tab.active .step-count-badge.has-count {
  background: var(--primary, #2d6a4f);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(45, 106, 79, 0.3);
}
.specimen-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.specimen-img-card {
  position: relative;
  border-radius: 10px;
  border: 1px solid var(--border-soft, rgba(0, 0, 0, 0.08));
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}
.specimen-img-card:hover {
  border-color: rgba(45, 106, 79, 0.4);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}
.specimen-img-card.is-cover {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(45, 106, 79, 0.25);
}
.img-primary-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  z-index: 2;
  letter-spacing: 0.3px;
}
.img-box {
  height: 90px;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  border-bottom: 1px solid var(--border-hairline);
}
.img-meta {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.img-meta .img-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
