/* =============================================
   策略工作台 - 布局
   ============================================= */

/* 覆盖主内容区，去掉默认 padding，改用 flex 布局 */
.main-content .strategy-layout {
  display: flex;
  gap: 20px;
  height: calc(100vh - var(--topbar-height) - 32px);
  padding: 16px 20px;
  overflow: hidden;
}

/* =============================================
   左侧任务管理面板
   ============================================= */
.strategy-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid rgba(51, 65, 85, 0.4);
  border-radius: var(--radius-card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.strategy-sidebar__header {
  padding: 16px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.3);
  flex-shrink: 0;
}

.strategy-sidebar__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-title);
}

/* 任务统计 */
.strategy-sidebar__stats {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.3);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  flex-shrink: 0;
}

.task-stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.task-stat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.task-stat-dot--amber  { background: #f59e0b; }
.task-stat-dot--emerald { background: #10b981; }
.task-stat-dot--red    { background: #ef4444; }

.task-stat-label {
  flex: 1;
  color: var(--text-muted);
}

.task-stat-num {
  font-family: ui-monospace, monospace;
  font-weight: 600;
  color: var(--text-title);
}

/* 任务列表 */
.strategy-sidebar__task-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}

.task-list-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.task-list-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 任务卡片 */
.task-card {
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid rgba(51, 65, 85, 0.3);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.task-card:hover {
  border-color: rgba(51, 65, 85, 0.6);
  background: #1f2937;
}

.task-card--active {
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.04);
}

.task-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.task-card__id {
  font-size: 11px;
  font-family: ui-monospace, monospace;
  color: var(--text-muted);
}

.task-card__name {
  font-size: 13px;
  color: var(--text-title);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.task-card__time {
  font-size: 11px;
  color: var(--text-muted);
}

/* 状态徽章 */
.task-badge {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 500;
}

.task-badge--emerald {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.task-badge--blue {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.task-badge--amber {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.task-badge--red {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
}

/* =============================================
   右侧主工作区
   ============================================= */
.strategy-main {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* 工作台标题 */
.strategy-main__header {
  flex-shrink: 0;
}

.strategy-main__title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-title);
  line-height: 1.3;
}

.strategy-main__desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* =============================================
   通用卡片
   ============================================= */
.st-card {
  background: var(--bg-card);
  border: 1px solid rgba(51, 65, 85, 0.4);
  border-radius: var(--radius-card);
  padding: 20px;
  transition: border-color 0.2s ease;
}

.st-card__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-title);
  margin-bottom: 14px;
}

/* =============================================
   通用按钮
   ============================================= */
.st-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-btn);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  width: 100%;
}

.st-btn--primary {
  background: var(--accent-emerald);
  color: #fff;
}

.st-btn--primary:hover {
  background: #059669;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.3);
}

.st-btn--secondary {
  background: var(--bg-elevated);
  color: var(--text-body);
  border: 1px solid rgba(51, 65, 85, 0.5);
}

.st-btn--secondary:hover {
  border-color: rgba(51, 65, 85, 0.8);
  color: var(--text-title);
}

.st-btn--lg {
  padding: 12px 24px;
  font-size: 14px;
  width: auto;
  flex-shrink: 0;
}

/* =============================================
   注入模式
   ============================================= */
.inject-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.inject-mode-item {
  position: relative;
  padding: 16px;
  border-radius: 10px;
  border: 2px solid rgba(51, 65, 85, 0.4);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.inject-mode-item:hover {
  border-color: rgba(51, 65, 85, 0.7);
}

.inject-mode-item--selected {
  border-color: var(--accent-emerald);
  background: var(--bg-elevated);
}

/* 选中勾 */
.inject-mode-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.15);
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--accent-emerald);
}

.inject-mode-item--selected .inject-mode-check {
  display: flex;
}

/* 图标 */
.inject-mode-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.inject-mode-icon--emerald { background: rgba(16, 185, 129, 0.12); color: #10b981; }
.inject-mode-icon--blue    { background: rgba(59, 130, 246, 0.12); color: #3b82f6; }
.inject-mode-icon--purple  { background: rgba(139, 92, 246, 0.12); color: #8b5cf6; }

.inject-mode-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-title);
  margin-bottom: 6px;
}

.inject-mode-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 10px;
}

.inject-mode-time {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
}

