:root {
    --sidebar-width: 300px;
    --primary-color: #2c3e50;
    --background-color: #f5f6fa;
    --tab-bg-color: #e9eeef;
    --border-color: #dee2e6;
    --main-font: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* 기본 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    background: var(--background-color);
    background-image: none;
    display: flex;
}

/* 사이드바 스타일 */
#sidebar {
    width: 300px;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background-image: url('Blueprint - Seamless Blueprint RGB.jpg');
    background-repeat: repeat;
    border-right: 1px solid #ddd;
    overflow-y: auto;
    z-index: 1000;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.sidebar-header h2 {
    margin: 0;
    color: #ffffff;
    font-size: 1.2em;
}

.sidebar-content {
    padding: 20px;
}

.table-of-contents {
    list-style: none;
    padding: 0;
    margin: 0;
}

.table-of-contents li {
    margin-bottom: 6px;
}

/* 메인 챕터 간격 조정 - 직접적인 자식 선택자를 사용 */
.table-of-contents > li {
    margin-bottom: 20px !important; /* 글자 반개 이상 크기 */
}

.table-of-contents a {
    color: #ffffff;
    text-decoration: none;
    display: block;
    padding: 2px 0;
    transition: opacity 0.3s;
    opacity: 0.9;
    line-height: 1.3;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.table-of-contents a:hover {
    opacity: 1;
    text-decoration: underline;
}

.table-of-contents ul {
    list-style: none;
    padding-left: 15px;
    margin-top: 3px;
}

.table-of-contents ul li {
    margin-bottom: 3px;
}

.table-of-contents ul a {
    font-size: 0.9em;
    color: #ffffff;
    opacity: 0.8;
    line-height: 1.2;
}

.table-of-contents ul a:hover {
    opacity: 1;
    text-decoration: underline;
}

/* 메인 콘텐츠 영역 */
main {
    margin-left: var(--sidebar-width);
    height: 100vh; /* min-height: 100vh을 height: 100vh으로 변경 */
    display: flex;
    flex-direction: column;
    padding: 2rem;  /* 원래대로 유지 */
    background: var(--background-color);
    max-width: 800px;
    margin: 0 auto;
    margin-left: var(--sidebar-width);
    background-image: none;
    margin-right: 0;
}

/* 탭 스타일 */
.tab-container {
    display: flex;
    background: var(--tab-bg-color);
    border-radius: 8px 8px 0 0;
    overflow: hidden;
    margin-bottom: 2rem;  /* 이 부분을 원래대로 유지 */
}

.tab {
    padding: 1rem 2rem;
    cursor: pointer;
    transition: background-color 0.3s;
    word-break: keep-all;
    overflow-wrap: break-word;
    text-align: center;
}

.tab.active {
    background: white;
    font-weight: bold;
}

/* 콘텐츠 스타일 */
.content-container {
    background: white;
    padding: 2rem;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    height: calc(100vh - 150px);  /* 이 값은 조정이 필요할 수 있음 */
    overflow-y: auto;  /* 스크롤 추가 */
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 모바일 스타일 */
.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .mobile-only {
        display: block;
    }

    #sidebar {
        transform: translateX(-100%);
        z-index: 1000;
    }

    #sidebar.active {
        transform: translateX(0);
    }

    main {
        margin-left: 0;
        padding: 1rem;
    }

    .tab-container {
        margin-left: 45px; /* 햄버거 버튼 공간 */
    }

    #mobile-sidebar-toggle {
        position: fixed;
        left: 0.5rem;
        top: 1rem;
        z-index: 900;
        background: white;
        border: none;
        padding: 0.4rem;
        font-size: 1.3rem;
        border-radius: 4px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    .tab {
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
    }
}

/* 타이포그래피 */
h1 { font-size: 2rem; margin-bottom: 1.5rem; }
h2 { font-size: 1.5rem; margin-bottom: 1rem; }
h3 { font-size: 1.25rem; margin-bottom: 0.75rem; }
p { margin-bottom: 1rem; }

/* 콘텐츠 로딩 및 오류 스타일 */
.loading, .error {
    padding: 2rem;
    text-align: center;
    font-size: 1.2rem;
}

.loading {
    color: #666;
}

.error {
    color: #d9534f;
}

/* 챕터 내용 스타일 */
.chapter-content {
    padding: 20px;
    margin-top: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chapter-content h2 {
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
}

.chapter-content h3 {
    color: #444;
    margin: 25px 0 15px;
}

.chapter-content blockquote {
    background-color: #f8f9fa;
    border-left: 4px solid #007bff;
    padding: 15px;
    margin: 20px 0;
    font-style: italic;
}

.chapter-content p {
    line-height: 1.6;
    margin-bottom: 15px;
    color: #333;
}

/* 로딩 인디케이터 */
.loader {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 10px 20px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 5px;
    z-index: 1000;
}

/* 하이라이트 효과 */
.highlight-section {
    animation: highlight-pulse 2s ease-in-out;
}

@keyframes highlight-pulse {
    0% { background-color: transparent; }
    25% { background-color: rgba(255, 255, 0, 0.2); }
    50% { background-color: rgba(255, 255, 0, 0.3); }
    75% { background-color: rgba(255, 255, 0, 0.2); }
    100% { background-color: transparent; }
}

/* 오류 콘텐츠 스타일 */
.error-content {
    padding: 20px;
    background-color: #ffeeee;
    border: 1px solid #ffcccc;
    border-radius: 5px;
    color: #cc0000;
    margin: 20px 0;
}

/* 섹션 콘텐츠 스타일 */
.content-section {
    padding: 15px;
    margin-bottom: 25px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.content-section h3.page-title {
    font-size: 1.4rem;
    color: #2c3e50;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.content-section p {
    line-height: 1.7;
    margin-bottom: 12px;
}

/* 활성 링크 스타일 */
.sidebar a.active {
    font-weight: normal;  /* bold에서 normal로 변경 */
    color: #8EEDC7;       /* 흰색(#ffffff)에서 옅은 녹색으로 변경 */
    opacity: 1;
    text-decoration: underline;  /* 밑줄은 유지 */
}
