/*
 * ===================================================================
 * 강의/챕터 상세 페이지 전용 스타일시트
 * -------------------------------------------------------------------
 * 이 파일은 single-lecture.php 템플릿의 모든 시각적 요소를 제어합니다.
 * - 3단 분리 레이아웃 (고정 헤더, 고정 사이드바, 스크롤 본문)
 * - 독립 스크롤 및 동적 UI 스타일
 * ===================================================================
 */

/* ==========================================================================
   1. 상단 고정 컨트롤 헤더
   ========================================================================== */
.sf-lt-one-sticky-header {
    background-color: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 50px;
    box-sizing: border-box;
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

.sf-lt-one-sticky-header__right {
    display: flex;
    gap: 0.5rem;
}

.sf-lt-one-icon-button {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: #555;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    transition: background-color 0.2s;
}
.sf-lt-one-icon-button:hover {
    color: #000;
    background-color: #f0f0f0;
}
.sf-lt-one-icon-button svg {
    width: 24px;
    height: 24px;
}

/* ==========================================================================
   2. 2단 레이아웃 및 독립 스크롤
   ========================================================================== */
.sf-lt-one-lecture-container {
    display: flex;
    /* 헤더 높이(50px)를 제외한 나머지 뷰포트 높이를 차지 */
    height: calc(100vh - 50px);
}

/* 로그인 상태일 때 관리자 툴바 높이만큼 추가로 빼줌 */
body.admin-bar .sf-lt-one-lecture-container {
    height: calc(100vh - 50px - 32px);
}

.sf-lt-one-lecture-sidebar {
    width: 300px;
    background-color: #f8f9fa;
    border-right: 1px solid #e0e0e0;
    flex-shrink: 0;
    height: 100%; /* 부모(container)의 높이를 100% 채움 */
    overflow-y: auto; /* 내용이 넘치면 스크롤 */
    transition: margin-left 0.3s ease-in-out;
}

.sf-lt-one-sidebar-inner {
    padding: 1.5rem;
}

.sf-lt-one-content-area-wide {
    flex-grow: 1;
    min-width: 0;
    height: 100%; /* 부모(container)의 높이를 100% 채움 */
    overflow-y: auto; /* 내용이 넘치면 스크롤 */
}

/* ==========================================================================
   3. 사이드바(목차) 내부 스타일
   ========================================================================== */
.sf-lt-one-sidebar-title {
    font-size: 1.2rem;
    margin: 0 0 1.5rem 0;
    padding-bottom: 1rem;
    border-bottom: 1px solid #ddd;
}
.sf-lt-one-sidebar-title a {
    color: inherit;
    text-decoration: none;
}
.sf-lt-one-sidebar-title a:hover {
    color: #0073aa;
}

.sf-lt-one-sidebar-nav ol {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sf-lt-one-sidebar-nav__item a {
    display: block;
    padding: 0.75rem 1rem;
    margin: 0.2rem 0;
    border-radius: 4px;
    color: #333;
    line-height: 1.4;
    transition: background-color 0.2s, color 0.2s;
}

.sf-lt-one-sidebar-nav__item a:hover {
    background-color: #e9ecef;
    text-decoration: none;
}

/* 현재 보고 있는 챕터를 강조하는 스타일 */
.sf-lt-one-sidebar-nav__item.is-current a {
    background-color: #0073aa;
    color: #fff;
    font-weight: bold;
}
.sf-lt-one-sidebar-nav__item.is-current a:hover {
    background-color: #005a87;
}

/* ==========================================================================
   4. 본문 콘텐츠 영역 스타일
   ========================================================================== */
.sf-lt-one-content-header {
    padding: 1rem 2rem;
    border-bottom: 1px solid #eee;
    background-color: #fafafa;
}
.sf-lt-one-breadcrumb { font-size: 0.9rem; color: #555; }
.sf-lt-one-breadcrumb__separator { margin: 0 0.5em; }
.sf-lt-one-breadcrumb__lecture-title { font-weight: 500; }

/*
 * .sf-lt-one-site-main
 * - 실제 글 내용이 들어가는 영역입니다.
 * - max-width: [수정됨] 가독성을 위해 본문의 최대 너비를 964px로 확장했습니다.
 */
.sf-lt-one-site-main {
    max-width: 964px;
    margin: 0 auto;
    padding: 2rem 3rem;
}

.sf-lt-one-entry-header { margin-bottom: 2rem; }
.sf-lt-one-entry-title { margin: 0; font-size: 2.2rem; line-height: 1.3; }
.sf-lt-one-entry-content p { margin-bottom: 1.5em; }

.sf-lt-one-chapter-navigation { margin-top: 3rem; border-top: 1px solid #eee; padding-top: 1.5rem; }
.sf-lt-one-nav-links { display: flex; justify-content: space-between; }
.sf-lt-one-nav-previous, .sf-lt-one-nav-next { max-width: 48%; }
.sf-lt-one-nav-next { text-align: right; }
.sf-lt-one-nav-links a { display: block; padding: 1rem; border: 1px solid #ddd; border-radius: 8px; transition: all 0.2s; }
.sf-lt-one-nav-links a:hover { background-color: #f5f5f5; border-color: #bbb; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.sf-lt-one-meta-nav { display: block; font-size: 0.8rem; color: #777; margin-bottom: 0.25rem; }
.sf-lt-one-post-title { font-weight: bold; color: #333; }

/* 댓글 영역 스타일 */
.sf-lt-one-comments-area {
    margin-top: 3rem;
}

/* ==========================================================================
   5. 사이드바 토글 & 반응형
   ========================================================================== */
.sidebar-hidden .sf-lt-one-lecture-sidebar {
    margin-left: -300px;
}

/* 화면 너비가 1024px 이하일 때 (태블릿, 모바일) */
@media screen and (max-width: 1024px) {
    .sf-lt-one-site-main {
        /* [수정됨] 모바일 환경에서 좌우 여백을 20px로 확보합니다. */
        padding: 1.5rem 20px;
    }
    .sf-lt-one-entry-title {
        font-size: 1.8rem;
    }
}

/* 화면 너비가 991px 이하일 때 */
@media screen and (max-width: 991px) {
    .sf-lt-one-lecture-sidebar {
        position: fixed;
        top: 50px;
        left: 0;
        height: calc(100vh - 50px);
        z-index: 999;
        margin-left: -300px; /* 기본적으로 숨김 */
        box-shadow: 2px 0 15px rgba(0,0,0,0.1);
    }

    body.admin-bar .sf-lt-one-lecture-sidebar {
        top: calc(50px + 32px);
        height: calc(100vh - 50px - 32px);
    }

    .sf-lt-one-lecture-container:not(.sidebar-hidden) .sf-lt-one-lecture-sidebar {
        margin-left: 0;
    }
}

/* ==========================================================================
   6. 검색 모달 (기존과 동일)
   ========================================================================== */
.sf-lt-one-search-modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 2000; }
.sf-lt-one-search-modal.is-active { display: flex; align-items: flex-start; justify-content: center; }
.sf-lt-one-search-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); }
.sf-lt-one-search-content { position: relative; z-index: 1; background: #fff; border-radius: 8px; margin-top: 10vh; width: 90%; max-width: 600px; padding: 2rem; }
.sf-lt-one-search-close { position: absolute; top: 1rem; right: 1rem; font-size: 2rem; background: none; border: none; cursor: pointer; }
.sf-lt-one-search-field { width: 100%; padding: 0.75rem; font-size: 1.2rem; border: 1px solid #ccc; border-radius: 4px; margin-bottom: 1rem; }
.sf-lt-one-search-scope { margin-bottom: 1rem; }
.sf-lt-one-search-scope label { margin-right: 1rem; }
.sf-lt-one-search-submit { padding: 0.5rem 1.5rem; background: #0073aa; color: #fff; border: none; border-radius: 4px; cursor: pointer; }