.inject-mode-time--emerald { color: #34d399; }
.inject-mode-time--blue    { color: #60a5fa; }
.inject-mode-time--purple  { color: #a78bfa; }

/* =============================================
   持续时间
   ============================================= */
.duration-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.duration-item {
  padding: 14px;
  border-radius: 8px;
  border: 1px solid rgba(51, 65, 85, 0.4);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.duration-item:hover {
  border-color: rgba(51, 65, 85, 0.7);
}

.duration-item--selected {
  border-color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.06);
}

.duration-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-title);
  margin-bottom: 4px;
}

.duration-name--emerald { color: #34d399; }

.duration-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.duration-save {
  font-size: 12px;
  color: var(--accent-emerald);
  margin-top: 4px;
  font-weight: 500;
}

/* =============================================
   下拉选择器
   ============================================= */
.st-select-wrap {
  position: relative;
}

.st-select {
  width: 100%;
  appearance: none;
  background: var(--bg-elevated);
  border: 1px solid rgba(51, 65, 85, 0.5);
  border-radius: var(--radius-btn);
  padding: 10px 36px 10px 14px;
  font-size: 13px;
  color: var(--text-title);
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s ease;
  font-family: inherit;
}

.st-select:focus {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
}

.st-select option {
  background: var(--bg-elevated);
  color: var(--text-title);
}

.st-select-arrow {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
  align-items: center;
}

/* =============================================
   注入分类标签
   ============================================= */
.category-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-tag {
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  background: var(--bg-elevated);
  color: var(--text-body);
  border: 1px solid rgba(51, 65, 85, 0.4);
  cursor: pointer;
  transition: all 0.2s ease;
}

.category-tag:hover {
  border-color: rgba(51, 65, 85, 0.7);
  color: var(--text-title);
}

.category-tag--active {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: transparent;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
}

/* =============================================
   关键词输入
   ============================================= */
.keyword-input-row {
  margin-bottom: 12px;
}

.keyword-input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid rgba(51, 65, 85, 0.5);
  border-radius: var(--radius-btn);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
}

.keyword-input-wrap:focus-within {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
}

.keyword-input-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding: 0 10px 0 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.keyword-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  padding: 12px 8px 12px 0;
  font-size: 14px;
  color: var(--text-title);
  outline: none;
  font-family: inherit;
}

.keyword-input::placeholder {
  color: var(--text-muted);
}

/* 输入框内右侧按钮组 */
.keyword-action-btns {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding-right: 6px;
  gap: 2px;
}

/* 竖线分隔符 */
.kw-divider {
  width: 1px;
  height: 16px;
  background: rgba(51, 65, 85, 0.5);
  flex-shrink: 0;
  margin: 0 2px;
}

.kw-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-family: inherit;
  background: transparent;
}

/* 确定按钮 */
.kw-btn--confirm {
  color: var(--accent-emerald);
}
.kw-btn--confirm:hover {
  background: rgba(16, 185, 129, 0.12);
}

/* AI解析按钮 */
.kw-btn--ai {
  color: #a78bfa;
}
.kw-btn--ai:hover {
  background: rgba(139, 92, 246, 0.12);
}

/* 重新解析按钮 */
.kw-btn--reparse {
  color: var(--text-muted);
}
.kw-btn--reparse:hover {
  color: var(--text-title);
  background: rgba(51, 65, 85, 0.2);
}


/* 标签区整体容器 */
.keyword-tags-section {
  margin-top: 10px;
  border: 1px solid rgba(51, 65, 85, 0.3);
  border-radius: 8px;
  overflow: hidden;
}

/* 标签区标题栏 */
.keyword-tags-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px 7px 12px;
  background: rgba(28, 35, 51, 0.5);
  border-bottom: 1px solid rgba(51, 65, 85, 0.3);
}

.keyword-tags-bar__label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 数量计数徽章 */
.kw-count-badge {
  font-size: 11px;
  font-family: ui-monospace, monospace;
  color: var(--text-muted);
  background: rgba(51, 65, 85, 0.3);
  padding: 1px 7px;
  border-radius: 20px;
  border: 1px solid rgba(51, 65, 85, 0.4);
  transition: all 0.2s ease;
}

/* 接近/达到上限时变红提示 */
.kw-count-badge--warn {
  color: #f87171;
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.25);
}

.keyword-tags-bar__actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* 标签区小按钮 */
.kw-tag-bar-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid rgba(51, 65, 85, 0.4);
  background: transparent;
  color: var(--text-muted);
  transition: all 0.2s ease;
  font-family: inherit;
  white-space: nowrap;
}

.kw-tag-bar-btn:hover {
  color: var(--text-title);
  border-color: rgba(51, 65, 85, 0.7);
  background: rgba(51, 65, 85, 0.15);
}

/* 重新解析悬停紫色 */
.kw-tag-bar-btn:not(.kw-tag-bar-btn--toggle):hover {
  color: #a78bfa;
  border-color: rgba(139, 92, 246, 0.35);
  background: rgba(139, 92, 246, 0.08);
}

