/* ============================================================
   卤小能 · 社区问答 — 独立文章编辑器页面（v1.6.59）
   设计对齐 qa-style.css：珊瑚红 --r:#ff5252 / 白底 / 5px 圆角 / YaHei
   ============================================================ */

/* 隐藏主题自带的页面标题（编辑器自带 h1 标题，避免重复） */
.lxn-qa-editor .entry-title,
.lxn-qa-editor .page-title,
.lxn-qa-editor .post-title,
.lxn-qa-editor .page-header,
.lxn-qa-editor .entry-header { display: none !important; }

.qa-editor-embed {
  max-width: 760px;
  margin: 0 auto;
  padding: 4px 4px 32px;
}

/* 未登录 / 邮箱未验证提示 */
.qa-editor-login-tip {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 40px 24px;
  text-align: center;
}
.qa-editor-login-tip p { color: var(--tm); margin-bottom: 16px; font-size: 15px; }

.qa-editor-verify-warn {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: #fff8e6;
  border: 1px solid #ffe2a8;
  color: #a86b00;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13.5px;
}
.qa-editor-verify-warn svg { flex: 0 0 auto; }
.qa-editor-resend {
  margin-left: auto;
  background: none;
  border: 1px solid #ffce6b;
  color: #a86b00;
  border-radius: 4px;
  padding: 5px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: .12s;
}
.qa-editor-resend:hover { background: #fff1cf; }

/* 表单容器（卡片化） */
.qa-editor-form {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px 28px 22px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

/* 顶部草稿标记 */
.qa-editor-draft-flag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--tm);
  background: var(--r-soft);
  border: 1px solid var(--r-border);
  border-radius: 999px;
  padding: 3px 10px 3px 12px;
  margin-bottom: 16px;
}
.qa-editor-draft-discard {
  background: none;
  border: none;
  color: var(--r);
  font-size: 12px;
  cursor: pointer;
  padding: 0 2px;
  text-decoration: underline;
}

/* 标题 + 分类 基础布局（移动端上下堆叠，让标题与正文同宽；分类独占一行） */
.qa-editor-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
}
.qa-editor-field-title { width: 100%; min-width: 0; }
.qa-editor-field-cat {
  width: 100%;
  flex-shrink: 0;
}

/* v1.6.154：桌面端「故障分类」下拉框贴合文字宽度、文字左对齐并略上移 */
@media (min-width: 601px) {
  .qa-editor-row {
    flex-direction: row;
    align-items: flex-start;
    gap: 16px;
  }
  .qa-editor-field-title {
    width: auto;
    flex: 1 1 auto;
    min-width: 0;
  }
  .qa-editor-field-cat {
    width: auto;
    flex: 0 0 auto;
  }
  .qa-editor-field-cat .qa-editor-select {
    width: fit-content;
    min-width: 0;
    padding: 8px 36px 14px 13px;
    line-height: 1.4;
    text-align: left;
  }
}

/* 字段 */
.qa-editor-field { margin-bottom: 20px; }
.qa-editor-field:last-child { margin-bottom: 0; }
.qa-editor-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--t);
  margin-bottom: 8px;
}
.qa-editor-label .req { color: var(--r); margin-left: 3px; }

.qa-editor-input,
.qa-editor-select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 13px;
  font-size: 14.5px;
  color: var(--t);
  background: var(--bg);
  box-sizing: border-box;
  transition: border-color .12s, box-shadow .12s;
  font-family: inherit;
}
.qa-editor-input:focus,
.qa-editor-select:focus {
  outline: none;
  border-color: var(--r);
  box-shadow: 0 0 0 3px var(--r-soft);
}
.qa-editor-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path d='M1 3l4 4 4-4' fill='none' stroke='%23ccc' stroke-width='1.3'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 30px;
}

.qa-editor-counter {
  text-align: right;
  font-size: 12px;
  color: var(--tml);
  margin-top: 5px;
}

/* 工具栏 */
.qa-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  background: #fafbfc;
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  padding: 6px 8px;
}
.qa-tool {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid transparent;
  background: none;
  border-radius: 5px;
  color: var(--tm);
  font-size: 14px;
  cursor: pointer;
  transition: .1s;
}
.qa-tool:hover { background: #fff; border-color: var(--line); color: var(--t); }
.qa-tool:active,
.qa-tool.active { background: var(--r-soft); color: var(--r); border-color: var(--r-border); }
.qa-tool svg { display: block; margin: 0 auto; pointer-events: none; }
.qa-tool-sep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }

