/* =================================================================
 *  게시판 스타일
 *  ▼ 홈페이지 색상에 맞추려면 아래 :root 의 색상값만 바꾸세요.
 * ================================================================= */
:root {
  --cb-primary:       #1f4e8c;   /* 메인 색 (버튼, 강조, 제목 줄) */
  --cb-primary-hover: #173c6c;   /* 버튼에 마우스 올렸을 때 */
  --cb-primary-soft:  #eef3fa;   /* 연한 배경 (공지 줄, 마우스 오버) */
  --cb-text:          #222831;   /* 본문 글자 */
  --cb-muted:         #7a8494;   /* 날짜·조회수 등 보조 글자 */
  --cb-line:          #e3e7ed;   /* 구분선 */
  --cb-bg:            #f6f7f9;   /* 페이지 배경 */
  --cb-card:          #ffffff;   /* 카드(목록·본문 상자) 배경 */
  --cb-danger:        #c94a4a;   /* 삭제 버튼 */

  --cb-radius:        12px;      /* 상자 모서리 둥글기 */
  --cb-radius-sm:     8px;       /* 버튼·입력칸 모서리 둥글기 */
  --cb-max-width:     1000px;    /* 게시판 최대 폭 */
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--cb-bg);
  color: var(--cb-text);
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Malgun Gothic", "맑은 고딕", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
code { background: var(--cb-primary-soft); padding: 1px 6px; border-radius: 5px; font-size: .9em; }

.cb-wrap { max-width: var(--cb-max-width); margin: 0 auto; padding: 40px 20px 60px; }

/* ---------- 상단 ---------- */
.cb-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  padding-bottom: 20px; margin-bottom: 24px;
  border-bottom: 3px solid var(--cb-primary);
}
.cb-title { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; color: var(--cb-primary); }
.cb-desc { margin: 6px 0 0; color: var(--cb-muted); font-size: 15px; }

/* ---------- 카드 ---------- */
.cb-card {
  background: var(--cb-card);
  border: 1px solid var(--cb-line);
  border-radius: var(--cb-radius);
  box-shadow: 0 1px 3px rgba(20, 30, 50, .04);
}

