/* ===== 기본 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { overflow-x: hidden; }
body {
    font-family: 'Malgun Gothic', 'Microsoft YaHei', 'PingFang SC', 'Noto Sans KR', 'Apple SD Gothic Neo',
                 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji', sans-serif;
    font-size: 14px; line-height: 1.5; color: #333; background: #f5f6f8;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }

/* ===== 전체 레이아웃 : 왼쪽 한 줄 사이드바 + 오른쪽 ===== */
.wrap { display: flex; min-height: 100vh; }

/* ---- 왼쪽 사이드바 ---- */
.sidebar {
    width: 230px; min-width: 230px; background: #fff;
    border-right: 1px solid #e4e6ea;
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
}
.logo {
    display: flex; align-items: center; gap: 8px;
    font-size: 18px; font-weight: 700; color: #1c5f3c;
    padding: 20px 18px; border-bottom: 1px solid #eef0f2;
}
.logo-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 6px;
    background: #1c5f3c; color: #fff; font-size: 16px;
}
.side-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.side-title {
    font-size: 12px; color: #999; font-weight: 700;
    margin: 14px 8px 6px;
}
.side-nav a {
    display: flex; justify-content: space-between; align-items: center;
    padding: 9px 12px; border-radius: 6px; color: #444;
    line-height: 1.2; white-space: nowrap; gap: 8px;
}
.side-nav a small { color: #aaa; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-nav a:hover { background: #f2f6f4; color: #1c5f3c; }
.side-nav a.on { background: #1c5f3c; color: #fff; }
.side-nav a.on small { color: #cfe3d8; }

.side-login {
    border-top: 1px solid #eef0f2; padding: 14px 16px;
}
.login-info { margin-bottom: 10px; font-size: 13px; }
.login-info .utype {
    display: inline-block; margin-left: 6px; padding: 1px 7px;
    font-size: 11px; border-radius: 10px; background: #e8f3ee; color: #1c5f3c;
}
.login-btns { display: flex; gap: 6px; }
.login-btns .btn { flex: 1; text-align: center; }

/* ---- 오른쪽 영역 ---- */
.right-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.top-header {
    background: #fff; border-bottom: 1px solid #e4e6ea;
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 24px; height: 52px; min-height: 52px; flex-shrink: 0;
    position: sticky; top: 0; z-index: 10;
}
.hd-nav { display: flex; gap: 4px; flex-wrap: nowrap; white-space: nowrap; }
.hd-nav a {
    padding: 8px 14px; border-radius: 6px; font-weight: 600; color: #555;
    display: inline-flex; align-items: center; line-height: 1.2; white-space: nowrap;
}
.hd-nav a:hover { background: #f2f6f4; color: #1c5f3c; }
.hd-right { display: flex; gap: 14px; font-size: 13px; color: #777; align-items: center; flex-wrap: nowrap; white-space: nowrap; }
.hd-right a:hover { color: #1c5f3c; }
.hd-right a, .hd-right span { line-height: 1.2; white-space: nowrap; }
.hd-user { color: #1c5f3c; font-weight: 600; }

/* 언어 전환 스위치 (한국어/中文) */
.lang-sw {
    display: inline-flex; border: 1px solid #d7dce0; border-radius: 14px;
    overflow: hidden; background: #fff;
}
.lang-sw a { padding: 3px 11px; font-size: 12px; color: #666; border-right: 1px solid #d7dce0; }
.lang-sw a:last-child { border-right: none; }
.lang-sw a:hover { color: #1c5f3c; }
.lang-sw a.on { background: #1c5f3c; color: #fff; border-color: #1c5f3c; }

.content { flex: 1; padding: 22px 24px; max-width: 1200px; width: 100%; margin: 0 auto; }

/* ===== 공통 컴포넌트 ===== */
.btn {
    display: inline-block; padding: 8px 16px; border: none; border-radius: 6px;
    background: #1c5f3c; color: #fff; font-size: 13px; font-weight: 600; text-align: center;
}
.btn:hover { background: #164d30; }
.btn.sm { padding: 6px 10px; font-size: 12px; }
.btn.line { background: #fff; color: #1c5f3c; border: 1px solid #1c5f3c; }
.btn.line:hover { background: #f2f6f4; }
.btn.gray { background: #eee; color: #555; }
.btn.gray:hover { background: #e0e0e0; }
.btn.warn { background: #c0392b; }

.panel {
    background: #fff; border: 1px solid #e4e6ea; border-radius: 10px;
    padding: 18px 20px; margin-bottom: 20px;
}
.panel-title {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 15px; font-weight: 700; color: #222;
    border-bottom: 2px solid #1c5f3c; padding-bottom: 10px; margin-bottom: 12px;
}
.panel-title .more { font-size: 12px; font-weight: 400; color: #999; }

/* 메인 그리드 */
.main-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* 최신글 목록 */
.latest-list li, .post-list li {
    list-style: none; display: flex; align-items: center;
    padding: 8px 0; border-bottom: 1px dashed #eceef0; gap: 8px;
}
.latest-list li:last-child, .post-list li:last-child { border-bottom: none; }
.latest-list .bdg, .post-list .bdg {
    font-size: 11px; padding: 2px 8px; border-radius: 4px; flex-shrink: 0; font-weight: 600;
}
.bdg.supply { background: #fdeeee; color: #c0392b; }
.bdg.demand { background: #eaf2fd; color: #1a56b0; }
.bdg.notice { background: #fdf6e3; color: #96700f; }
.latest-list a.t, .post-list a.t {
    flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.latest-list .d, .post-list .d { font-size: 12px; color: #aaa; flex-shrink: 0; }
.post-list .v { font-size: 12px; color: #aaa; flex-shrink: 0; }

/* ===== 게시판 ===== */
.board-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.board-head h1 { font-size: 20px; }
.board-head h1 small { font-size: 13px; color: #999; margin-left: 8px; }

table.board-tbl { width: 100%; border-collapse: collapse; background: #fff; }
.board-tbl th {
    background: #fafbfc; border-top: 2px solid #1c5f3c; border-bottom: 1px solid #e4e6ea;
    padding: 10px; font-size: 13px; color: #555;
}
.board-tbl td { border-bottom: 1px solid #f0f1f3; padding: 10px; text-align: center; }
.board-tbl td.tit { text-align: left; }
.board-tbl td.tit a { font-weight: 500; }
.board-tbl tr:hover td { background: #fafcfb; }
.board-tbl .no { color: #999; font-size: 12px; width: 60px; }
.board-tbl .writer, .board-tbl .dt { color: #888; font-size: 13px; }
.board-tbl .tc { color: #1a56b0; }

.board-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }

.search-box { display: flex; gap: 6px; }
.search-box select { padding: 7px; border: 1px solid #ccc; border-radius: 6px; }
.search-box input[type=text] { padding: 7px 10px; border: 1px solid #ccc; border-radius: 6px; width: 200px; }

.pagination { display: flex; justify-content: center; gap: 4px; margin-top: 18px; }
.pagination a, .pagination span {
    min-width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid #ddd; border-radius: 5px; font-size: 13px; background: #fff; padding: 0 6px;
}
.pagination .on { background: #1c5f3c; color: #fff; border-color: #1c5f3c; }
.pagination a:hover { border-color: #1c5f3c; color: #1c5f3c; }

/* 게시판 하단 : 한 번에 10/50/100개씩 보기 */
.perpage {
    display: flex; justify-content: center; align-items: center; gap: 6px;
    margin-top: 14px; flex-wrap: wrap;
}
.perpage .pp-label { font-size: 12px; color: #999; margin-right: 2px; }
.perpage a {
    padding: 5px 12px; border: 1px solid #d7dce0; border-radius: 16px;
    font-size: 12px; color: #555; background: #fff;
}
.perpage a:hover { color: #1c5f3c; border-color: #1c5f3c; }
.perpage a.on { background: #1c5f3c; color: #fff; border-color: #1c5f3c; }
.perpage a.on:hover { color: #fff; }

/* ===== 글쓰기 / 폼 ===== */
.form-wrap { max-width: 900px; margin: 0 auto; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.form-row input[type=text], .form-row input[type=password], .form-row input[type=email],
.form-row select, .form-row textarea {
    width: 100%; padding: 9px 12px; border: 1px solid #ccc; border-radius: 6px;
}
.form-row input:focus, .form-row textarea:focus { border-color: #1c5f3c; outline: none; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.form-inline { max-width: 460px; margin: 40px auto; }
.form-msg { color: #c0392b; font-size: 13px; margin: 10px 0; }

/* ===== 에디터 ===== */
.editor-toolbar {
    display: flex; gap: 4px; padding: 8px; background: #fafbfc;
    border: 1px solid #ccc; border-bottom: none; border-radius: 6px 6px 0 0; flex-wrap: wrap;
}
.editor-toolbar button, .editor-toolbar label.upload-btn {
    min-width: 32px; height: 32px; border: 1px solid #ddd; background: #fff;
    border-radius: 5px; font-size: 13px; display: inline-flex; align-items: center; justify-content: center;
    padding: 0 8px;
}
.editor-toolbar button:hover, .editor-toolbar label.upload-btn:hover { background: #f0f2f4; }
.editor-area {
    width: 100%; min-height: 320px; padding: 14px; border: 1px solid #ccc;
    border-radius: 0 0 6px 6px; outline: none; background: #fff;
    font-size: 14px; line-height: 1.7; overflow-y: auto;
}
.editor-area img { max-width: 100%; height: auto; }
/* 글 내용을 담는 숨김 textarea (에디터와 동기화용) */
#editor_html { display: none; }
.editor-tip { font-size: 12px; color: #999; margin-top: 6px; }
/* 큰글자 버튼 (A+) */
.editor-toolbar .big { font-size: 16px; font-weight: 700; color: #1c5f3c; }

/* ===== 글 보기 ===== */
.view-head { border-bottom: 2px solid #1c5f3c; padding-bottom: 12px; margin-bottom: 16px; }
.view-head h1 { font-size: 20px; margin-bottom: 10px; }
.view-meta { font-size: 13px; color: #888; display: flex; gap: 14px; align-items: center; }
.view-meta .bdg { font-size: 11px; padding: 2px 8px; border-radius: 4px; }
.view-body { line-height: 1.8; min-height: 200px; word-break: break-word; }
.view-body img { max-width: 100%; height: auto; }
.view-body p { margin: 0 0 8px; }
.view-body p:last-child { margin-bottom: 0; }
.view-files { margin-top: 16px; font-size: 13px; }
.view-files a { color: #1a56b0; display: inline-block; margin-right: 12px; }
.view-actions { display: flex; gap: 6px; justify-content: flex-end; margin-top: 20px; }

/* 댓글 */
.cmt-head { font-weight: 700; margin: 30px 0 10px; }
.cmt-item { border-top: 1px solid #f0f1f3; padding: 12px 0; }
.cmt-meta { font-size: 12px; color: #999; margin-bottom: 5px; display: flex; gap: 10px; }
.cmt-meta .del { color: #c0392b; }
.cmt-content { white-space: pre-wrap; }
.cmt-form textarea { width: 100%; min-height: 80px; padding: 10px; border: 1px solid #ccc; border-radius: 6px; }
.cmt-form .form-actions { margin-top: 8px; }

/* ===== 푸터 ===== */
.footer {
    background: #fff; border-top: 1px solid #e4e6ea;
    padding: 18px 24px; text-align: center; margin-top: 30px;
}
.foot-links { font-size: 13px; color: #777; margin-bottom: 8px; display: flex; justify-content: center; gap: 18px; flex-wrap: nowrap; white-space: nowrap; }
.foot-links a { line-height: 1.2; }
.foot-copy { font-size: 12px; color: #aaa; }

/* 반응형 */
@media (max-width: 900px) {
    .wrap { flex-direction: column; }
    .sidebar { width: 100%; min-width: 0; height: auto; position: static; }
    .main-grid { grid-template-columns: 1fr; }
    .top-header { flex-direction: column; height: auto; padding: 8px 16px; gap: 6px; }
    .hd-nav { justify-content: center; }
    .hd-right { justify-content: center; flex-wrap: wrap; }
    .board-foot { flex-direction: column; gap: 12px; }
    .search-box { width: 100%; }
    .search-box input[type=text] { flex: 1; width: auto; }
}

/* ===== 사용자 드롭다운 메뉴 (헤더 우상단) ===== */
.user-menu { position: relative; }
.user-menu-btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: #fff; border: 1px solid #d7dce0; border-radius: 16px;
    padding: 4px 10px 4px 4px; cursor: pointer; color: #1c5f3c; font-weight: 600;
    position: relative;
}
.user-menu-btn:hover { background: #f2f6f4; }
.user-menu-btn .avatar {
    width: 24px; height: 24px; border-radius: 50%; background: #1c5f3c; color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
}
.user-menu-btn .caret { font-size: 10px; color: #999; }
.user-menu-btn .hd-user { font-weight: 600; }
.user-menu-btn .badge-dot {
    position: absolute; top: 2px; right: 2px;
    width: 8px; height: 8px; border-radius: 50%; background: #e53e3e;
    border: 2px solid #fff;
}
.user-menu-panel {
    position: absolute; right: 0; top: 100%; margin-top: 6px;
    width: 240px; background: #fff; border: 1px solid #e4e6ea; border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.08); z-index: 100; padding: 6px 0;
    font-size: 13px;
}
.user-menu-panel[hidden] { display: none; }
.user-menu-head {
    padding: 10px 14px; border-bottom: 1px solid #f0f1f3; background: #f8faf9;
    border-radius: 10px 10px 0 0;
}
.user-menu-head .um-name { display: flex; align-items: center; gap: 6px; }
.user-menu-head .um-lv { font-size: 11px; background: #e8f3ee; color: #1c5f3c; padding: 1px 6px; border-radius: 8px; }
.user-menu-head .um-meta { font-size: 11px; color: #888; margin-top: 4px; }
.user-menu-panel a {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px; color: #333; line-height: 1.2; white-space: nowrap;
    position: relative;
}
.user-menu-panel a:hover { background: #f2f6f4; color: #1c5f3c; }
.user-menu-panel .um-ico { width: 16px; text-align: center; opacity: 0.85; }
.user-menu-panel .um-dot { flex: 1; }
.user-menu-panel .um-badge {
    background: #e53e3e; color: #fff; font-size: 10px;
    border-radius: 8px; padding: 1px 6px; margin-left: 4px;
}
.user-menu-panel a.logout { color: #c0392b; }
.user-menu-panel a.logout:hover { background: #fdeeee; }
.user-menu-sep { height: 1px; background: #f0f1f3; margin: 4px 0; }

/* ===== 마이페이지 공통 ===== */
.mypage-wrap { display: flex; flex-direction: column; gap: 12px; }
.mypage-head {
    display: flex; align-items: center; gap: 14px;
    padding: 16px 20px;
}
.mypage-avatar {
    width: 48px; height: 48px; border-radius: 50%;
    background: #1c5f3c; color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 700;
}
.mypage-info { flex: 1; }
.mypage-name { font-size: 16px; }
.mypage-name .mypage-lv {
    font-size: 11px; background: #e8f3ee; color: #1c5f3c;
    padding: 1px 8px; border-radius: 10px; margin-left: 6px;
}
.mypage-meta { font-size: 12px; color: #888; margin-top: 4px; }
.mypage-actions { flex-shrink: 0; }
.mypage-tabs {
    display: flex; flex-wrap: wrap; gap: 0;
    background: #fff; border: 1px solid #e4e6ea; border-radius: 10px;
    overflow: hidden;
}
.mypage-tabs a {
    flex: 1; text-align: center; padding: 12px 14px;
    font-size: 13px; font-weight: 600; color: #555;
    border-right: 1px solid #f0f1f3; white-space: nowrap;
    transition: background 0.15s;
}
.mypage-tabs a:last-child { border-right: none; }
.mypage-tabs a:hover { background: #f8faf9; color: #1c5f3c; }
.mypage-tabs a.on { background: #1c5f3c; color: #fff; }
.mypage-body { padding: 18px 20px; }
.mypage-title {
    font-size: 15px; font-weight: 700; color: #222;
    border-bottom: 2px solid #1c5f3c; padding-bottom: 10px; margin-bottom: 12px;
}
.mypage-subtabs {
    display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px;
}
.mypage-subtabs a {
    padding: 6px 12px; border: 1px solid #d7dce0; border-radius: 16px;
    font-size: 12px; color: #555; background: #fff;
}
.mypage-subtabs a.on { background: #1c5f3c; color: #fff; border-color: #1c5f3c; }
.mypage-subtabs a:hover { color: #1c5f3c; }
.mypage-subtabs a.on:hover { color: #fff; }
.mypage-stats, .mypage-favbar, .mypage-pointbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 0; font-size: 13px; color: #555;
    border-bottom: 1px solid #f0f1f3; margin-bottom: 10px;
}
.mypage-pointbar b { color: #1c5f3c; font-size: 16px; }

/* 환경설정 라디오 그룹 */
.radio-group { display: flex; gap: 18px; flex-wrap: wrap; padding: 4px 0; }
.radio-group label { font-weight: 400; font-size: 13px; color: #444; cursor: pointer; }
.radio-group input[type=radio] { margin-right: 4px; vertical-align: middle; }

/* 알리미 목록 */
.alert-list { list-style: none; }
.alert-list li {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 4px; border-bottom: 1px dashed #eceef0; font-size: 13px;
}
.alert-list li.unread { background: #fafcfb; }
.alert-list li.read { color: #888; }
.alert-list .alert-type {
    background: #e8f3ee; color: #1c5f3c; font-size: 11px; padding: 2px 8px;
    border-radius: 4px; min-width: 60px; text-align: center;
}
.alert-list .alert-body { flex: 1; display: flex; gap: 10px; align-items: center; }
.alert-list .alert-c { color: #666; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert-list .alert-d { font-size: 11px; color: #aaa; flex-shrink: 0; }

/* 쪽지 */
.mypage-msgtabs { display: flex; gap: 4px; margin-bottom: 12px; align-items: center; }
.mypage-msgtabs a {
    padding: 6px 12px; border: 1px solid #d7dce0; border-radius: 6px;
    font-size: 12px; color: #555; background: #fff;
}
.mypage-msgtabs a.on { background: #1c5f3c; color: #fff; border-color: #1c5f3c; }
.mypage-msgtabs .msg-spacer { font-size: 12px; color: #1a56b0; margin-left: auto; }
.mypage-msgbody .board-tbl tr.unread td.tit { font-weight: 700; }
.mypage-msgbody .new-dot {
    background: #e53e3e; color: #fff; font-size: 10px; padding: 1px 5px;
    border-radius: 3px; margin-left: 4px; font-weight: 700;
}
.msg-view {
    margin-top: 16px; padding: 14px; background: #fafcfb; border: 1px solid #eef0f2;
    border-radius: 8px;
}
.msg-view .msg-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 8px; }
.msg-view .msg-content { line-height: 1.7; white-space: pre-wrap; font-size: 14px; }
.msg-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid #f0f1f3; }

/* 마이페이지 폼 */
.mypage-form { max-width: 600px; }
.mypage-form input[type=date] { padding: 8px 10px; border: 1px solid #ccc; border-radius: 6px; }

/* ===== 관리자 페이지 ===== */
.admin-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card {
    background: #fff; border: 1px solid #e4e6ea; border-radius: 10px;
    padding: 16px 18px; display: flex; flex-direction: column; gap: 2px;
}
.stat-card b { font-size: 26px; color: #1c5f3c; }
.stat-card span { font-size: 13px; font-weight: 700; color: #555; }
.stat-card small { font-size: 11px; color: #aaa; margin-top: 4px; }
.admin-tabs a { flex: 1; }
@media (max-width: 900px) {
    .admin-grid { grid-template-columns: repeat(2, 1fr); }
}