/* 正文编辑区 */
.qa-editor-body {
  min-height: 320px;
  max-height: 640px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 0 0 6px 6px;
  padding: 14px 16px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--t);
  background: var(--bg);
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.qa-editor-body:focus { border-color: var(--r); box-shadow: 0 0 0 3px var(--r-soft); }
.qa-editor-body:empty:before {
  content: attr(data-placeholder);
  color: var(--tml);
  pointer-events: none;
}
.qa-editor-body p { margin: 0 0 10px; }
.qa-editor-body blockquote {
  margin: 0 0 10px;
  padding: 8px 14px;
  border-left: 3px solid var(--r);
  background: var(--r-soft);
  color: var(--tm);
  border-radius: 0 4px 4px 0;
}
.qa-editor-body a { color: var(--r); }
.qa-editor-body img { max-width: 100%; border-radius: 6px; }
.qa-editor-body .qa-inline-img {
  display: inline-block;
  width: 50%;
  max-width: 100%;
  height: auto;
  margin: 4px 0;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: grab;
  vertical-align: top;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  transition: box-shadow .12s, border-color .12s, opacity .12s;
}
.qa-editor-body .qa-inline-img:hover { border-color: var(--r-border); }
.qa-editor-body .qa-inline-img.qa-img-dragging { opacity: .4; cursor: grabbing; }
/* 拖拽悬停：左侧/右侧插入指示线（图文混排重排） */
.qa-editor-body .qa-inline-img.qa-img-dragover-before { box-shadow: -3px 0 0 0 var(--r); }
.qa-editor-body .qa-inline-img.qa-img-dragover-after  { box-shadow: 3px 0 0 0 var(--r); }

/* 选中态 + 尺寸调节（拖拽手柄 / 数值输入） */
.qa-editor-body .qa-inline-img.qa-img-selected {
  border-color: var(--r);
  box-shadow: 0 0 0 2px var(--r-soft);
}
.qa-img-handle {
  position: fixed;
  z-index: 60;
  width: 14px; height: 14px;
  background: var(--r);
  border: 2px solid #fff;
  border-radius: 3px;
  cursor: nwse-resize;
  display: none;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.qa-img-handle:hover { background: var(--r-hover); }
.qa-img-panel {
  position: fixed;
  z-index: 60;
  display: none;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
  font-size: 12px;
  color: var(--t);
}
.qa-img-panel label { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.qa-img-panel input[type="number"] {
  width: 54px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 3px 5px;
  font-size: 12px;
  color: var(--t);
  font-family: inherit;
}
.qa-img-panel input[type="number"]:focus { outline: none; border-color: var(--r); box-shadow: 0 0 0 2px var(--r-soft); }
.qa-img-panel .qa-img-lock {
  width: 26px; height: 26px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: #fafbfc;
  border-radius: 4px;
  color: var(--tm);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}
.qa-img-panel .qa-img-lock.on { background: var(--r-soft); color: var(--r); border-color: var(--r-border); }

/* 悬浮删除按钮（fixed 定位，避免落入 contenteditable 被存进草稿） */
.qa-img-del {
  position: fixed;
  z-index: 50;
  width: 20px; height: 20px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(51,51,51,.72);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: none;
}
.qa-img-del:hover { background: var(--r); }

.qa-editor-hint {
  font-size: 12px;
  color: var(--tml);
  margin-top: 6px;
}

/* 草稿状态 */
.qa-editor-status {
  min-height: 20px;
  font-size: 12.5px;
  color: var(--tm);
  margin: 2px 0 14px;
  transition: color .15s;
}
.qa-editor-status.saving { color: var(--tml); }
.qa-editor-status.ok { color: var(--green); }
.qa-editor-status.err { color: var(--r); }
.qa-editor-clear-img {
  margin-left: 6px;
  background: none;
  border: none;
  color: var(--r);
  font-size: 12.5px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}
.qa-editor-clear-img:hover { color: var(--r-hover); }

/* 底部操作 */
.qa-editor-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.btn-ask {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 26px;
  color: #fff;
  background: var(--r);
  cursor: pointer;
  transition: .12s;
}
.btn-ask:hover { background: var(--r-hover); }
.btn-ask.busy { opacity: .7; cursor: not-allowed; }

/* 响应式 */
@media (max-width: 600px) {
  .qa-editor-form { padding: 18px 16px; border-radius: 10px; }
  /* v1.6.94：标题/分类默认已上下堆叠，无需再覆盖 .qa-editor-row；保留一点微调 */
  .qa-editor-footer { flex-direction: row-reverse; }
  .qa-editor-footer .btn,
  .qa-editor-footer .btn-ghost { flex: 1; justify-content: center; }
  /* 移动端编辑预览：宽度恢复 100%，避免 50% 在小屏过窄 */
  .qa-editor-body .qa-inline-img { width: 100%; }
}
