/* 后台「发布文章」模块样式
   复用 style.css 的设计变量（--ink / --line / --accent 等），保持全站视觉一致。 */

/* ---------- 列表 ---------- */
.art-bulk {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--accent-soft); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px;
}
.art-bulk .grow { flex: 1; }

.art-thumb { width: 52px; height: 38px; object-fit: cover; border-radius: 4px; display: block; }

.art-title-cell { font-weight: 500; line-height: 1.4; }
.art-sub-cell { color: var(--ink3); font-size: 12.5px; margin-top: 2px; }

.art-state { font-size: 12px; padding: 2px 9px; border-radius: 10px; white-space: nowrap; }
.art-state.draft { background: #f2ede3; color: var(--ink2); }
.art-state.published { background: #e6f2e8; color: var(--ok); }

.art-ops { white-space: nowrap; }
.art-ops .btn { margin-right: 4px; }
.art-ops .btn:last-child { margin-right: 0; }

/* ---------- 编辑区骨架 ---------- */
/* 编辑条吸顶：长文编辑时返回/保存/发布始终可见（高度由 JS 写入 --editbar-h 供工具栏吸附） */
.art-edit-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 0 14px; border-bottom: 1px solid var(--line); margin-bottom: 16px;
  position: sticky; top: 0; z-index: 30; background: var(--bg);
}
.art-edit-bar .grow { flex: 1; }

.art-edit-wrap { max-width: 900px; }

.art-title-input {
  width: 100%; font-size: 22px; font-weight: 600; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); color: var(--ink); margin-bottom: 14px;
  font-family: var(--font-serif); letter-spacing: .04em; line-height: 1.5;
}
.art-title-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.art-title-input:disabled { background: #faf8f4; color: var(--ink2); }

.art-meta { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; align-items: flex-start; }
.art-meta label {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 12.5px; color: var(--ink2);
}
.art-meta input, .art-meta select, .art-meta textarea {
  padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--ink); font-size: 14px; font-family: inherit;
}
.art-meta input:focus, .art-meta select:focus, .art-meta textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.art-meta input:disabled, .art-meta select:disabled, .art-meta textarea:disabled {
  background: #faf8f4; color: var(--ink2);
}
.art-summary-label { flex: 1; min-width: 260px; }
.art-summary-label textarea { resize: none; min-height: 64px; line-height: 1.5; overflow-y: auto; }

/* 封面 */
.art-cover { display: flex; align-items: center; gap: 8px; }
.art-cover-box {
  width: 96px; height: 64px; border: 1px dashed var(--line); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink3); font-size: 12px; overflow: hidden; background: #faf8f4;
}
.art-cover-box img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- 工具栏 ---------- */
/* 工具栏吸顶：吸附在编辑条下沿（--editbar-h 由 JS 按编辑条实际高度写入） */
.art-toolbar {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  padding: 8px 10px; background: var(--paper-2); border: 1px solid var(--line);
  border-bottom: none; border-radius: var(--radius) var(--radius) 0 0;
  position: sticky; top: var(--editbar-h, 55px); z-index: 25;
}
.art-toolbar button {
  min-width: 32px; height: 30px; padding: 0 8px;
  border: 1px solid transparent; border-radius: 6px;
  background: none; color: var(--ink2); cursor: pointer;
  font-size: 13px; line-height: 1;
}
.art-toolbar button:hover { background: var(--card); border-color: var(--line); color: var(--accent); }
.art-toolbar button:disabled { opacity: .4; cursor: not-allowed; }
.art-toolbar button svg { display: block; }
.art-sep { width: 1px; height: 18px; background: var(--line); margin: 0 5px; }
.art-wordcount { margin-left: auto; padding-right: 4px; font-size: 12px; color: var(--ink3); white-space: nowrap; }

/* 正文里加载失败的图片：给块状底色让破图一眼可见 */
.art-body img.art-img-broken {
  min-height: 96px; background: #f7f1e6; border: 1px dashed var(--line);
}

