/* ==========================================================================
   发帖弹窗（Composer）· 支持 Markdown 编辑 + 预览
   ========================================================================== */

.modal-compose {
  width: min(860px, 94vw);
  max-width: 860px;
}

.modal-compose .modal-head {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* 标题输入 */
.title-wrap {
  position: relative;
  margin-bottom: 4px;
}

.title-wrap input {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  font-family: inherit;
  font-size: 19px;
  font-weight: 600;
  color: var(--primary);
  padding: 10px 60px 10px 2px;
  outline: none;
  transition: border-color .12s;
}

.title-wrap input:focus { border-bottom-color: var(--tertiary); }
.title-wrap input::placeholder { color: var(--faint); font-weight: 400; }

.title-count {
  position: absolute;
  right: 2px;
  bottom: 12px;
  font-size: 11.5px;
  color: var(--faint);
  pointer-events: none;
}

/* 编辑 / 预览 切换 */
.compose-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 10px 0 8px;
  border-bottom: 1px solid var(--border);
}

.ctab {
  padding: 7px 16px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .12s;
}

.ctab:hover { color: var(--text); }
.ctab.active {
  color: var(--tertiary);
  border-bottom-color: var(--tertiary);
  font-weight: 600;
}

.compose-stat {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--faint);
  padding-bottom: 6px;
}

/* 工具栏 */
.md-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  flex-wrap: wrap;
}

.md-toolbar button {
  width: 30px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: var(--radius);
  color: var(--text2);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  transition: background .12s, color .12s;
}

.md-toolbar button:hover {
  background: var(--hover);
  color: var(--primary);
}

.md-toolbar button svg { width: 15px; height: 15px; }

.md-div {
  width: 1px;
  height: 16px;
  background: var(--border);
  margin: 0 5px;
}

/* 编辑区 */
.compose-editor {
  width: 100%;
  min-height: 280px;
  max-height: 46vh;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.72;
  color: var(--text);
  background: var(--secondary);
  resize: vertical;
  outline: none;
  transition: border-color .12s;
  display: block;
}

.compose-editor:focus { border-color: var(--tertiary); }
.compose-editor::placeholder { color: var(--faint); }

/* 预览区 */
.compose-preview {
  min-height: 280px;
  max-height: 46vh;
  overflow-y: auto;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--secondary);
  font-size: 14.5px;
}

.compose-preview:empty::before {
  content: "暂无内容，切换到编辑开始撰写";
  color: var(--faint);
  font-size: 13px;
}

/* 元信息行 */
.composer-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0 12px;
  flex-wrap: wrap;
}

.composer-meta select {
  height: 32px;
  padding: 0 26px 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--secondary);
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23919191' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.composer-meta select:focus { border-color: var(--tertiary); }

.draft-hint {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--faint);
}

.draft-hint.saved { color: var(--success); }

/* 底部按钮行 */
.modal-compose .row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.modal-compose .row .btn-primary { min-width: 110px; }

/* 移动端 */
@media (max-width: 720px) {
  .modal-compose { width: 100vw; height: 100vh; max-width: 100vw; border-radius: 0; }
  .compose-editor, .compose-preview { min-height: 40vh; max-height: 40vh; }
  .md-toolbar { overflow-x: auto; flex-wrap: nowrap; }
  .title-wrap input { font-size: 17px; }
}
