/* ── 1. 기본 초기화 ── */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Malgun Gothic', '맑은 고딕', sans-serif;
    background: #f3f3f3;
    font-size: 14px;
    color: #222;
}

.container {
    max-width: 1160px; 
    margin: 0 auto;
    background: #ffffff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── 2. 상단 로고 및 유틸 영역 ── */
.header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    background: #fff;
    position: relative;
}

.logo-area { padding: 5px 0px; }
.logo-area img { display: block; height: 48px; }

.top-util { display: flex; gap: 12px; padding-right: 20px; }
.top-util a { font-size: 12px; color: #555; text-decoration: none; }
.top-util a.orange { color: #e07000; font-weight: 700; }

/* ── 3. 그린 메뉴바 & 배너 (왼쪽 정렬 수정) ── */
.header-banner-group {
    margin-bottom: 10px;
}

header {
    background: #26734d; 
    color: white; 
    padding: 7px 0; 
    font-weight: bold; 
    width: 100%; /* 너비 명시 */
}

.main-nav {
    display: flex;
    width: 100%;
    justify-content: flex-start; /* [수정] 왼쪽 정렬 고정 */
    list-style: none;
    gap: 25px; /* 항목 간 간격 - PC 기준 */
    padding-left: 25px;
}

.main-nav li {
    flex-shrink: 0;
    white-space: nowrap;
}

.main-nav li a {
    color: #fff;
    text-decoration: none;
    font-size: 15px;
    font-weight: bold;
    padding: 10px 0;
    display: block;
}

.banner-area { line-height: 0; font-size: 0; }
.banner-area img { width: 100%; display: block; }

/* ── 4. 중앙 레이아웃 ── */
.contents-wrap {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 20px;
    padding: 10px; 
}

/* 사이드바 */
.sidebar { display: flex; flex-direction: column; gap: 10px; }

.side-box {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px;
    font-size: 12px;
    color: #555;
    line-height: 1.8;
}
.side-box .stat-box{
    text-align: center;
} 
.side-menu-box {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}
.side-menu-list,
.side-submenu-list { list-style: none; }
.side-menu-list li a,
.side-submenu-list li a {
    display: block;
    padding: 7px 12px;
    font-size: 12px;
    color: #333;
    text-decoration: none;
    border-bottom: 1px solid #f0f0f0;
}
.side-menu-list li:last-child a,
.side-submenu-list li:last-child a { border-bottom: none; }
.side-menu-box-tween { display: none;}
.side-menu-list li a:hover,
.side-submenu-list li a:hover { background: #f7f5f0; color: #1a3a6b; }

/* ── 5. 메인 게시판 ── */
.board-section { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.board-item { margin-bottom: 20px; }
.board-title { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #555; padding-bottom: 5px; margin-bottom: 10px; font-size: 14px; font-weight: bold; }
.board-title a { text-decoration: none; }

.post-list { list-style: none; }
.post-list li { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; font-size: 13px; color: #555; }
.post-list .subject { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-right: 10px; max-width: 52ch; }
.post-list span:last-child { white-space: nowrap; flex-shrink: 0; }

/* ── 6. 푸터 ── */
.footer { background: #1a3a6b; color: rgba(255,255,255,0.8); text-align: center; padding: 20px; border-radius: 8px; font-size: 12px; margin-top: auto; }
.footer-links a { color: #fff; text-decoration: none; margin-right: 15px; font-weight: bold; }

/* ── 7. 햄버거 버튼 & 오버레이 ── */
.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 30px;
    height: 30px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
}
.hamburger-btn span { display: block; width: 24px; height: 2px; background: #1a3a6b; border-radius: 2px; transition: 0.3s ease-in-out; }
.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); }

.sidebar-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 999; }
.sidebar-overlay.open { display: block; }

.sidebar-close {
    text-align: right;
    padding-right: 10px;
    display: none;
}

/* 1. 사이드바와 메인 게시판을 감싸는 부모 */
.contents-wrap {
    display: flex !important;
    align-items: flex-start; /* 자식 요소들이 각자 높이에 맞춰 정렬 (밀림 방지 핵심) */
    gap: 20px;               /* 메뉴와 게시판 사이 간격 */
    max-width: 1200px;
    margin: 0 auto;
}

/* 2. 왼쪽 사이드바 고정 */
.sidebar {
    width: 200px;            /* 너비 고정 */
    flex-shrink: 0;          /* 게시판에 밀려 너비가 줄어들지 않도록 설정 */
    /* 사이드바가 길어도 메인 내용에 영향을 주지 않음 */
}

/* 3. 오른쪽 메인 게시판 영역 */
.board-section {
    flex-grow: 1;            /* 남은 공간을 모두 차지 */
    display: flex;
    flex-wrap: wrap;         /* 게시판 아이템들이 가로로 배치되다가 넘치면 아래로 */
    gap: 20px;
}

/* 4. 개별 게시판 아이템 (공지, 자유, 동문, 안부) */
.board-item {
    /* 2단 배열을 원하실 경우 */
    width: calc(50% - 10px); 
    min-width: 300px;        /* 너무 좁아지면 아래로 내려감 */
}

/* 5. 모바일 대응 (사이드바가 햄버거 메뉴로 변할 때) */
@media (max-width: 767px) {
    .contents-wrap {
        display: block !important; /* 모바일에서는 다시 위아래 배치 */
    }
    .board-item {
        width: 100%;           /* 모바일은 한 줄에 하나씩 */
    }
    .side-menu-box {
        margin-top: 10px;
    }
}

/* ── 8. 반응형 통합 (768px 이하) ── */
@media (max-width: 768px) {
    .top-util { display: none; }
    .hamburger-btn { display: flex; margin-right: 5px; }

    .contents-wrap { grid-template-columns: 1fr; }
    .board-section { grid-template-columns: 1fr; }
    
    /* 모바일 메인 내비 왼쪽 정렬 유지 및 간격 조정 */
    .main-nav {
        justify-content: flex-start;
        gap: 15px; /* 모바일에서는 간격을 조금 좁힘 */
        padding: 0 5px;
        font-size: 12px;
    }
    .main-nav::-webkit-scrollbar { display: none; }
    .main-nav li a { font-size: 12px; }

    .sidebar {
        position: fixed;
        top: 0; left: -270px;
        width: 260px; height: 100%;
        background: #fff;
        z-index: 1000;
        padding: 20px;
        box-shadow: 2px 0 10px rgba(0,0,0,0.2);
        transition: left 0.3s ease-in-out;
        overflow-y: auto;
    }
    .sidebar.open { left: 0; }
    .post-list .subject { max-width: 35ch; }

    .sidebar-close {
        display: inline-block;
    }
    
}

@media (max-width: 480px) {
    header { padding-left: 25px; }
    .header-top-row { padding: 5px; }
    .logo-area img { width: 134px; height: auto; margin-left: 5px; }
    /* 모바일 가로 공간 부족 대비 */
    .post-list .subject { width: 28ch; } 
}