/* 发帖 / 回帖 / 编辑用的编辑器，照 NodeSeek 的 .md-editor（Vue 组件 data-v-4eb2f640 / ef03aa6c 的样式，去掉作用域）。
   CodeMirror 自己的样式在 codemirror5.css（editor.js 用到时才加载），这里的覆盖都多带一层 .md-editor，免得被它盖掉。 */
.md-editor { margin: 30px 8px; border-radius: 5px; box-shadow: 0 0 3px rgba(0, 0, 0, .3); background-color: var(--bg-sub-color); }
.edit-head + .md-editor, .md-editor:first-child { margin-top: 12px; }
.title-input { padding: 5px 20px; border-bottom: 1px solid rgba(0, 0, 0, .1); border-top-left-radius: 5px; border-top-right-radius: 5px; overflow: hidden; }
.title-input:hover { outline: 1px solid #b4cdb9; }
.title-input input { width: 100%; border: none; height: 20px; line-height: 20px; font-size: 16px; font-weight: 700; background: transparent; color: var(--text-color); outline: none; padding: 0; }
#editor-body { background-color: var(--bg-sub-color); }
#editor-body.fullscreen-editor { display: flex; flex-direction: column; overflow: auto; position: fixed; top: 0; left: 0; box-sizing: border-box; width: 100%; height: 100vh; z-index: 99999; }

/* 顶栏：内容 / 预览 / 对照 + 三个开关 */
.md-editor .tab-select { display: flex; align-items: center; padding: 0 1.5rem; color: #777; background-color: #f8f8f8; border-top-left-radius: 5px; border-top-right-radius: 5px; }
.md-editor .title-input + #editor-body .tab-select { border-radius: 0; }
.md-editor .tab-options { display: flex; }
.md-editor .tab-option { font-size: 14px; line-height: 30px; height: 30px; cursor: pointer; padding: 0 10px; border-bottom: 3px solid transparent; box-sizing: border-box; user-select: none; }
.md-editor .tab-option.active { border-bottom-color: #000; }
.md-editor .md-hint { margin-left: auto; margin-right: 10px; font-size: 13px; }
.md-editor .md-hint a { color: #0dbc79; }
.md-editor .editor-top-button { line-height: 1; display: block; padding: 4px; margin: 0 2px; border-radius: 3px; color: #777; }
.md-editor .editor-top-button.on { background-color: rgba(0, 0, 0, .1); }
.md-editor .editor-top-button .iconpark-icon { width: 16px; height: 16px; display: block; }
.dark-layout .md-editor .tab-select, .dark-layout .md-editor textarea, .dark-layout .md-editor .title-input, .dark-layout .md-editor #mde-title { color: #ddd; background-color: var(--bg-sub-color); }
.dark-layout .md-editor .tab-option.active { border-bottom-color: #ddd; }
.dark-layout .md-editor .editor-top-button { color: #aaa; }
.dark-layout .md-editor .editor-top-button.on { background-color: rgba(255, 255, 255, .1); }

/* 工具栏 */
.mde-toolbar { border-top: 1px solid rgba(0, 0, 0, .1); box-sizing: border-box; padding: 0 10px; line-height: 1; height: 28px; display: flex; align-items: center; }
.mde-toolbar[hidden] { display: none; }
.mde-toolbar .toolbar-item, .mde-toolbar .sep { margin: 0 2px; }
.mde-toolbar .toolbar-item { padding: 4px 3px; border-radius: 2px; cursor: pointer; color: #777; display: inline-flex; }
.mde-toolbar .toolbar-item .iconpark-icon { width: 16px; height: 16px; }
.dark-layout .mde-toolbar .toolbar-item { color: #aaa; }
.mde-toolbar .toolbar-item:hover { background-color: rgba(0, 0, 0, .05); }
.mde-toolbar .sep { border-right: 1px solid rgba(0, 0, 0, .2); height: 22.4px; }

/* 内容区：编辑框 + 预览，对照时左右各一半 */
.content-area { min-height: 250px; border-top: 1px solid rgba(0, 0, 0, .1); border-bottom: 1px solid rgba(0, 0, 0, .1); }
.split-view-container { display: flex; }
#editor-body #cm-editor-wrapper { height: 250px; width: 100%; }
#editor-body #cm-editor-wrapper[hidden] { display: none; }
#editor-body.fullscreen-editor #cm-editor-wrapper { height: unset; }
.fullscreen-editor .content-area { flex: 1 1 0%; min-height: 0; }
.split-view-container .split-view-item { overflow: auto; height: 100%; width: 50%; }
#editor-body #cm-editor-wrapper.split-view-item { width: 50%; }
.split-view-container .split-view-item:nth-child(2) { border-left: 1px solid rgba(0, 0, 0, .1); box-sizing: border-box; padding-left: 10px; }
.content-area #markdown-input { border: none; width: 100%; height: 250px; box-sizing: border-box; resize: none; line-height: 1.5; padding: .5rem; font-size: 14px; background: var(--bg-sub-color); color: var(--text-color); outline: none; }
.fullscreen-editor .content-area #markdown-input { height: 100%; }
.content-area #markdown-input:hover { outline: 1px solid #b4cdb9; }
.content-area #markdown-input::placeholder { color: #ccc; }
.content-area .markHtml-wrapper { padding: 1rem 1.3rem; width: 100%; box-sizing: border-box; min-height: 250px; }
.content-area .markHtml-wrapper[hidden] { display: none; }
.content-area .markHtml-wrapper.split-view-item { padding: 0 0 0 10px; min-height: 0; }
.content-area .markHtml-wrapper .post-content { margin: 0; }

/* CodeMirror（主题 nsk） */
.md-editor .CodeMirror { height: 100%; font-size: 14px; color: var(--text-color); background-color: var(--bg-sub-color); font-family: monospace; }
/* 触屏上 16px：苹果手机点进小于 16px 的输入区会把整页放大（ns.css 开头那条同理） */
@media (hover: none) and (pointer: coarse) { .md-editor .CodeMirror, .content-area #markdown-input { font-size: 16px; } }
.md-editor #code-mirror-editor { height: 100%; }
.md-editor .CodeMirror-cursor { border-left: 1px solid var(--text-color); }
.md-editor .CodeMirror-placeholder { color: rgba(0, 0, 0, .2) !important; }
.dark-layout .md-editor .CodeMirror-placeholder { color: rgba(255, 255, 255, .2) !important; }
.md-editor .CodeMirror-activeline-background { background-color: transparent; }
.md-editor .CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
.dark-layout .md-editor .CodeMirror-selected, .dark-layout .md-editor .CodeMirror-focused .CodeMirror-selected { background: #4a4a6a; }
.md-editor .cm-s-nsk .CodeMirror-gutters { background-color: var(--bg-sub-color); border-right: 1px solid rgba(0, 0, 0, .05); }
.dark-layout .md-editor .cm-s-nsk .CodeMirror-gutters { border-right: 1px solid rgba(0, 0, 0, .15); }
.md-editor .cm-s-nsk .CodeMirror-linenumber { color: #999; }
.md-editor .cm-s-nsk .cm-header { color: var(--text-color); }
.md-editor .cm-s-nsk .cm-header-1 { color: #2ea44f; }
.md-editor .cm-s-nsk .cm-variable-2 { color: #166c9d; }
.md-editor .cm-s-nsk .cm-quote { color: #9fab3a; }
.md-editor .cm-s-nsk .cm-link, .md-editor .cm-s-nsk .cm-link + .cm-url { color: #0dbc79; }
.dark-layout .md-editor .cm-s-nsk .cm-variable-2 { color: #6cb6e0; }
.md-editor .CodeMirror-overlayscroll-horizontal div, .md-editor .CodeMirror-overlayscroll-vertical div { background: #bcd; }

/* 表情：一排组名，点开一组下面列图 */
.md-editor .expression { display: flex; align-items: center; padding: 0 5px; height: 30px; background-color: #f8f8f8; border-bottom: 1px solid rgba(0, 0, 0, .05); font-size: 14px; color: #555; }
.dark-layout .md-editor .expression { background-color: var(--bg-sub-color); color: #bbb; border-bottom-color: rgba(0, 0, 0, .3); }
.md-editor .expression .exp-item { padding: 0 5px; cursor: pointer; transition: .3s; user-select: none; }
.md-editor .expression .exp-item:hover { transform: scale(1.1); }
.md-editor .expression .exp-item.current-group { transform: scale(1.2); }
.md-editor .exp-container { max-height: 0; box-sizing: border-box; padding: 0 10px; width: 100%; display: flex; justify-content: space-around; place-items: center flex-start; flex-wrap: wrap; overflow: hidden; transition: max-height .5s; }
.md-editor .exp-container.open { padding: 10px; max-height: 280px; overflow: auto; }
.md-editor .exp-container .sticker { width: 60px; height: 60px; max-width: 90px; padding: 5px; cursor: pointer; }
.md-editor .exp-container .sticker:hover { outline: 3px dashed #afffe8; }

/* 底栏：版块（发帖时）+ 发布按钮 */
.md-editor .topic-select { display: flex; justify-content: space-between; align-items: center; padding: 0 1.5rem; font-size: 14px; line-height: 30px; min-height: 30px; gap: 8px; }
.md-editor .topic-select .submit { padding: 0 1rem; font-size: 14px; line-height: 25px; height: 25px; border-radius: 4px; }
.md-editor .topic-select .submit:disabled { opacity: .7; cursor: default; }
.md-editor .topic-select .iconpark-icon { width: 18px; height: 18px; color: #333; vertical-align: middle; margin-right: 4px; }
.dark-layout .md-editor .topic-select .iconpark-icon { color: #bbb; }
.md-editor .topic-select label { margin-right: 10px; }
.md-editor .topic-select select { margin-right: 1rem; }
.md-editor .topic-select .form-error { line-height: 1.3; }
.md-editor .wait-botton { animation: wait-send 1.5s infinite; }
@keyframes wait-send { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }

@media screen and (max-width: 500px) {
  /* 手机上右下角那三个圆按钮会压住「发布」：正在写的时候先收起来 */
  body:has(.md-editor:focus-within) #fast-nav-button-group { display: none; }
  .md-editor .tab-select { padding: 0 12px; }
  .md-editor .tab-option.tab-option-item-2 { display: none; }
  .md-editor .md-hint { font-size: 12px; }
  .mde-toolbar { padding: 0 5px; }
  .md-editor .topic-select label { display: none; }
}
@media screen and (max-width: 450px) { .mde-toolbar { padding: 0; justify-content: space-around; } .mde-toolbar .toolbar-item .iconpark-icon { width: 12px; height: 12px; } }
.md-editor .expression[hidden], .md-editor .exp-container[hidden] { display: none; }