/* ---------- 버튼 ---------- */
.cb-btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 42px; padding: 0 20px;
  border: 1px solid var(--cb-primary); border-radius: var(--cb-radius-sm);
  background: var(--cb-primary); color: #fff;
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.cb-btn:hover { background: var(--cb-primary-hover); border-color: var(--cb-primary-hover); }
.cb-btn-ghost { background: #fff; color: var(--cb-primary); border-color: var(--cb-line); }
.cb-btn-ghost:hover { background: var(--cb-primary-soft); border-color: var(--cb-primary); color: var(--cb-primary); }
.cb-btn-danger { background: #fff; color: var(--cb-danger); border-color: var(--cb-line); }
.cb-btn-danger:hover { background: var(--cb-danger); border-color: var(--cb-danger); color: #fff; }
.cb-btn-sm { height: 36px; padding: 0 14px; font-size: 14px; }
.cb-btn-group { display: flex; gap: 8px; }
.cb-inline { display: inline; margin: 0; }
.cb-link { background: none; border: 0; padding: 0; font: inherit; color: var(--cb-muted); cursor: pointer; font-size: 13px; }
.cb-link:hover { color: var(--cb-primary); text-decoration: underline; }

/* ---------- 목록 상단 (건수 + 검색) ---------- */
.cb-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.cb-count { margin: 0; color: var(--cb-muted); font-size: 14px; }
.cb-count strong { color: var(--cb-primary); }
.cb-search { display: flex; gap: 6px; }
.cb-search select, .cb-search input {
  height: 36px; padding: 0 12px; font: inherit; font-size: 14px; color: var(--cb-text);
  border: 1px solid var(--cb-line); border-radius: var(--cb-radius-sm); background: #fff;
}
.cb-search input { width: 220px; }
.cb-search select:focus, .cb-search input:focus { outline: none; border-color: var(--cb-primary); box-shadow: 0 0 0 3px var(--cb-primary-soft); }

/* ---------- 목록 ---------- */
.cb-list-card { overflow: hidden; }
.cb-list { list-style: none; margin: 0; padding: 0; }
.cb-row {
  display: grid; grid-template-columns: 80px 1fr 120px 110px 70px; align-items: center;
  min-height: 56px; padding: 0 16px; border-top: 1px solid var(--cb-line);
}
.cb-list .cb-row:first-child { border-top: 0; }
.cb-row-head {
  min-height: 48px; border-top: 0; border-bottom: 1px solid var(--cb-line);
  background: var(--cb-primary-soft); color: var(--cb-primary); font-weight: 600; font-size: 14px;
}
.cb-row-head .cb-col-title { text-align: center; }
.cb-col-num, .cb-col-author, .cb-col-date, .cb-col-views { text-align: center; color: var(--cb-muted); font-size: 14px; }
.cb-col-author { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 6px; }
.cb-col-title { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 14px 12px; }
.cb-subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-list .cb-row:hover { background: var(--cb-primary-soft); }
.cb-list a.cb-col-title:hover .cb-subject { color: var(--cb-primary); text-decoration: underline; text-underline-offset: 3px; }
.cb-row.is-notice { background: #fafbfd; }
.cb-row.is-notice .cb-subject { font-weight: 600; }
.cb-badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  background: var(--cb-primary); color: #fff; font-size: 12px; font-weight: 600; line-height: 1.6;
}
.cb-new {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  background: #f06a4a; color: #fff; font-size: 10px; font-weight: 700; flex: none;
}
.cb-ico { font-size: 13px; flex: none; }
.cb-empty { padding: 60px 20px; text-align: center; color: var(--cb-muted); }

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

/* ---------- 페이지 번호 ---------- */
.cb-pager { display: flex; justify-content: center; gap: 6px; margin-top: 28px; flex-wrap: wrap; }
.cb-pager a, .cb-pager strong {
  min-width: 36px; height: 36px; padding: 0 8px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--cb-radius-sm); font-size: 14px;
}
.cb-pager a { color: var(--cb-muted); border: 1px solid transparent; }
.cb-pager a:hover { border-color: var(--cb-line); background: #fff; color: var(--cb-primary); }
.cb-pager strong { background: var(--cb-primary); color: #fff; }

/* ---------- 글 보기 ---------- */
.cb-view { padding: 0; overflow: hidden; }
.cb-view-head { padding: 28px 32px 20px; border-bottom: 1px solid var(--cb-line); }
.cb-view-head .cb-badge { margin-bottom: 10px; }
.cb-view-title { margin: 0 0 10px; font-size: 24px; font-weight: 700; line-height: 1.4; letter-spacing: -0.01em; word-break: keep-all; }
.cb-meta { display: flex; gap: 16px; flex-wrap: wrap; color: var(--cb-muted); font-size: 14px; }
.cb-content { padding: 32px; min-height: 200px; font-size: 16px; line-height: 1.85; word-break: keep-all; overflow-wrap: anywhere; }
.cb-content a { color: var(--cb-primary); text-decoration: underline; text-underline-offset: 3px; }
.cb-figure { margin: 16px 0; }
.cb-figure img { display: block; max-width: 100%; height: auto; border-radius: var(--cb-radius-sm); }

.cb-files { margin: 0 32px 28px; padding: 16px 20px; background: var(--cb-primary-soft); border-radius: var(--cb-radius-sm); }
.cb-files-title { margin: 0 0 8px; font-size: 14px; font-weight: 600; color: var(--cb-primary); }
.cb-files ul { list-style: none; margin: 0; padding: 0; }
.cb-files li { padding: 3px 0; font-size: 15px; }
.cb-files a:hover { color: var(--cb-primary); text-decoration: underline; }
.cb-size { color: var(--cb-muted); font-size: 13px; margin-left: 4px; }

.cb-prevnext { margin-top: 16px; overflow: hidden; }
.cb-prevnext > div { display: flex; gap: 16px; align-items: center; padding: 14px 24px; font-size: 15px; min-width: 0; }
.cb-prevnext > div + div { border-top: 1px solid var(--cb-line); }
.cb-prevnext a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-prevnext a:hover { color: var(--cb-primary); text-decoration: underline; }
.cb-pn-label { flex: none; width: 52px; color: var(--cb-muted); font-size: 14px; }
.cb-muted { color: var(--cb-muted); }

/* ---------- 글쓰기 / 로그인 ---------- */
.cb-form { padding: 32px; }
.cb-form-title { margin: 0 0 24px; font-size: 22px; }
.cb-field { display: block; margin-bottom: 20px; }
.cb-field > span { display: block; margin-bottom: 8px; font-weight: 600; font-size: 15px; }
.cb-field input[type=text], .cb-field input[type=password], .cb-field textarea {
  width: 100%; padding: 12px 14px; font: inherit; color: var(--cb-text);
  border: 1px solid var(--cb-line); border-radius: var(--cb-radius-sm); background: #fff;
}
.cb-field textarea { resize: vertical; line-height: 1.7; min-height: 280px; }
.cb-field input:focus, .cb-field textarea:focus { outline: none; border-color: var(--cb-primary); box-shadow: 0 0 0 3px var(--cb-primary-soft); }
.cb-field input[type=file] {
  width: 100%; padding: 14px; font: inherit; font-size: 14px;
  border: 1px dashed var(--cb-line); border-radius: var(--cb-radius-sm); background: #fafbfc;
}
.cb-check { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; cursor: pointer; font-size: 15px; }
.cb-check input { width: 18px; height: 18px; accent-color: var(--cb-primary); }
.cb-existing { list-style: none; margin: 0; padding: 0; }
.cb-existing .cb-check { margin-bottom: 6px; }
.cb-help { display: block; margin-top: 8px; color: var(--cb-muted); font-size: 13px; line-height: 1.6; }
.cb-error { padding: 10px 14px; border-radius: var(--cb-radius-sm); background: #fdeeee; color: var(--cb-danger); font-size: 14px; }
.cb-login { max-width: 440px; margin: 20px auto 0; }
.cb-msg { padding: 40px; text-align: center; }
.cb-msg p { margin: 0 0 20px; }

/* ---------- 본문 서식 (글 보기 + 편집 칸 공통) ---------- */
.cb-content p, .cb-rich p { margin: 0; min-height: 1em; }
.cb-content h1, .cb-content h2, .cb-rich h1, .cb-rich h2 { font-size: 1.6em; line-height: 1.35; margin: 1em 0 .5em; }
.cb-content h3, .cb-rich h3 { font-size: 1.3em; line-height: 1.4; margin: .9em 0 .4em; }
.cb-content h4, .cb-rich h4 { font-size: 1.1em; line-height: 1.5; margin: .8em 0 .3em; }
.cb-content > :first-child, .cb-rich > :first-child { margin-top: 0; }
.cb-content blockquote, .cb-rich blockquote {
  margin: .8em 0; padding: 10px 18px; border-left: 4px solid var(--cb-primary);
  background: var(--cb-primary-soft); border-radius: 0 var(--cb-radius-sm) var(--cb-radius-sm) 0; color: #444;
}
.cb-content ul, .cb-content ol, .cb-rich ul, .cb-rich ol { margin: .5em 0; padding-left: 1.6em; }
.cb-content hr, .cb-rich hr { border: 0; border-top: 1px solid var(--cb-line); margin: 1.4em 0; }
.cb-content img, .cb-rich img { max-width: 100%; height: auto; border-radius: var(--cb-radius-sm); vertical-align: middle; }
.cb-content table, .cb-rich table { border-collapse: collapse; margin: .8em 0; width: 100%; }
.cb-content td, .cb-content th, .cb-rich td, .cb-rich th { border: 1px solid #cfd5dd; padding: 6px 12px; min-width: 60px; vertical-align: top; }
.cb-content th, .cb-rich th { background: var(--cb-primary-soft); }
.cb-content .cb-table-wrap { overflow-x: auto; }

/* ---------- 글쓰기 편집기 ---------- */
.cb-editor-box { border: 1px solid var(--cb-line); border-radius: var(--cb-radius-sm); background: #fff; }
.cb-editor-box:focus-within { border-color: var(--cb-primary); box-shadow: 0 0 0 3px var(--cb-primary-soft); }
.cb-tb {
  display: flex; flex-wrap: wrap; gap: 4px; padding: 6px;
  border-bottom: 1px solid var(--cb-line); background: #fafbfc;
  border-radius: var(--cb-radius-sm) var(--cb-radius-sm) 0 0;
  position: sticky; top: 0; z-index: 5;
}
.cb-tb-group { display: flex; align-items: center; gap: 2px; padding-right: 6px; margin-right: 2px; border-right: 1px solid var(--cb-line); }
.cb-tb-group:last-child { border-right: 0; }
.cb-tb-btn {
  min-width: 32px; height: 32px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 6px; background: none;
  color: #444; font: inherit; font-size: 15px; cursor: pointer;
}
.cb-tb-btn:hover { background: #fff; border-color: var(--cb-line); color: var(--cb-primary); }
.cb-tb-btn.is-on { background: var(--cb-primary-soft); border-color: var(--cb-primary); color: var(--cb-primary); }
.cb-tb-wide { font-size: 13px; gap: 4px; padding: 0 10px; }
#cb-block-label { min-width: 3.2em; text-align: left; }
.cb-color-a { position: relative; font-weight: 700; line-height: 1; padding-bottom: 4px; }
.cb-color-a i { position: absolute; left: -2px; right: -2px; bottom: -1px; height: 3px; border-radius: 2px; background: #e03131; }
.cb-color-bg { font-weight: 700; padding: 1px 4px; border-radius: 3px; background: #ffec99; line-height: 1.2; }

.cb-dd { position: relative; }
.cb-pop {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; z-index: 20;
  min-width: 150px; padding: 6px; background: #fff;
  border: 1px solid var(--cb-line); border-radius: var(--cb-radius-sm);
  box-shadow: 0 8px 24px rgba(20, 30, 50, .12);
}
.cb-pop.is-open { display: block; }
.cb-pop > button:not(.cb-swatch) {
  display: block; width: 100%; padding: 7px 10px; text-align: left;
  border: 0; border-radius: 6px; background: none; font: inherit; font-size: 14px; color: var(--cb-text); cursor: pointer;
}
.cb-pop > button:not(.cb-swatch):hover { background: var(--cb-primary-soft); color: var(--cb-primary); }
.cb-pop-narrow { min-width: 80px; max-height: 300px; overflow-y: auto; }
.cb-pop .cb-pop-h2 { font-size: 20px; font-weight: 700; }
.cb-pop .cb-pop-h3 { font-size: 17px; font-weight: 700; }
.cb-pop .cb-pop-h4 { font-size: 15px; font-weight: 700; }
.cb-pop .cb-pop-quote { border-left: 3px solid var(--cb-primary) !important; border-radius: 0 6px 6px 0 !important; }
.cb-pop-colors { min-width: 0; width: 176px; display: none; }
.cb-pop-colors.is-open { display: flex; flex-wrap: wrap; gap: 4px; }
.cb-swatch { width: 24px; height: 24px; padding: 0; border: 1px solid rgba(0,0,0,.12); border-radius: 5px; cursor: pointer; }
.cb-swatch:hover { transform: scale(1.12); box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--cb-primary); }
.cb-pop .cb-swatch-none { margin-top: 4px; font-size: 13px !important; text-align: center !important; border: 1px solid var(--cb-line) !important; }
.cb-pop-table { min-width: 0; }
.cb-grid { display: grid; grid-template-columns: repeat(8, 18px); gap: 3px; }
.cb-grid span { width: 18px; height: 18px; border: 1px solid #d5dae1; border-radius: 3px; background: #fff; cursor: pointer; }
.cb-grid span.on { background: var(--cb-primary-soft); border-color: var(--cb-primary); }
.cb-grid-label { margin: 6px 0 0; font-size: 12px; color: var(--cb-muted); text-align: center; }

.cb-editor {
  min-height: 360px; max-height: 70vh; overflow-y: auto;
  padding: 18px 20px; outline: none; font-size: 16px; line-height: 1.85; word-break: keep-all; overflow-wrap: anywhere;
}
.cb-editor.is-empty::before { content: attr(data-placeholder); color: #aab1bc; position: absolute; pointer-events: none; }
.cb-editor.is-uploading { cursor: progress; opacity: .7; }
.cb-editor img { cursor: default; }

/* ---------- 하단 ---------- */
.cb-foot { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 40px; }
.cb-admin-badge { font-size: 12px; color: var(--cb-primary); background: var(--cb-primary-soft); padding: 2px 10px; border-radius: 999px; }

/* ---------- 모바일 ---------- */
@media (max-width: 640px) {
  .cb-wrap { padding: 24px 14px 40px; }
  .cb-head { align-items: flex-start; flex-direction: column; gap: 12px; }
  .cb-title { font-size: 22px; }
  .cb-toolbar { flex-direction: column; align-items: stretch; }
  .cb-search input { flex: 1 1 0; width: 0; min-width: 0; }
  .cb-search select { flex: none; width: 104px; }
  .cb-row-head { display: none; }
  .cb-row { grid-template-columns: auto auto auto 1fr; grid-template-areas: "title title title title" "num author date views"; padding: 12px 16px; min-height: 0; }
  .cb-col-num { display: none; }
  .cb-row.is-notice .cb-col-num { display: block; grid-area: num; margin-right: 8px; }
  .cb-col-title { grid-area: title; padding: 0 0 4px; }
  .cb-col-author { grid-area: author; font-size: 13px; text-align: left; }
  .cb-col-author::after { content: "·"; margin: 0 6px; color: #c3c9d2; }
  .cb-col-date { grid-area: date; text-align: left; font-size: 13px; }
  .cb-col-views { grid-area: views; font-size: 13px; text-align: right; }
  .cb-col-views::before { content: "조회 "; }
  .cb-view-head { padding: 22px 20px 16px; }
  .cb-view-title { font-size: 20px; }
  .cb-content { padding: 22px 20px; }
  .cb-files { margin: 0 20px 20px; }
  .cb-prevnext > div { padding: 12px 18px; }
  .cb-form { padding: 22px 18px; }
}

/* 작성자 입력칸은 이름 길이에 맞게 짧게 */
.cb-field-author input[type=text] { max-width: 320px; }

/* HTML 코드 보기 */
.cb-field .cb-source, .cb-source {
  display: block; width: 100%; min-height: 360px; max-height: 70vh; padding: 16px 18px; border: 0; box-shadow: none; resize: vertical;
  font: 13px/1.6 Consolas, "D2Coding", Menlo, monospace; color: #1d2733; background: #fbfcfd; outline: none;
  border-radius: 0 0 var(--cb-radius-sm) var(--cb-radius-sm); tab-size: 2; white-space: pre-wrap;
}
.cb-source[hidden], .cb-editor[hidden] { display: none; }
.cb-tb.is-source .cb-tb-btn:not([data-cmd=source]):not([data-cmd=htmlFile]) { opacity: .35; pointer-events: none; }
.cb-tb-html .cb-tb-btn svg { flex: none; }
