/**
 * Prompt Manager Modal — 系统提示词 DAG 版本管理
 * 大量复用 skill_manager.css 的类；此文件只补充差异。
 */

.prompt-manager-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(4px);
}

.prompt-manager-modal {
  width: 90vw;
  height: 88vh;
  background: #13131a;
  border: 1px solid #1e1e2e;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── 顶栏 ────────────────────────────────────────────────────────────────── */

.prompt-manager-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 52px;
  border-bottom: 1px solid #1e1e2e;
  flex-shrink: 0;
}

.prompt-manager-title {
  font-size: 14px;
  font-weight: 600;
  color: #e0e0e0;
  letter-spacing: 0.02em;
}

.prompt-manager-close {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: #666;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.prompt-manager-close:hover {
  background: rgba(255,255,255,0.06);
  color: #ccc;
}

/* ── 主体：左右分栏 ──────────────────────────────────────────────────────── */

.prompt-manager-body {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* 左侧：Prompt 列表 */
.prompt-list-panel {
  width: 200px;
  flex-shrink: 0;
  border-right: 1px solid #1e1e2e;
  overflow-y: auto;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.prompt-list-row {
  display: flex;
  align-items: center;
  gap: 2px;
}

.prompt-list-item {
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: #888;
  transition: background 0.12s, color 0.12s;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: none;
  background: transparent;
  text-align: left;
  flex: 1;
  min-width: 0;
}
.prompt-list-item:hover {
  background: rgba(255,255,255,0.04);
  color: #ccc;
}
.prompt-list-item.active {
  background: rgba(251,191,36,0.1);
  color: #fbbf24;
}

.prompt-list-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #444;
  flex-shrink: 0;
}
.prompt-list-item.active .prompt-list-dot {
  background: #fbbf24;
}

/* 右侧：内容区（DAG + 详情） */
.prompt-content-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

/* ── 节点详情区 ──────────────────────────────────────────────────────────── */

.prompt-detail-panel {
  height: 220px;
  flex-shrink: 0;
  border-top: 1px solid #1e1e2e;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.prompt-detail-empty {
  color: #444;
  font-size: 13px;
  margin: auto;
}

/* 详情头部：meta + 按钮 */
.prompt-detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  border-bottom: 1px solid #1a1a24;
  flex-shrink: 0;
}

.prompt-detail-meta {
  display: flex;
  gap: 12px;
  flex: 1;
  min-width: 0;
  align-items: center;
}

.prompt-detail-message {
  font-size: 13px;
  font-weight: 500;
  color: #ddd;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.prompt-detail-meta span {
  font-size: 12px;
  color: #666;
  white-space: nowrap;
}
.prompt-detail-meta .meta-hash {
  font-family: monospace;
  color: #fbbf24;
}

.prompt-detail-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* 提示词内容预览（只读） */
.prompt-content-preview {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px;
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  color: #888;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  background: #0f0f14;
}

/* ── Prompt 编辑器 Modal ─────────────────────────────────────────────────── */

.prompt-editor-overlay {
  position: fixed;
  inset: 0;
  z-index: 1010;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(3px);
}

.prompt-editor-modal {
  width: 80vw;
  height: 82vh;
  background: #13131a;
  border: 1px solid #1e1e2e;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.prompt-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 52px;
  border-bottom: 1px solid #1e1e2e;
  flex-shrink: 0;
}

.prompt-editor-title {
  font-size: 13px;
  font-weight: 600;
  color: #ccc;
}

.prompt-editor-ref {
  font-size: 11px;
  font-family: monospace;
  color: #555;
  flex: 1;
  margin-left: 12px;
}

.prompt-editor-textarea {
  flex: 1;
  width: 100%;
  background: #0f0f14;
  color: #d0d0d0;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 13px;
  line-height: 1.7;
  border: none;
  outline: none;
  resize: none;
  padding: 20px;
  tab-size: 2;
}

.prompt-editor-footer {
  border-top: 1px solid #1e1e2e;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  background: #13131a;
}

.prompt-editor-commit-input {
  flex: 1;
  background: rgba(255,255,255,0.04);
  border: 1px solid #2a2a3a;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  color: #ccc;
  outline: none;
  transition: border-color 0.15s;
}
.prompt-editor-commit-input:focus {
  border-color: #fbbf24;
}
.prompt-editor-commit-input::placeholder { color: #444; }

.prompt-editor-save-btn {
  padding: 7px 18px;
  border-radius: 8px;
  border: none;
  background: #fbbf24;
  color: #111;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}
.prompt-editor-save-btn:hover { opacity: 0.85; }
.prompt-editor-save-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.prompt-editor-status {
  font-size: 12px;
  color: #4ade80;
  white-space: nowrap;
}

/* ── Prompt Modal 内 DAG 节点颜色覆盖（黄色主题） ─────────────────────── */

.prompt-manager-modal .dag-node:hover .dag-node-dot {
  border-color: #fbbf24;
  background: rgba(251,191,36,0.1);
}

.prompt-manager-modal .dag-node.selected .dag-node-dot {
  border-color: #fbbf24;
  background: rgba(251,191,36,0.2);
  box-shadow: 0 0 0 3px rgba(251,191,36,0.2);
}

.prompt-manager-modal .dag-node.is-head .dag-node-dot {
  border-color: #fbbf24;
  background: rgba(251,191,36,0.15);
}

.prompt-manager-modal .dag-node:hover .dag-node-inner,
.prompt-manager-modal .dag-node.selected .dag-node-inner {
  background: #fbbf24;
}

.prompt-manager-modal .dag-node.is-head .dag-node-inner {
  background: #fbbf24;
}

.prompt-manager-modal .dag-node:hover .dag-node-hash,
.prompt-manager-modal .dag-node.selected .dag-node-hash {
  color: #fbbf24;
}
