@charset "utf-8";

:root {
    --bg-page: #fff;
    --bg-box: #e6e3e3;
    --text-main: #333;
    --text-sub: #888;
    --link-color: #007bff; /* [추가] 라이트모드 기본 링크 색상 */
    --border-color: #ddd;
    --border-light: #eee;
    --border-strong: #333;
    --sidebar-bg: #343a40;
    --sidebar-box-bg: #252b31;
    --sidebar-box-border: #54585c;
    --sidebar-box-text: #ecf1f7;
    --sidebar-text: #fff;
    --sidebar-border: #4b545c;
    --sidebar-link: #c2c7d0;
}

body.dark-mode {
    --bg-page: #121212;
    --bg-box: #252525;
    --text-main: #e0e0e0;
    --text-sub: #aaa;
    --link-color: #4caf50; /* [수정] 다크모드 링크 색상 (그린 계열) */
    --border-color: #353434;
    --border-light: #333;
    --border-strong: #888;
    --sidebar-bg: #000;
    --sidebar-box-bg: #111316;
    --sidebar-box-border: #17191b;
    --sidebar-box-text: #ccdbeb;
    --sidebar-text: #ccc;
    --sidebar-border: #333;
    --sidebar-link: #888;
}

body { margin: 0; padding: 0; font-family: 'Noto Sans KR', 'Malgun Gothic', sans-serif; color: var(--text-main); background: var(--bg-page); }
/* [수정] 기본 링크 색상을 변수로 지정 */
a { text-decoration: none; color: var(--link-color); }

/* [추가] 사이드바나 특정 영역처럼 글자색을 따라가야 하는 곳은 예외처리 */
.sidebar a, .mobile-header a, .post-item .subject a { color: inherit; }

ul { list-style: none; padding: 0; margin: 0; }

/* 레이아웃 */
.wrapper { display: flex; min-height: 100vh; }
.sidebar { width: 300px; background: var(--sidebar-bg); color: var(--sidebar-text); padding: 20px; box-sizing: border-box; flex-shrink: 0; }
.content { flex: 1; padding: 30px; background: var(--bg-page); }

