/* ===== 댓글 툴바 / 이모지 / 이미지 ===== */
.cmf-toolbar {
  display: flex; align-items: center; gap: 2px;
  padding: 4px 6px; background: #f9f9f9;
  border: 1px solid #e8e8e8; border-bottom: none;
  border-radius: 6px 6px 0 0;
}
.cmf-toolbar.mini { border-radius: 6px 6px 0 0; padding: 3px 6px; }
.cmf-tool-btn {
  background: none; border: 1px solid transparent;
  border-radius: 4px; padding: 3px 7px;
  font-size: 13px; color: #555; cursor: pointer;
  line-height: 1.4; transition: background .12s;
}
.cmf-tool-btn:hover { background: #ede7f6; border-color: #ce93d8; color: #6a1b9a; }
.cmf-sep { color: #ddd; padding: 0 3px; font-size: 14px; }

.emoji-picker {
  flex-wrap: wrap; gap: 2px;
  background: #fff; border: 1px solid #ddd; border-radius: 8px;
  padding: 8px; max-height: 180px; overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,.12); position: relative; z-index: 10;
  margin-bottom: 4px;
}
.emoji-btn {
  font-size: 20px; cursor: pointer; padding: 3px 4px;
  border-radius: 4px; line-height: 1; transition: background .1s;
}
.emoji-btn:hover { background: #f5f0ff; }

.cmf-img-preview {
  padding: 6px; background: #fafafa; border: 1px solid #eee;
  border-bottom: none;
}

/* 댓글 textarea가 툴바와 연결될 때 모서리 조정 */
.comment-form .cmf-toolbar + .emoji-picker + .cmf-img-preview + textarea,
.comment-form .cmf-toolbar + .emoji-picker + textarea,
.comment-form .cmf-toolbar + .cmf-img-preview + textarea,
.comment-form .cmf-toolbar + textarea,
.reply-form-inner .cmf-toolbar ~ textarea {
  border-top-left-radius: 0; border-top-right-radius: 0;
}

/* ===== 게시글 페이지 ===== */
.post-page-wrap {
  max-width: 860px;
  margin: 0 auto;
}

.post-loading {
  text-align: center;
  padding: 60px;
  color: #aaa;
}
.post-loading p { margin-top: 12px; font-size: 13px; }

.post-error {
  text-align: center;
  padding: 40px;
  color: #aaa;
  font-size: 14px;
}

/* ===== 게시글 카드 ===== */
.post-card {
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  margin-bottom: 12px;
  overflow: hidden;
}

.post-head {
  padding: 16px 20px 12px;
  border-bottom: 1px solid #f0f0f0;
}

.post-board-badge-wrap { margin-bottom: 8px; }
.post-board-badge {
  display: inline-block;
  padding: 2px 9px;
  background: #e8f0fe;
  color: #1a73e8;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 600;
}

.post-title-main {
  font-size: 18px;
  font-weight: 700;
  color: #222;
  line-height: 1.45;
  margin-bottom: 10px;
  word-break: break-word;
}

.post-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.post-meta-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.pm-author { font-size: 13px; font-weight: 600; color: #444; }
.pm-dot { color: #ddd; }
.pm-time { font-size: 12px; color: #aaa; }

.post-meta-right {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #aaa;
}
.post-meta-right i { margin-right: 2px; }
.post-meta-right b { color: #e53935; }

/* ===== 본문 ===== */
.post-body {
  padding: 20px;
  font-size: 14px;
  line-height: 1.8;
  color: #333;
  min-height: 80px;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* ToastUI 에디터 HTML 출력 스타일 */
.post-body p { margin: 0 0 0.8em; }
.post-body h1, .post-body h2, .post-body h3, .post-body h4 { font-weight: 700; margin: 1.2em 0 0.5em; line-height: 1.35; }
.post-body h1 { font-size: 1.5em; }
.post-body h2 { font-size: 1.3em; }
.post-body h3 { font-size: 1.1em; }
.post-body ul, .post-body ol { padding-left: 1.6em; margin-bottom: 0.8em; }
.post-body li { margin-bottom: 0.2em; }
.post-body blockquote { border-left: 3px solid #1a73e8; margin: 0.8em 0; padding: 8px 14px; background: #f0f7ff; color: #555; border-radius: 0 4px 4px 0; }
.post-body pre { background: #1e2130; color: #e0e0e0; padding: 14px 16px; border-radius: 6px; overflow-x: auto; font-size: 13px; margin-bottom: 0.8em; }
.post-body code { background: #f0f0f0; padding: 2px 5px; border-radius: 3px; font-size: 12.5px; font-family: monospace; }
.post-body pre code { background: none; padding: 0; color: inherit; }
.post-body a { color: #1a73e8; text-decoration: underline; }
.post-body img { max-width: 100%; border-radius: 6px; margin: 4px 0; }
.post-body table { border-collapse: collapse; width: 100%; margin-bottom: 0.8em; }
.post-body th, .post-body td { border: 1px solid #ddd; padding: 6px 10px; font-size: 13px; }
.post-body th { background: #f8f9fa; font-weight: 700; }
.post-body hr { border: none; border-top: 1px solid #e0e0e0; margin: 1.2em 0; }

/* ===== 첨부 이미지 ===== */
.post-images {
  padding: 0 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.post-images img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  border: 1px solid #eee;
  cursor: zoom-in;
  /* CLS 방지: 이미지 로드 전 최소 높이 확보 */
  min-height: 80px;
  background: #f5f5f5;
}
.post-body img {
  max-width: 100%;
  height: auto;
  display: block;
  min-height: 40px;
  background: #f5f5f5;
}

/* ===== 액션 버튼 ===== */
.post-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid #f0f0f0;
  background: #fafafa;
}

.like-btn, .edit-btn, .del-btn, .list-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  border: 1.5px solid;
  cursor: pointer;
  transition: all .15s;
}
.like-btn {
  background: #fff;
  color: #e53935;
  border-color: #e53935;
}
.like-btn:hover, .like-btn.active {
  background: #e53935;
  color: #fff;
}
.edit-btn {
  background: #fff;
  color: #1a73e8;
  border-color: #1a73e8;
}
.edit-btn:hover { background: #1a73e8; color: #fff; }
.del-btn {
  background: #fff;
  color: #888;
  border-color: #ddd;
}
.del-btn:hover { background: #f5f5f5; color: #555; }
.list-btn {
  background: #fff;
  color: #555;
  border-color: #ddd;
}
.list-btn:hover { background: #f5f5f5; }

/* ===== 이전/다음 글 ===== */
.post-nav {
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  margin-bottom: 12px;
  overflow: hidden;
}
.pn-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid #f5f5f5;
  color: #444;
  font-size: 13px;
  transition: background .12s;
}
.pn-item:last-child { border-bottom: none; }
.pn-item:hover { background: #f8faff; }
.pn-label {
  font-size: 11px;
  color: #aaa;
  flex-shrink: 0;
  width: 34px;
}
.pn-item i { color: #ccc; font-size: 11px; flex-shrink: 0; }
.pn-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== 댓글 ===== */
.comment-card {
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  overflow: hidden;
}

.comment-header {
  padding: 11px 16px 10px;
  font-size: 13.5px;
  font-weight: 700;
  color: #333;
  background: #f8f9fa;
  border-bottom: 2px solid #1a73e8;
  display: flex;
  align-items: center;
  gap: 5px;
}
.comment-header i { color: #1a73e8; }

.comment-form {
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
  background: #fafbfc;
}
.comment-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #e0e0e0;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border-color .15s;
  background: #fff;
}
.comment-form textarea:focus { border-color: #1a73e8; }
.comment-form textarea:disabled { background: #f5f5f5; color: #aaa; cursor: not-allowed; }

.comment-form-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.comment-submit {
  padding: 7px 18px;
  background: #1a73e8;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.comment-submit:hover { background: #1557b0; }

#commentList { padding: 0; }

.comment-item {
  padding: 12px 16px;
  border-bottom: 1px solid #f5f5f5;
}
.comment-item:last-child { border-bottom: none; }

.comment-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.comment-author-info {
  display: flex;
  align-items: center;
  gap: 6px;
}
.comment-author {
  font-size: 13px;
  font-weight: 600;
  color: #444;
}
.comment-time {
  font-size: 11px;
  color: #bbb;
}
.comment-del {
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  font-size: 12px;
  padding: 2px 5px;
  border-radius: 3px;
  transition: color .12s, background .12s;
}
.comment-del:hover { color: #e53935; background: #fce8e6; }
.comment-text {
  font-size: 13.5px;
  color: #333;
  line-height: 1.7;
  word-break: break-word;
}

/* ===== 대댓글 ===== */
.comment-actions-right {
  display: flex;
  align-items: center;
  gap: 4px;
}
.reply-btn {
  background: none;
  border: 1px solid #ddd;
  color: #888;
  cursor: pointer;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  transition: all .12s;
}
.reply-btn:hover { color: #1a73e8; border-color: #1a73e8; background: #e8f0fe; }

.reply-item {
  padding-left: 32px;
  background: #f9fbff;
  border-left: 3px solid #c5d9f7;
  border-bottom: 1px solid #eef2fb;
  position: relative;
}
.reply-arrow {
  color: #aac4f0;
  font-size: 13px;
  margin-right: 4px;
}
.reply-to-nick {
  font-size: 11.5px;
  color: #1a73e8;
  font-weight: 600;
  background: #e8f0fe;
  padding: 1px 6px;
  border-radius: 8px;
}
.reply-form-area {
  margin-top: 8px;
  padding: 8px 0 2px;
}
.reply-form-inner {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.reply-form-inner textarea {
  flex: 1;
  padding: 8px 10px;
  border: 1.5px solid #c5d9f7;
  border-radius: 6px;
  font-size: 12.5px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  background: #fff;
  min-height: 56px;
}
.reply-form-inner textarea:focus { border-color: #1a73e8; }
.reply-submit {
  padding: 6px 14px;
  background: #1a73e8;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  margin-top: 2px;
}
.reply-submit:hover { background: #1557b0; }

/* 댓글 좋아요 */
.comment-like-row { margin-top: 4px; }
.comment-like-btn {
  background: none; border: 1px solid #e0e0e0; border-radius: 12px;
  color: #888; font-size: 11.5px; padding: 2px 10px; cursor: pointer;
  transition: all .12s; display: inline-flex; align-items: center; gap: 4px;
}
.comment-like-btn:hover { border-color: #1a73e8; color: #1a73e8; }
.comment-like-btn.active { background: #e8f0fe; border-color: #1a73e8; color: #1a73e8; }

/* ===== 반응형 ===== */
@media (max-width: 640px) {
  .post-title-main { font-size: 16px; }
  .post-head { padding: 12px 14px 10px; }
  .post-body { padding: 14px; font-size: 13.5px; }
  .post-images { padding: 0 14px 12px; }
  .post-actions { padding: 10px 14px; gap: 6px; }
  .like-btn, .edit-btn, .del-btn, .list-btn { padding: 6px 12px; font-size: 12px; }
}