/* 展开/收缩图标旋转动画 */
.toggle-icon {
  transition: transform 0.25s ease;
}
.kw-tag-bar-btn--toggle.is-collapsed .toggle-icon {
  transform: rotate(180deg);
}

/* 已添加关键词标签 */
.keyword-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  transition: all 0.25s ease;
}

/* 收缩状态 */
.keyword-tags.is-collapsed {
  display: none;
}

.keyword-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--bg-elevated);
  border: 1px solid rgba(51, 65, 85, 0.4);
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-body);
}

.keyword-tag__remove {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  transition: color 0.2s ease;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
}

.keyword-tag__remove:hover {
  color: #f87171;
}

/* =============================================
   提交任务按钮条
   ============================================= */
.strategy-submit-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding: 4px 0 8px;
  flex-shrink: 0;
}

/* 积分消耗提示 */
.strategy-cost-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.strategy-cost-num {
  font-size: 15px;
  font-weight: 700;
  font-family: ui-monospace, monospace;
  color: #fbbf24;
}

/* =============================================
   提交校验弹窗
   ============================================= */
.submit-check-box {
  max-width: 380px;
  text-align: center;
  padding: 36px 32px 28px;
}

.submit-check-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.submit-check-icon--warn {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.submit-check-icon--error {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.submit-check-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-title);
  margin-bottom: 10px;
}

.submit-check-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 24px;
}

.submit-check-actions {
  display: flex;
  justify-content: center;
}

.strategy-submit-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 32px;
  background: var(--accent-emerald);
  color: #fff;
  border: none;
  border-radius: var(--radius-btn);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease;
  letter-spacing: 0.01em;
}

.strategy-submit-btn:hover {
  background: #059669;
  box-shadow: 0 0 24px rgba(16, 185, 129, 0.35);
}

/* =============================================
   AI 解析加载状态
   ============================================= */

/* 按钮加载中状态 */
.kw-btn--loading {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* 解析中提示条 */
.kw-parsing-tip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-btn);
  font-size: 13px;
  color: #34d399;
  margin-top: 2px;
}

/* 旋转加载圆圈 */
.kw-parsing-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(16, 185, 129, 0.25);
  border-top-color: #10b981;
  border-radius: 50%;
  flex-shrink: 0;
  animation: kw-spin 0.7s linear infinite;
}

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

/* 错误提示条 */
.kw-error-tip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-btn);
  font-size: 13px;
  color: #f87171;
  margin-top: 2px;
}

/* 输入框抖动动画（输入为空时提示） */
@keyframes kw-shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

.kw-input-shake {
  animation: kw-shake 0.4s ease;
}

/* =============================================
   滚动条（主工作区）
   ============================================= */
.strategy-main::-webkit-scrollbar { width: 5px; }
.strategy-main::-webkit-scrollbar-track { background: transparent; }
.strategy-main::-webkit-scrollbar-thumb { background: rgba(51, 65, 85, 0.5); border-radius: 999px; }

.strategy-sidebar__task-list::-webkit-scrollbar { width: 4px; }
.strategy-sidebar__task-list::-webkit-scrollbar-track { background: transparent; }
.strategy-sidebar__task-list::-webkit-scrollbar-thumb { background: rgba(51, 65, 85, 0.4); border-radius: 999px; }

/* =============================================
   任务列表空状态
   ============================================= */
.task-list-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 0;
  color: rgba(148, 163, 184, 0.5);
  font-size: 12px;
}
.task-list-empty svg { opacity: 0.4; }
.task-list-empty p { margin: 0; }

/* =============================================
   统计点 - 蓝色（进行中）
   ============================================= */
.task-stat-dot--blue { background: #60a5fa; }

/* =============================================
   提交成功弹窗图标
   ============================================= */
.submit-check-icon--success {
  color: #34d399;
  background: rgba(16, 185, 129, 0.12);
}

/* =============================================
   只读模式提示条
   ============================================= */
.readonly-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  margin-bottom: 16px;
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: 8px;
  color: #fbbf24;
  font-size: 13px;
}
.readonly-bar svg { flex-shrink: 0; }
.readonly-bar span { flex: 1; }
.readonly-bar__close {
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}
.readonly-bar__close:hover {
  background: rgba(251, 191, 36, 0.22);
}

/* 只读模式下整体透明度降低，禁用态视觉 */
.strategy-main--readonly .st-card {
  opacity: 0.75;
  pointer-events: none;
}
.strategy-main--readonly .strategy-submit-row {
  opacity: 0.5;
  pointer-events: none;
}
/* 只读模式下关键词标签不显示删除按钮 */
.strategy-main--readonly .keyword-tag__remove {
  display: none;
}
