/* レイアウト - 左メニューとコンテナ */

/* 全体コンテナ */
.container-with-sidebar {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    gap: 2rem;
}

/* 左サイドバーメニュー */
.sidebar-menu {
    width: 320px;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    border: none;
    border-right: 1px solid #000;
    z-index: 1000;
    will-change: transform;
}

.sidebar-header {
    padding: 1.5rem 1rem 1rem;
    border-bottom: 2px solid #000;
    flex-shrink: 0;
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: bold;
    color: #000;
    text-decoration: none;
    display: block;
}

.sidebar-title:hover {
    text-decoration: underline;
}

/* スクロール可能なナビゲーション領域 */
.sidebar-nav-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav > li {
    margin-bottom: 0.3rem;
}

/* トップページリンク */
.sidebar-nav .nav-top > a {
    display: block;
    padding: 0.5rem 0.75rem;
    color: #333;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.9rem;
    border-left: 3px solid transparent;
}

.sidebar-nav .nav-top.current > a {
    background-color: #f0f0f0;
    border-left-color: #000;
}

.sidebar-nav .nav-top > a:hover {
    text-decoration: underline;
}

/* 章リンク */
.sidebar-nav .nav-chapter {
    margin-top: 0.5rem;
}

.sidebar-nav .nav-chapter > .chapter-link {
    display: block;
    padding: 0.5rem 0.75rem;
    color: #333;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.85rem;
    border-left: 3px solid transparent;
    transition: all 0.15s ease;
}

.sidebar-nav .nav-chapter > .chapter-link:hover {
    text-decoration: underline;
}

/* 現在の章 */
.sidebar-nav .nav-chapter.current-chapter > .chapter-link {
    background-color: #f0f0f0;
    border-left-color: #000;
}

/* 章内セクション */
.sidebar-nav .chapter-sections {
    list-style: none;
    padding: 0;
    margin: 0.3rem 0 0.5rem 0.5rem;
    border-left: 1px solid #ddd;
}

.sidebar-nav .chapter-sections > li {
    margin-bottom: 0.2rem;
}

.sidebar-nav .chapter-sections > li > a {
    display: block;
    padding: 0.35rem 0.75rem;
    color: #444;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: bold;
    border-left: 2px solid transparent;
    margin-left: -1px;
    transition: all 0.15s ease;
}

.sidebar-nav .chapter-sections > li > a:hover {
    background-color: #f5f5f5;
    border-left-color: #999;
}

.sidebar-nav .chapter-sections > li > a.active {
    background-color: #e8e8e8;
    border-left-color: #000;
}

/* サブセクション */
.sidebar-nav .section-subs {
    list-style: none;
    padding: 0;
    margin: 0.2rem 0 0.3rem 1rem;
}

.sidebar-nav .section-subs li {
    margin-bottom: 0.1rem;
}

.sidebar-nav .section-subs a {
    display: block;
    padding: 0.25rem 0.5rem;
    color: #666;
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: normal;
    transition: all 0.15s ease;
}

.sidebar-nav .section-subs a:hover {
    color: #333;
    text-decoration: underline;
}

.sidebar-nav .section-subs a.active {
    color: #000;
    font-weight: bold;
}

/* 外部リンク（hatohato.jpトップ） */
.sidebar-nav .nav-external {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #ddd;
}

.sidebar-nav .nav-external > a {
    display: block;
    padding: 0.5rem 0.75rem;
    color: #666;
    text-decoration: none;
    font-size: 0.85rem;
}

.sidebar-nav .nav-external > a:hover {
    color: #333;
    text-decoration: underline;
}

/* ====== 旧スタイル互換（submenu） ====== */
.sidebar-nav .submenu {
    list-style: none;
    padding: 0;
    margin: 0.3rem 0 0.5rem 1rem;
}

.sidebar-nav .submenu li {
    margin-bottom: 0.3rem;
}

.sidebar-nav .submenu a {
    display: block;
    padding: 0.4rem 0.75rem;
    color: #555;
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    font-weight: normal;
}

.sidebar-nav .submenu a:hover {
    background-color: #e9e9e9;
    border-left-color: #999;
    color: #333;
}

.sidebar-nav .submenu a.active {
    background-color: transparent;
    color: #000;
    font-weight: bold;
    text-decoration: underline;
}

/* メインコンテンツエリア */
.main-content {
    margin-left: 340px;
    padding: 2rem 3rem;
    flex: 1;
    min-width: 0;
}