/* ---------- 正文编辑区 ---------- */
.art-body {
  min-height: 420px; padding: 22px 26px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
  font-family: "Songti SC", "SimSun", Georgia, serif;
  font-size: 16px; line-height: 1.9; color: #2f2a24;
  outline: none;
  overflow-wrap: break-word;
}
.art-body:focus { border-color: var(--accent); }
.art-body.dragover { border-color: var(--accent); background: #fffaf7; }

/* 空内容时显示占位提示 */
.art-body:empty::before,
.art-body.art-empty::before {
  content: attr(data-placeholder);
  color: var(--ink3); font-family: "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 14px;
}

/* 微信正文常见元素的兜底样式（正文内联样式会被 CSP 放行，这里只补结构感） */
.art-body p { margin: 0 0 14px; }
.art-body h1, .art-body h2, .art-body h3, .art-body h4 {
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  margin: 22px 0 12px; line-height: 1.4; font-weight: 600;
}
.art-body h1 { font-size: 22px; }
.art-body h2 { font-size: 19px; }
.art-body h3 { font-size: 17px; }
.art-body blockquote {
  margin: 14px 0; padding: 8px 16px;
  border-left: 3px solid var(--gold); background: #faf8f4; color: var(--ink2);
}
.art-body ul, .art-body ol { margin: 0 0 14px; padding-left: 26px; }
.art-body img { max-width: 100%; height: auto; display: block; margin: 14px auto; border-radius: 4px; }
.art-body a { color: var(--accent); }
.art-body table { max-width: 100%; border-collapse: collapse; margin: 14px 0; }
.art-body section { max-width: 100%; }

.art-body[contenteditable="false"] { background: #faf8f4; color: var(--ink2); }

/* 上传提示条 */
.art-uploading {
  margin-top: 12px; padding: 10px 14px;
  background: var(--accent-soft); border: 1px solid var(--line);
  border-radius: 8px; font-size: 13px; color: var(--ink2);
}

/* ---------- 窄屏 ---------- */
@media (max-width: 860px) {
  .art-edit-wrap { max-width: 100%; }
  .art-title-input { font-size: 19px; }
  .art-meta { flex-direction: column; gap: 12px; }
  .art-meta label { width: 100%; }
  .art-body { padding: 16px; min-height: 320px; }
  .art-ops .btn { margin-bottom: 4px; }
}

/* ---------- 从公众号导入面板 ---------- */
.wx-import-panel {
  border: 1px dashed var(--line); border-left: 4px solid var(--ink-brown);
  border-radius: var(--radius); background: #fdfbf6;
  padding: 14px 16px; margin-bottom: 14px;
}
.wx-import-title {
  display: flex; flex-direction: column; gap: 4px;
  font-family: var(--font-serif);
  font-size: 14.5px; font-weight: 600; color: var(--ink); margin-bottom: 12px;
  letter-spacing: .04em;
}
.wx-import-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.wx-import-row .grow { flex: 1; min-width: 240px; }
.wx-import-row input[type=text], .wx-import-row select {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--ink); font-size: 14px; font-family: inherit;
}
.wx-import-row input[type=text]:focus, .wx-import-row select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.wx-import-status { margin-top: 10px; font-size: 13px; color: var(--ink2); line-height: 1.7; white-space: pre-wrap; }
.wx-import-status.err { color: var(--danger, #c0392b); }
.wx-import-done {
  margin-top: 10px; padding: 10px 14px; background: #e9f4ec;
  border: 1px solid #bfe0cb; border-radius: 8px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13px;
}

/* ---------- 公众号批量导入：textarea + 进度 + 结果列表 ---------- */
.wx-urls { width: 100%; min-height: 78px; resize: vertical; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 8px; font-family: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  font-size: 13px; line-height: 1.55; background: #fff; color: var(--ink);
  box-sizing: border-box; }
.wx-urls:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.wx-import-row { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; margin-top: 10px; }
.wx-import-row .grow { flex: 1; min-width: 260px; }
.wx-progress { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.wx-progress-bar { flex: 1; height: 8px; background: var(--line2); border-radius: 6px; overflow: hidden; }
.wx-progress-fill { height: 100%; width: 0; background: var(--accent); border-radius: 6px; transition: width .25s; }
#wxProgressText { font-size: 12.5px; color: var(--ink2); white-space: nowrap; }
.wx-batch-result { list-style: none; padding: 0; margin: 10px 0 0;
  border: 1px solid var(--line); border-radius: 8px; max-height: 240px; overflow-y: auto;
  background: #fcf9f3; }
.wx-batch-result li { display: flex; align-items: flex-start; gap: 8px; padding: 8px 12px;
  border-bottom: 1px dashed var(--line); font-size: 13px; line-height: 1.5; }
.wx-batch-result li:last-child { border-bottom: none; }
.wx-batch-result .wxb-icon { flex-shrink: 0; width: 18px; height: 18px; line-height: 18px;
  text-align: center; border-radius: 50%; font-size: 11px; font-weight: 700; color: #fff; }
.wx-batch-result .wxb-ok    { background: #3f7d4e; }
.wx-batch-result .wxb-dup   { background: #b08d4f; }
.wx-batch-result .wxb-err   { background: #b3423a; }
.wx-batch-result .wxb-url   { color: var(--ink3); font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px; word-break: break-all; }
.wx-batch-result .wxb-msg   { color: var(--ink2); }
.wx-batch-result .wxb-open  { margin-left: auto; flex-shrink: 0; }

/* ---------- 文章列表「来源」徽章 ---------- */
.art-source { white-space: nowrap; }
.art-source .src-badge {
  display: inline-block; padding: 2px 9px; border-radius: 10px;
  font-size: 11.5px; color: var(--accent); background: var(--accent-soft);
  border: 1px solid #f5c9b8; text-decoration: none; line-height: 1.5;
}
.art-source .src-badge:hover { background: #f8d9cb; }
