/* 기본 스타일 - GitBook 스타일 배경 */
:root {
    --sidebar-width: 280px;
    --header-height: 60px;
    --primary-color: #5b9bd5;
    --primary-dark: #4a8bc4;
    --bg-color: #1e1e1e;
    --sidebar-bg: #2a2a2a;
    --content-bg: #1e1e1e;
    --text-color: #e4e4e4;
    --text-muted: #a0a0a0;
    --border-color: #404040;
    --link-color: #58a6ff;
    --success-color: #3fb950;
    --warning-color: #d29922;
    --danger-color: #f85149;
    --info-color: #58a6ff;
}

/* Bootstrap 오버라이드 */
body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* 전체 스크롤바 커스터마이징 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: rgba(139, 148, 158, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 148, 158, 0.5);
}

/* Firefox 전역 스크롤바 */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 148, 158, 0.3) var(--bg-color);
}

.card {
    background-color: var(--sidebar-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}

.card-body {
    padding: 1rem;
}

.btn-link {
    text-decoration: none;
}

.btn-link:hover {
    text-decoration: none;
}

/* 사이드바 */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1040;
    transition: transform 0.3s ease;
}

/* 사이드바 스크롤바 커스터마이징 */
.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(139, 148, 158, 0.3);
    border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 148, 158, 0.5);
}

/* Firefox 스크롤바 */
.sidebar-nav {
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 148, 158, 0.3) transparent;
}

.sidebar-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    color: var(--text-color);
    font-weight: 700;
    font-size: 1.1rem;
}

.logo-icon {
    font-size: 1.5rem;
    margin-right: 0.625rem;
}

.sidebar-close {
    display: none;
}

/* 메뉴 */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.menu {
    list-style: none;
}

.menu-group {
    margin-top: 20px;
}

.menu-group:first-child {
    margin-top: 0;
}

.menu-group-title {
    display: flex;
    align-items: center;
    padding: 8px 20px 8px 4px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.4;
}

.menu-group-title .menu-icon {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    margin-right: 8px;
    font-size: 14px;
    width: 20px;
    flex-shrink: 0;
}

.menu-item {
    position: relative;
}

.menu-link {
    display: flex;
    align-items: center;
    padding: 8px 20px 8px 4px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    line-height: 1.4;
}

.menu-link.indent-24px {
    padding-left: 24px;
}

.menu-link:hover {
    background-color: rgba(255,255,255,0.05);
    color: var(--link-color);
}

.menu-item.active > .menu-link {
    background-color: rgba(91, 155, 213, 0.1);
    border-left-color: var(--primary-color);
    color: var(--link-color);
}

.menu-icon {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    margin-right: 8px;
    font-size: 16px;
    width: 20px;
    flex-shrink: 0;
}

.menu-children {
    list-style: none;
    padding-left: 0;
}

/* 기본 메뉴 자식 스타일 (그룹 헤더 아래) */
.menu-group > .menu-children .menu-link {
    padding-left: 24px;
    font-size: 13px;
}

/* 노션 스타일 계층형 메뉴 (토글 가능) */
.menu-item.has-children {
    position: relative;
}

.menu-item.has-children > .menu-link {
    position: relative;
    padding-left: 28px;
}

/* 화살표 아이콘 - 클릭 가능 영역 */
.menu-item.has-children > .menu-link::before {
    content: '▶';
    position: absolute;
    left: 8px;
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
    cursor: pointer;
    padding: 4px;
    margin: -4px;
    z-index: 10;
}

.menu-item.has-children.expanded > .menu-link::before {
    transform: rotate(90deg);
}

/* 중요: 토글 가능한 메뉴의 자식은 기본적으로 숨김 */
.menu-item.has-children > .menu-children {
    display: none !important;
    padding-left: 20px;
    margin-top: 4px;
}

/* 펼쳐진 경우에만 표시 */
.menu-item.has-children.expanded > .menu-children {
    display: block !important;
}

