/* ============================================================
   MarkdownSourceView — Markdown 源码视图样式
   遵守 AGENTS.md：全部使用 token，无硬编码颜色/间距/圆角
   ============================================================ */

/* ── 容器 ── */
.wk-markdown-source-view {
  height: 100%;
  overflow: auto;
  background: var(--wk-bg-base);
  box-sizing: border-box;
}

/* ── 纯文本模式提示条 ── */
.wk-markdown-source-view__plain-hint {
  padding: var(--wk-sp-2) var(--wk-sp-4);
  background: var(--wk-color-warning-bg);
  border-bottom: 1px solid var(--wk-color-warning-border);
  color: var(--wk-color-warning);
  font-size: var(--wk-text-size-sm);
  flex-shrink: 0;
}

/* ── 纯文本源码 ── */
.wk-markdown-source-view__plain-source {
  margin: 0;
  padding: var(--wk-sp-4);
  flex: 1;
  overflow: auto;
  background: var(--wk-bg-base);
  color: var(--wk-text-primary);
  white-space: pre-wrap;
  word-break: break-all;
  overflow-wrap: break-word;
}

.wk-markdown-source-view__plain-source code {
  font-family: "SF Mono", Monaco, "Cascadia Code", Consolas, monospace;
  font-size: var(--wk-text-size-sm);
  line-height: 1.6;
}

/* ── 空状态 ── */
.wk-markdown-source-view--empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--wk-text-tertiary);
  font-size: var(--wk-text-size-md);
}

.wk-markdown-source-view__message {
  text-align: center;
}

/* ── 代码高亮容器样式覆盖 ── */
.wk-markdown-source-view.wk-code-highlight-container {
  padding: 0;
}

.wk-markdown-source-view.wk-code-highlight-container pre {
  margin: 0;
  padding: var(--wk-sp-4);
  min-height: 100%;
  box-sizing: border-box;
}

.wk-markdown-source-view.wk-code-highlight-container code {
  font-family: "SF Mono", Monaco, "Cascadia Code", Consolas, monospace;
  font-size: var(--wk-text-size-sm);
  line-height: 1.6;
}

/* ── 行号样式 ── */
.wk-markdown-source-view .linenumber {
  color: var(--wk-text-tertiary);
  user-select: none;
  padding-right: var(--wk-sp-3);
  text-align: right;
  min-width: 3em;
}

/* ── 滚动条样式 ── */
.wk-markdown-source-view::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.wk-markdown-source-view::-webkit-scrollbar-track {
  background: transparent;
}

.wk-markdown-source-view::-webkit-scrollbar-thumb {
  background: var(--wk-border-subtle);
  border-radius: var(--wk-r-xs);
}

.wk-markdown-source-view::-webkit-scrollbar-thumb:hover {
  background: var(--wk-border-default);
}

/* ── 暗色模式适配 ── */
body[theme-mode="dark"] .wk-markdown-source-view {
  background: var(--wk-bg-base);
}

body[theme-mode="dark"] .wk-markdown-source-view--empty {
  color: var(--wk-text-tertiary);
}

body[theme-mode="dark"] .wk-markdown-source-view .linenumber {
  color: var(--wk-text-tertiary);
}

body[theme-mode="dark"] .wk-markdown-source-view::-webkit-scrollbar-thumb {
  background: var(--wk-border-subtle);
}

body[theme-mode="dark"]
  .wk-markdown-source-view::-webkit-scrollbar-thumb:hover {
  background: var(--wk-border-default);
}
