/* ── 기본 리셋 ── */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Malgun Gothic', '맑은 고딕', sans-serif; background: #f3f3f3; color: #222; font-size: 14px; line-height: 1.6; }

/* ── 컨테이너 ── */
.container { max-width: 1160px; 
             margin: 0 auto; 
             background: #fff; 
             box-shadow: 0 0 10px rgba(0,0,0,0.1); 
}

/* ── 헤더 ── */
.header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    flex-wrap: wrap;
    gap: 10px;
}
.logo-area img { height: 45px; }
.top-util { display: flex; gap: 12px; font-size: 12px; color: #555; flex-wrap: wrap; }
.top-util a { text-decoration: none; color: inherit; }
.top-util a:hover { color: #1a3a6b; }

.header-banner-group header { background: #26734d; color: white; padding: 12px 20px; font-weight: bold; }
.header-banner-container { line-height: 0; border-bottom: 1px solid #ddd; }
.header-banner-container img { width: 100%; height: auto; display: block; }

/* ── 레이아웃 ── */
.contents-wrap { 
    display: grid; 
    /* 사이드바 230px 고정, 나머지는 본문(1fr)이 차지 */
    grid-template-columns: 210px 1fr; 
    gap: 10px; 
    padding: 10px; 
    align-items: start;
}

/* ── 사이드바 ── */
.sidebar { 
    display: flex; 
    flex-direction: column; 
    gap: 15px; 
    width: 210px; /* 명시적으로 210px 고정 */
}
.side-box { border: 1px solid #ddd; padding: 15px; text-align: center; border-radius: 5px; background: #fff; }
.side-menu-box { border: 1px solid #ddd; border-top: 3px solid #1a3a6b; border-radius: 0 0 5px 5px; overflow: hidden; }
.side-menu-list { list-style: none; }
.menu-item > a { display: block; padding: 12px 15px; text-decoration: none; color: #333; border-bottom: 1px solid #eee; font-weight: bold; }
.menu-item > a:hover { background: #f0f4f9; color: #1a3a6b; }

/* 서브메뉴 */
.sub-menu-list { list-style: none; background: #f9f9f9; display: none; }
.sub-menu-list.open { display: block; }
.sub-item { font-size: 13px; }
.sub-item > a { display: block; padding: 8px 15px 8px 30px; font-weight: normal; font-size: 13px; color: #666; text-decoration: none; border-bottom: 1px solid #f0f0f0; }
.sub-item > a:hover { color: #1a3a6b; background: #eef2f8; }
.sub-item.active > a { color: #1a3a6b; font-weight: bold; background: #eef2f8; }

/* ── 햄버거 버튼 (PC에서 숨김) ── */
.hamburger-btn {
    display: none;
    /*display: flex; *//* none에서 flex로 변경 (모바일 매체쿼리 안에서 처리 권장) */

    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;

    position: static;
}

.hamburger-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background: #1a3a6b;
    border-radius: 2px;
    transition: all 0.3s ease-in-out; /* 0.7초는 너무 느리므로 0.3~0.4초 권장 */
}

/* 클릭 시 상태 (X자 변경) */
.hamburger-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* 사이드바 닫기 버튼 (PC에서 숨김) */
.sidebar-close {
    display: none;
    width: 100%;
    padding: 10px 12px;
    background: #f0f0f0;
    border: none;
    cursor: pointer;
    font-size: 13px;
    text-align: right;
    color: #555;
    border-radius: 4px;
    margin-bottom: 10px;
}

/* ── 오버레이 ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.45);
    z-index: 99;
}
.sidebar-overlay.open { display: block; }

/* ── 게시판 본문 ── */
.board-section { min-width: 0; }
.board-item { border: 1px solid #ddd; border-radius: 8px; margin-bottom: 20px; overflow: hidden; background: #fff; }
.post-header { padding: 20px; border-bottom: 1px solid #eee; background: #fcfcfc; }
.post-subject { font-size: 18px; font-weight: bold; color: #1a3a6b; margin-bottom: 10px; word-break: break-word; }
.post-info { display: flex; gap: 15px; font-size: 12px; color: #777; flex-wrap: wrap; }
.view-content { padding: 20px; line-height: 1.8; min-height: 200px; overflow-x: auto; word-break: break-word; }
.view-content img { max-width: 100% !important; height: auto !important; }

/* 첨부파일 */
.attached-file { background: #f4f4f4; padding: 10px 20px; font-size: 0.9em; border-bottom: 1px solid #eee; }
.attached-file a { margin-left: 10px; color: #1a3a6b; text-decoration: none; }
.attached-file a:hover { text-decoration: underline; }

/* ── 검색 ── */
.search-box { text-align: right; margin: 20px 0; }
.search-box form { display: flex; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.search-box input { padding: 6px 10px; border: 1px solid #ddd; border-radius: 4px; font-size: 13px; }
.search-box button { padding: 6px 12px; border: none; border-radius: 4px; cursor: pointer; font-size: 13px; }

/* ── 게시판 목록 ── */
.board-list { border: 1px solid #ddd; border-radius: 8px; overflow: hidden; }
.post-list { list-style: none; }
.post-list li { display: flex; justify-content: space-between; align-items: center; padding: 10px 15px; border-bottom: 1px solid #eee; gap: 10px; }
.post-list li:last-child { border-bottom: none; }
.post-list li:nth-child(even) { background: #f8faf9; }
.post-list li:hover { background: #f0f4f9; }
.post-list a { flex: 1; text-decoration: none; color: #333; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.post-list a:hover { color: #769741; }
.post-list span { font-size: 13px; color: #222; white-space: nowrap; }

/* ── 페이지네이션 ── */
.pagination { display: flex; justify-content: center; gap: 5px; margin: 20px 0; flex-wrap: wrap; }
.pagination a { padding: 6px 12px; border: 1px solid #ddd; text-decoration: none; color: #333; border-radius: 4px; font-size: 13px; }
.pagination a:hover { background: #f0f4f9; color: #769741; }
.pagination a.active { background: #769741; color: #fff; border-color: #769741; }

/* ── 푸터 ── */
footer { margin-top: 50px; border-top: 1px solid #eee; padding: 20px; text-align: center; color: #888; font-size: 0.85em; }

/* ── 반응형 ── */
@media (max-width: 768px) {
    /* 텍스트 링크 숨기고 햄버거 버튼 표시 */
    .top-util { display: none; }
    .hamburger-btn { display: flex; }

    /* 1컬럼 레이아웃 */
    .contents-wrap { 
        grid-template-columns: 1fr; 
        padding: 12px; 
        gap: 12px; 
    }

    /* 사이드바 → 슬라이드 오버레이 */
    .sidebar {
        display: block !important;
        position: fixed;
        top: 0;
        left: -270px; /* 숨김 위치 */
        width: 260px; /* 모바일 슬라이드 메뉴일 때의 너비 (기호에 따라 조절) */
        height: 100%;
        background: #fff;
        z-index: 100;
        overflow-y: auto;
        padding: 15px;
        box-shadow: 2px 0 10px rgba(0,0,0,0.2);
        transition: left 0.3s ease;
        flex-direction: column;
        gap: 12px;
    }
    .sidebar.open { left: 0; }
    .sidebar-close { display: block; }

    .contents-wrap { 
        grid-template-columns: 1fr; /* 모바일은 1열로 전환 */
    }

    .post-subject { font-size: 15px; }
    .post-info { flex-direction: column; gap: 4px; }
    .view-content { padding: 14px; font-size: 13px; }
    .search-box form { justify-content: flex-start; }
    .search-box input { flex: 1; }
}

@media (max-width: 480px) {
    .header-top-row { padding: 10px; }
    .logo-area img { height: 36px; }
    .pagination a { padding: 5px 9px; font-size: 12px; }
}

@media (max-width: 480px) {
    /* 1. 세로 정렬(column)을 해제하고 가로 한 줄로 고정 */
    .post-list li { 
        flex-direction: row !important; /* 가로 정렬 강제 */
        justify-content: space-between;
        align-items: center;
        padding: 10px 12px;
        gap: 8px;
        white-space: nowrap; /* 리스트 자체가 줄바꿈되지 않도록 */
    }

    /* 2. 링크 영역이 가능한 넓게 차지하도록 */
    .post-list a { 
        display: flex;
        align-items: center;
        gap: 5px;
        flex: 1;
        min-width: 0; /* 중요: 내부 요소가 넘칠 때 잘리게 함 */
        overflow: hidden;
    }

    /* 3. 제목(subject)이 차지할 공간을 확보하고 넘치면 자르기 */
    .post-list .subject {
        display: inline-block;
        flex: 1; /* 남은 공간 다 차지 */
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis; /* ... 표시 */
        font-size: 14px;
    }

    /* 4. 날짜는 오른쪽 끝에 작게 고정 */
    .post-list li > span:last-child {
        font-size: 11px;
        color: #777;
        flex-shrink: 0; /* 날짜가 찌그러지지 않게 */
    }
}