/* 모바일 헤더 (기본 숨김) */
.mobile-header { display: none; background: var(--sidebar-bg); padding: 15px; color: var(--sidebar-text); justify-content: space-between; align-items: center; }
.mobile-header h1 { margin: 0; font-size: 1.2rem; }
.mobile-header h1 a { color: var(--sidebar-text); }
.btn-menu { background: transparent; border: 1px solid #adb5bd; color: inherit; padding: 5px 10px; border-radius: 4px; cursor: pointer; }
.btn-dark-toggle { background: transparent; border: none; color: inherit; font-size: 1.2rem; cursor: pointer; margin-right: 10px; }

/* 사이드바 메뉴 */
.sidebar h1 { font-size: 1.5rem; margin-bottom: 20px; border-bottom: 1px solid var(--sidebar-border); padding-bottom: 10px; margin-top: 0; display: flex; justify-content: space-between; align-items: center; }
.sidebar h1 a { color: var(--sidebar-text); }
.menu-tree ul { padding-left: 10px; }
.menu-tree li { margin: 5px 0; }
.menu-tree a { display: block; padding: 5px 10px; color: var(--sidebar-link); border-radius: 4px; }
.menu-tree a:hover, .menu-tree a.active { background: #0056b3; color: #fff; }
.menu-tree > ul { padding-left: 0; }

/* 게시판 리스트 */
.board-title { font-size: 1.8rem; margin-bottom: 20px; border-bottom: 2px solid var(--border-strong); padding-bottom: 10px; margin-top: 0; }
.post-list { background: var(--bg-box); border: 1px solid var(--border-color); border-radius: 4px; }
.post-item { display: flex; padding: 15px; border-bottom: 1px solid var(--border-light); align-items: center; }
.post-item:last-child { border-bottom: none; }
.post-item .subject { flex: 1; font-size: 1.1rem; font-weight: bold; }
.post-item .date { font-size: 0.9rem; color: var(--text-sub); margin-left: 15px; white-space: nowrap; }
.no-post { padding: 50px; text-align: center; color: var(--text-sub); }
.btn-write { display: inline-block; padding: 10px 20px; background: #28a745; color: white; border-radius: 4px; margin-bottom: 15px; }

/* 반응형 (768px 이하) */
@media (max-width: 768px) {
    .wrapper { display: block; position: relative; }
    .mobile-header { display: flex; }
    
    .sidebar { display: none; width: 100%; position: absolute; top: 0; left: 0; z-index: 1000; }
    .sidebar.active { display: block; }
    .sidebar h1 { display: none; } /* 모바일에서는 사이드바 내부 타이틀 숨김 */
    
    .content { padding: 15px; }
    .board-title { font-size: 1.4rem; }
    
    .post-item { flex-direction: column; align-items: flex-start; }
    .post-item .subject { margin-bottom: 5px; font-size: 1rem; }
    .post-item .date { margin-left: 0; font-size: 0.8rem; }
}

/* 아웃로그인 (사이드바) */
.outlogin-guest a, .outlogin-member a { color: var(--sidebar-text); font-size: 0.9rem; margin-right: 5px; text-decoration: none; }
.outlogin-guest a:hover, .outlogin-member a:hover { text-decoration: underline; }
.outlogin-member .member-info { color: var(--sidebar-text); margin-bottom: 5px; font-size: 0.95rem; }
.btn-admin { color: #ffc107 !important; }
.member-links { display: flex; flex-wrap: wrap; gap: 5px; }

/* --- 투표 스킨 --- */
.poll-skin-basic { 
    margin-top: 20px; 
    padding: 15px; 
    border: 1px solid var(--sidebar-box-border); 
    border-radius: 5px; 
    background: var(--sidebar-box-bg); 
    color: var(--sidebar-box-text); /* 사이드바의 흰색 글씨를 덮어쓰기 위해 필요 */
}
.poll-subject { 
    font-weight: bold; 
    font-size: 1.1em; 
    margin-bottom: 10px; 
    border-bottom: 2px solid var(--border-strong); 
    padding-bottom: 5px; 
}
.poll-list { list-style: none; padding: 0; margin: 0; }
.poll-list li { margin-bottom: 8px; }
.poll-result-bar { 
    height: 10px; 
    background: var(--border-light); 
    border-radius: 5px; 
    overflow: hidden; 
    margin-top: 3px; 
}
.poll-result-fill { 
    height: 100%; 
    background: var(--link-color); 
}
.poll-btn-area { margin-top: 15px; text-align: center; }
.poll-btn { 
    background: var(--text-main); 
    color: var(--bg-box); 
    border: none; 
    padding: 8px 20px; 
    border-radius: 4px; 
    cursor: pointer; 
    transition: opacity 0.2s;
}
.poll-btn:hover { 
    opacity: 0.8;
}

/* -----------------------------------------------------------------------------
 * 기본 사이트 전용 스타일 (head.php, tail.php 에서 이동)
 * -------------------------------------------------------------------------- */

/* 기본 사이트의 container 너비 조정 */
@media (min-width: 1200px) {
    .container {
        max-width: 1400px; /* 기본 1140px에서 확장 */
    }
}

/* 부트스트랩 네비게이션 바 링크 밑줄 제거 */
.navbar .nav-link,
.navbar .navbar-brand,
.dropdown-item {
    text-decoration: none;
}

/* 모바일 네비게이션 오버레이 처리 */
@media (max-width: 991.98px) { /* Bootstrap's lg breakpoint */
    /* 토글 버튼 클릭 시 메뉴가 본문을 밀지 않고 위로 덮도록 설정 */
    .navbar-collapse {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: var(--bg-box);
        z-index: 1050;
        border-bottom: 1px solid var(--border-color);
        box-shadow: 0 5px 10px rgba(0,0,0,0.1);
        padding: 0 1rem 1rem 1rem;
    }
}

/* 기본 네비게이션 바 배경색 (라이트 모드) */
.navbar {
    background-color: var(--bg-box);
}

/* 다크모드 네비게이션 스타일 */
body.dark-mode .navbar {
    background-color: var(--bg-box) !important;
    border-bottom-color: var(--border-color) !important;
}
body.dark-mode .navbar .navbar-brand,
body.dark-mode .navbar .nav-link {
    color: var(--text-main) !important;
}
body.dark-mode .navbar .nav-link:hover {
    color: var(--link-color) !important;
}
body.dark-mode .navbar-toggler {
    border-color: var(--border-color) !important;
}
body.dark-mode .navbar-toggler-icon {
    filter: invert(1); /* 아이콘 색상 반전 (검정->흰색) */
}
body.dark-mode .dropdown-menu {
    background-color: var(--bg-box);
    border-color: var(--border-color);
}
body.dark-mode .dropdown-item {
    color: var(--text-main);
}
body.dark-mode .dropdown-item:hover {
    background-color: var(--border-light);
}

/* 다크모드 네비게이션 버튼 대비율 수정 */
body.dark-mode .navbar .btn-outline-secondary {
    color: var(--text-sub);
    border-color: var(--text-sub);
}
body.dark-mode .navbar .btn-outline-secondary:hover {
    color: var(--bg-box);
    background-color: var(--text-sub);
}

/* 알림 UI 스타일 */
.notification-wrapper { position: relative; display: inline-block; }
.btn-notification { background: none; border: none; cursor: pointer; font-size: 1.2rem; padding: 0 5px; position: relative; color: var(--text-sub); text-decoration: none; line-height: 1; }
.notification-badge { position: absolute; top: -2px; right: 0; min-width: 18px; height: 18px; padding: 0 4px; background-color: red; color: white; border-radius: 9px; font-size: 11px; line-height: 18px; text-align: center; font-weight: bold; }
body.dark-mode .btn-notification {
    color: var(--text-sub);
}

/* 다크모드 푸터 상단 라인 색상 조정 */
body.dark-mode .border-top {
    border-color: var(--border-color) !important;
}

/* 기본 푸터 스타일 */
.site-footer {
    background-color: var(--bg-box);
}
/*
 =============================================
   에디터로 작성된 표 - 뷰어 출력 스타일
   ============================================= */
.mp-editor-table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
    border: 1px solid var(--border-color, #ccc);
}
.mp-editor-table td,
.mp-editor-table th {
    padding: 6px 8px;
    min-width: 30px;
    border: 1px solid var(--border-color, #ccc);
    color: var(--text-main, #333);
    background-color: var(--bg-page, #fff);
}

/* 다크모드 */
body.dark-mode .mp-editor-table td,
body.dark-mode .mp-editor-table th {
    border-color: var(--border-color) !important;
    color: var(--text-main) !important;
    background-color: var(--bg-box) !important;
}
 
     /* ============================================================
     * 출력(뷰어) 페이지용 반응형 표 CSS
     * 게시글을 보여주는 페이지 <head>에 아래 CSS를 추가하세요.
     * ============================================================
     */
     .mp-table-scroll-wrapper {
         overflow-x: auto;
          -webkit-overflow-scrolling: touch;
          width: 100%;
          display: block;
      }
      .mp-table-scroll-wrapper .mp-resp-badge { display: none; }
      .mp-table-scroll-wrapper table.mp-editor-table { min-width: 500px; }
     
      .mp-resp-badge { display: none; }
     
      @media screen and (max-width: 767px) {
          table.mp-editor-table[data-responsive="stack"] {
              display: block; width: 100% !important; border: none !important;
          }
          table.mp-editor-table[data-responsive="stack"] thead { display: none; }
          table.mp-editor-table[data-responsive="stack"] tbody,
          table.mp-editor-table[data-responsive="stack"] tr { display: block; width: 100%; }
          table.mp-editor-table[data-responsive="stack"] tr {
              margin-bottom: 14px;
              border: 1px solid #ddd;
              border-radius: 8px;
              overflow: hidden;
              box-shadow: 0 1px 6px rgba(0,0,0,0.08);
          }
          table.mp-editor-table[data-responsive="stack"] td {
              display: flex;
              width: 100%;
              box-sizing: border-box;
              text-align: left !important;
              border: none !important;
              border-bottom: 1px solid #eee !important;
              padding: 0 !important;
              align-items: stretch;
              background: #fff !important;
              min-height: 42px;
          }
          table.mp-editor-table[data-responsive="stack"] tr:nth-child(even) td {
              background: #fafafa !important;
          }
          table.mp-editor-table[data-responsive="stack"] td::before {
              content: attr(data-label);
              display: flex;
              align-items: center;
              font-weight: 700;
              width: 38%;
              min-width: 90px;
              max-width: 150px;
              flex-shrink: 0;
              color: #fff;
              background: #0d6efd;
              font-size: 0.82em;
              padding: 8px 10px;
              line-height: 1.3;
              word-break: keep-all;
          }
          table.mp-editor-table[data-responsive="stack"] td > * {
              padding: 8px 12px;
              flex: 1;
          }
          table.mp-editor-table[data-responsive="stack"] td:last-child { border-bottom: none !important; }
      }
     