/* modam_doc — 네이버 카페형 개발문서 사이트 */
* { box-sizing: border-box; }
:root {
    --green: #03c75a;
    --green-d: #02b350;
    --ink: #222;
    --muted: #888;
    --line: #e5e7eb;
    --bg: #f5f6f7;
    --side-w: 250px;
}
html, body { margin: 0; padding: 0; }
body {
    font-family: "Malgun Gothic", "맑은 고딕", -apple-system, "Apple SD Gothic Neo",
                 "Segoe UI", sans-serif;
    color: var(--ink); background: var(--bg); font-size: 14px; line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- topbar ---- */
/* 상단바: modameng.com 네이비블루 테마 */
.topbar {
    display: flex; align-items: center; gap: 28px;
    background: #4a7fa8; border-bottom: 2px solid #5a92bc;
    padding: 0 20px; height: 56px; position: sticky; top: 0; z-index: 20;
    font-family: 'Segoe UI', Inter, -apple-system, "Malgun Gothic", sans-serif;
}
/* 로고: 테두리 없이 로고만 (modameng 상단 좌측처럼) */
.modamtech-icon { display: inline-flex; align-items: center; line-height: 0; }
.modamtech-icon:hover { text-decoration: none; }
.modamtech-icon img { height: 40px; width: auto; display: block; }
/* 상단 네비 메뉴: 선택(active) 시 주황색으로 변경 (modameng 방식) */
.topnav { display: flex; align-items: center; gap: 28px; }
.topnav-link { color: #fff; font-weight: 500; font-size: 16px; text-decoration: none; transition: color .15s; }
.topnav-link:hover { color: #fff; }
.topnav-link.active { color: #ff5600; font-weight: 700; }
.topsearch { margin-left: auto; display: flex; gap: 0; }
.topsearch input {
    width: 240px; height: 34px; border: 1px solid #4a729e; border-right: none;
    border-radius: 6px 0 0 6px; padding: 0 12px; outline: none;
    background: #5a92bc; color: #fff;
}
.topsearch input::placeholder { color: #dbe6f0; }
.topsearch button {
    height: 34px; border: none; background: #ff5600; color: #fff;
    padding: 0 16px; border-radius: 0 6px 6px 0; cursor: pointer; font-weight: 700;
}
.topsearch button:hover { background: #e64e00; }
.topuser { display: flex; align-items: center; gap: 10px; color: #eaf1f7; }
.topuser .uname { font-weight: 600; color: #fff; }
.topuser a { color: #fff; }
.inline { display: inline; margin: 0; }
.linkbtn { background: transparent; border: 1px solid #5a92bc; color: #fff; cursor: pointer; padding: 4px 12px; font-size: 13px; border-radius: 6px; }
.linkbtn:hover { background: #5a92bc; }

/* ---- layout ---- */
.layout { display: flex; align-items: flex-start; max-width: none; margin: 0; }
html.sb-collapsed .sidebar { display: none; }

.sidebar-toggle {
    background: transparent; border: 1px solid #5a92bc; border-radius: 6px;
    width: 36px; height: 36px; font-size: 18px; line-height: 1; cursor: pointer;
    color: #fff; display: inline-flex; align-items: center; justify-content: center;
}
.sidebar-toggle:hover { background: #5a92bc; }
.sidebar {
    width: var(--side-w); flex: 0 0 var(--side-w); background: #fff;
    border-right: 1px solid var(--line); padding: 16px 0;
    position: sticky; top: 56px;
    height: calc(100vh - 56px); overflow-y: auto;
}
.side-section { padding: 0 14px 10px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.side-top {
    display: block; padding: 8px 10px; border-radius: 6px; font-weight: 700;
    background: #eafaf0; color: var(--green-d);
}
.side-top.active { background: #eafaf0; color: var(--green-d); }
.side-top + .side-top { margin-top: 6px; }
.board.active { background: #fff9f2; color: #e11d1d; }
.side-fav { padding: 0 14px 10px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
/* 전체글보기(.side-top)와 동일한 녹색 박스, 캐럿만 오른쪽 */
.grp-name.fav-head {
    background: #eafaf0; color: var(--green-d); font-weight: 700; font-size: 14px;
    border: none; border-radius: 6px; padding: 8px 10px;
    justify-content: space-between;
}
.grp-name.fav-head:hover { background: #ddf5e6; }
.grp-name.fav-head .caret { font-size: 18px; color: var(--green-d); }
.side-fav .fav-item { padding: 6px 10px 6px 22px; color: #444; }
.side-fav .fav-item::before { content: "★"; color: #f5a623; margin-right: 5px; font-size: 12px; }

.boardnav { padding: 0 8px; }
.grp { margin-bottom: 6px; }
.grp-name {
    display: flex; align-items: center; gap: 5px; width: 100%;
    background: #eef1f4; color: #333; font-weight: 700; font-size: 14px;
    padding: 7px 10px; border: none;
    border-top: 1px solid #d7dde3; border-bottom: 1px solid #d7dde3;
    cursor: pointer; text-align: left; font-family: inherit; letter-spacing: .01em;
}
.grp-name:hover { background: #e5eaef; }
.grp-name .caret {
    font-size: 18px; color: #98a2ad; display: inline-block; transition: transform .15s;
}
.grp.collapsed .grp-name .caret { transform: rotate(-90deg); }
.grp.collapsed .grp-children { display: none; }
.grp-children { padding: 3px 0 2px; }
.board {
    display: block; padding: 7px 10px 7px 26px; border-radius: 6px; color: #444;
    font-size: 14px;
}
.board:hover { background: #f2f3f5; text-decoration: none; }
.board.top { padding-left: 10px; font-weight: 600; }
.fav { color: #f5a623; margin-right: 3px; }
.empty-nav { color: var(--muted); padding: 12px; font-size: 13px; }
.empty-nav code { background: #eee; padding: 2px 5px; border-radius: 4px; }

/* ---- content ---- */
.content { flex: 1 1 auto; padding: 22px 26px; min-width: 0; }
.list-head { display: flex; align-items: center; margin-bottom: 14px; }
.list-title { font-size: 22px; font-weight: 800; margin: 0; }
.list-head-actions { margin-left: auto; }

.searchbar {
    display: flex; gap: 8px; align-items: center; background: #fff; padding: 12px;
    border: 1px solid var(--line); border-radius: 8px; margin-bottom: 14px; flex-wrap: wrap;
}
.searchbar select, .searchbar input { height: 34px; border: 1px solid var(--line); border-radius: 6px; padding: 0 10px; }

.list-toolbar { display: flex; align-items: center; margin-bottom: 8px; }
.toolbar-right { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.chk { display: inline-flex; align-items: center; gap: 5px; color: #555; cursor: pointer; }
.chk.inline { margin-left: 12px; }
.mini { height: 32px; border: 1px solid var(--line); border-radius: 6px; padding: 0 8px; background: #fff; }

/* ---- 게시판 관리 ---- */
.manage-help { background: #f8fdf9; border: 1px solid #d7f0e0; color: #3a6b50; padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.msgs { margin-bottom: 12px; }
.msg { padding: 8px 12px; border-radius: 6px; font-size: 13px; margin-bottom: 6px; }
.msg.success { background: #eafaf0; color: #1f7a45; }
.msg.error { background: #fdecec; color: #c0392b; }
.maddbar { display: flex; gap: 18px; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin-bottom: 14px; }
.maddbar input[type=text], .maddbar select { height: 32px; border: 1px solid var(--line); border-radius: 6px; padding: 0 10px; }
.mtree { background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.mrow { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.mrow:last-child { border-bottom: none; }
.mrow.mgroup { background: #fafbfc; font-weight: 700; }
.mrow.depth1 { padding-left: 40px; }
.mkind { color: var(--muted); font-size: 12px; min-width: 44px; }
.mrename input[type=text] { height: 30px; border: 1px solid var(--line); border-radius: 6px; padding: 0 8px; width: 220px; }
.mcount { color: var(--muted); font-size: 12px; }
.mctrl { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.mctrl select { height: 30px; border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; }
.btn.xs { height: 28px; padding: 0 8px; font-size: 12px; }
.btn.xs.fav-on { color: #f5a623; border-color: #f5d08a; }

/* buttons */
.btn {
    display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 14px;
    border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer;
    font-size: 13px; color: #333;
}
.btn:hover { border-color: #cbd0d6; text-decoration: none; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; font-weight: 700; }
.btn.primary:hover { background: var(--green-d); }
.btn.danger { color: #d33; }
.btn.danger:hover { border-color: #d33; }
.btn.full { width: 100%; justify-content: center; height: 40px; }

/* table */
.doclist { width: 100%; border-collapse: collapse; background: #fff; border-top: 2px solid #333; }
.doclist th, .doclist td { padding: 11px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.doclist thead th { font-size: 13px; color: #555; background: #fafbfc; }
.doclist .c-chk { width: 34px; text-align: center; }
.doclist .c-no { width: 64px; text-align: center; color: var(--muted); }
.doclist .c-author { width: 110px; color: #555; }
.doclist .c-date { width: 96px; color: var(--muted); }
.doclist .c-num { width: 56px; text-align: center; color: var(--muted); }
.doclist td.c-title a { font-weight: 600; }
.doclist td.c-title a:hover { color: var(--green-d); }
.doclist tr.notice { background: #f8fdf9; }
.doclist tr:hover { background: #fcfcfc; }
.doclist .empty { text-align: center; color: var(--muted); padding: 40px 0; }
.badge { background: var(--green); color: #fff; font-size: 11px; padding: 2px 6px; border-radius: 4px; font-weight: 700; }
.clip { color: var(--muted); font-size: 12px; margin-left: 6px; }
.tag { color: #4a86c5; font-size: 12px; margin-left: 6px; }
.board-tag { background: #eef1f4; color: #666; font-size: 11px; padding: 2px 6px; border-radius: 4px; margin-left: 6px; }

/* pager */
.pager { display: flex; gap: 4px; justify-content: center; margin: 18px 0 6px; }
.pager a, .pager span { min-width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.pager .cur { background: var(--green); color: #fff; border-color: var(--green); font-weight: 700; }
.list-foot { text-align: center; color: var(--muted); font-size: 12px; }

/* ---- editor ---- */
.docform { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 18px; }
.field-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.field-row > label { width: 70px; flex: 0 0 70px; color: #555; font-weight: 600; }
.field-row select, .field-row input[type=text], .field-row input[type=file] {
    height: 34px; border: 1px solid var(--line); border-radius: 6px; padding: 0 10px;
}
.title-input { width: 100%; font-size: 16px; font-weight: 600; }
.editor-wrap { margin-bottom: 14px; }
.editor-hint { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 6px; }
.editor { display: flex; gap: 12px; margin-bottom: 14px; }
.editor-pane { flex: 1 1 50%; min-width: 0; }
.editor-label { font-size: 12px; color: var(--muted); margin-bottom: 4px; display: flex; justify-content: space-between; }
.editor textarea {
    width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 12px;
    font-family: Consolas, "D2Coding", monospace; font-size: 13px; resize: vertical;
}
.preview {
    border: 1px solid var(--line); border-radius: 6px; padding: 12px; min-height: 200px;
    background: #fcfcfc; overflow: auto;
}
.form-actions { display: flex; gap: 8px; }

/* ---- doc view ---- */
.docview { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 24px; }
.dv-crumb { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.dv-title { font-size: 24px; margin: 0 0 10px; }
.dv-meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 18px; }
.dv-body { min-height: 120px; }
.dv-files { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 14px; }
.dv-files-label { font-weight: 700; margin-bottom: 6px; }
.dv-files ul { margin: 0; padding-left: 18px; }
.fsize { color: var(--muted); font-size: 12px; }
.dv-actions { display: flex; gap: 8px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); align-items: center; }
.dv-actions-top { margin-top: 0; padding-top: 0; border-top: none; margin-bottom: 20px; }

/* ---- markdown body ---- */
.markdown-body h1, .markdown-body h2 { border-bottom: 1px solid var(--line); padding-bottom: .3em; margin-top: 1.2em; }
.markdown-body h1 { font-size: 1.6em; }
.markdown-body h2 { font-size: 1.35em; }
.markdown-body h3 { font-size: 1.15em; }
.markdown-body pre { background: #f6f8fa; padding: 12px; border-radius: 6px; overflow: auto; }
.markdown-body code { font-family: Consolas, "D2Coding", monospace; }
.markdown-body p code, .markdown-body li code { background: #eef1f4; padding: 1px 5px; border-radius: 4px; font-size: .92em; }
.markdown-body pre code { background: none; padding: 0; }
.markdown-body table { border-collapse: collapse; margin: 12px 0; }
.markdown-body th, .markdown-body td { border: 1px solid var(--line); padding: 6px 12px; }
.markdown-body th { background: #fafbfc; }
.markdown-body blockquote { border-left: 4px solid var(--line); margin: 12px 0; padding: 4px 14px; color: #555; }
.markdown-body img { max-width: 100%; }
.markdown-body .video-embed { max-width: 960px; margin: 14px 0; }
.markdown-body .yt-toggle { color: #c0392b; font-weight: 600; cursor: pointer; }
.markdown-body .yt-toggle::before { content: "\25B6"; font-size: .8em; margin-right: 5px; }
.markdown-body .yt-toggle.open::before { content: "\25BC"; }
.markdown-body .video-embed iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 8px; display: block; }

/* ---- auth ---- */
.auth-body { background: var(--bg); display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 36px 30px; width: 340px; box-shadow: 0 4px 24px rgba(0,0,0,.05); }
.auth-brand { text-align: center; font-size: 24px; margin: 0; }
.auth-sub { text-align: center; color: var(--muted); margin: 4px 0 22px; }
.auth-card form { display: flex; flex-direction: column; gap: 10px; }
.auth-card input { height: 42px; border: 1px solid var(--line); border-radius: 8px; padding: 0 14px; font-size: 14px; }
.auth-error { background: #fdecec; color: #c0392b; padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; }
.auth-foot { text-align: center; color: var(--muted); margin-top: 16px; font-size: 13px; }
.auth-foot a { color: var(--green-d); font-weight: 700; }

@media (max-width: 720px) {
    .sidebar { display: none; }
    .topsearch input { width: 140px; }
}

/* ---- 본문 글자 크기 / 줄간격 프리셋 (편집 + 보기 공용) ---- */
/* 글자 크기: 선택 텍스트에 span.class 로 적용 */
.fs-sm { font-size: 0.8em; }
.fs-lg { font-size: 1.35em; }
.fs-xl { font-size: 1.7em; }
/* 문서 기본 글자 크기 / 줄간격 (CSS 변수, 문서 단위) */
#editor .toastui-editor-contents { font-size: var(--doc-fs, 12pt); }
#editor .toastui-editor-contents p,
#editor .toastui-editor-contents li { line-height: var(--doc-lh, 1.5); }
/* 서식 마커(doc-fmt/구버전 doc-lh)는 화면에 보이지 않음 */
.doc-fmt, .doc-lh { display: none !important; }
/* 커스텀 툴바 드롭다운 */
/* 에디터 서식 바 (글자 크기 / 줄간격) */
.fmt-bar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
    padding: 8px 10px; border: 1px solid var(--line); border-bottom: none;
    border-radius: 8px 8px 0 0; background: #fafbfc;
}
.fmt-group { display: flex; align-items: center; gap: 6px; }
.fmt-lbl { font-size: 12px; color: #555; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.fmt-lbl svg { color: #4a7fa8; }
.fmt-select, .fmt-num { height: 28px; border: 1px solid var(--line); border-radius: 5px; font-size: 12px; padding: 0 4px; background: #fff; color: #333; }
.fmt-num { width: 54px; }
.fmt-btn { height: 28px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: #333; font-size: 12px; padding: 0 10px; cursor: pointer; }
.fmt-btn:hover { background: #eef1f4; }
.fmt-sep { width: 1px; align-self: stretch; background: var(--line); margin: 0 2px; }
.fmt-num-lh { width: 56px; }
.fmt-unit { font-size: 12px; color: #555; }

/* 기존 첨부 목록 + 삭제 체크 */
.attach-list { list-style: none; margin: 0; padding: 0; }
.attach-list li { display: flex; align-items: center; gap: 8px; padding: 4px 0; flex-wrap: wrap; }
.attach-list .fsize { color: var(--muted); font-size: 12px; }
.attach-del { margin-left: auto; color: #c0392b; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.attach-del input { cursor: pointer; }
.attach-hint { color: var(--muted); font-size: 12px; margin-top: 6px; }