.menu-children .menu-item {
    margin-top: 2px;
}

.menu-children .menu-link {
    padding: 6px 20px 6px 32px;
    font-size: 13px;
    border-radius: 4px;
}

.menu-children .menu-link:hover {
    background-color: rgba(255,255,255,0.05);
}

.menu-children .menu-item.active > .menu-link {
    background-color: rgba(91, 155, 213, 0.15);
    border-left-color: transparent;
    color: var(--link-color);
}

/* 메인 컨텐츠 */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-header {
    height: var(--header-height);
    background-color: var(--sidebar-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    z-index: 1030;
}

.menu-toggle {
    display: none;
    padding: 0.5rem;
}

.breadcrumb {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.breadcrumb a {
    color: var(--link-color);
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* 컨텐츠 래퍼 */
.content-wrapper {
    display: flex;
    flex: 1;
    position: relative;
    width: 100%;
}

.content {
    flex: 1;
    padding: 2.5rem;
    width: 100%;
    max-width: 100%;
}

/* 목차 (TOC) */
.toc-sidebar {
    width: 280px;
    padding: 2.5rem 1.875rem 2.5rem 1.25rem;
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
    flex-shrink: 0;
}

/* 목차 스크롤바 커스터마이징 */
.toc-sidebar::-webkit-scrollbar {
    width: 6px;
}

.toc-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.toc-sidebar::-webkit-scrollbar-thumb {
    background: rgba(139, 148, 158, 0.3);
    border-radius: 3px;
}

.toc-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 148, 158, 0.5);
}

/* Firefox 스크롤바 */
.toc-sidebar {
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 148, 158, 0.3) transparent;
}

.toc-container {
    border-radius: 0.5rem;
}

.toc-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 1rem;
    padding-bottom: 0;
    border-bottom: none;
}

.toc-nav {
    font-size: 0.9375rem;
}

.toc-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-nav li {
    margin: 0;
}

.toc-nav a {
    display: block;
    padding: 0.5rem 0 0.5rem 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: all 0.2s;
    line-height: 1.5;
}

.toc-nav a:hover {
    color: var(--link-color);
    border-left-color: var(--link-color);
}

.toc-nav a.active {
    color: var(--link-color);
    border-left-color: var(--primary-color);
    font-weight: 500;
}

.toc-nav .toc-h2 {
    padding-left: 0.75rem;
}

.toc-nav .toc-h3 {
    padding-left: 1.5rem;
    font-size: 0.875rem;
}

.main-footer {
    border-top: 1px solid var(--border-color);
    background-color: var(--sidebar-bg);
}

/* 404 페이지 */
.not-found {
    text-align: center;
    padding: 60px 20px;
}

.not-found h1 {
    font-size: 72px;
    color: var(--primary-color);
    margin-bottom: 20px;
}

/* 반응형 */
@media (max-width: 1200px) {
    .toc-sidebar {
        display: none;
    }
    
    .content {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-close {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .content {
        padding: 20px;
    }
}

/* 설정 가이드 */
.setup-guide {
    max-width: 700px;
    margin: 0 auto;
    padding: 40px;
}

.setup-guide h1 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.setup-guide h2 {
    font-size: 1.4rem;
    margin-top: 30px;
    margin-bottom: 15px;
    color: var(--text-color);
}

.setup-guide h3 {
    font-size: 1.1rem;
    margin-top: 25px;
    margin-bottom: 10px;
    color: var(--text-muted);
}

.setup-guide p {
    margin-bottom: 15px;
    line-height: 1.6;
}

.setup-guide pre {
    background-color: var(--sidebar-bg);
    padding: 15px 20px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 15px 0;
}

.setup-guide code {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    color: var(--success-color);
}

.setup-guide ol {
    padding-left: 25px;
    margin: 15px 0;
}

.setup-guide li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.setup-guide a {
    color: var(--link-color);
    text-decoration: none;
}

.setup-guide a:hover {
    text-decoration: underline;
}
