/* Java Design Patterns - レイアウト（左メニュー構造） */

/* ===== 基本レイアウト ===== */
.container-with-sidebar {
    display: flex;
    min-height: 100vh;
}

/* ===== サイドバー ===== */
.sidebar-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    background: #12121a;
    border-right: 1px solid #333;
    overflow-y: auto;
    z-index: 1000;
}

.sidebar-nav-wrapper {
    padding: 1rem;
}

.sidebar-title {
    display: block;
    font-size: 1.1rem;
    font-weight: bold;
    color: #f89820;
    text-decoration: none;
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #333;
}

.sidebar-title:hover {
    color: #ffb347;
    text-decoration: none;
}

/* ===== サイドバーナビゲーション ===== */
.sidebar-nav-unified {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav-unified .nav-top {
    margin-bottom: 1rem;
}

.sidebar-nav-unified .nav-top a {
    display: block;
    padding: 0.5rem 0.75rem;
    color: #ccc;
    text-decoration: none;
    font-size: 0.9rem;
    border-radius: 4px;
}

.sidebar-nav-unified .nav-top a:hover {
    background-color: rgba(248, 152, 32, 0.1);
    color: #f89820;
}

.sidebar-nav-unified .nav-top.current-page a {
    background-color: rgba(248, 152, 32, 0.15);
    color: #f89820;
    font-weight: bold;
}

/* 章（カテゴリ）タイトル */
.sidebar-nav-unified .nav-chapter {
    margin-bottom: 0.75rem;
}

.sidebar-nav-unified .chapter-title-text {
    display: block;
    font-size: 0.85rem;
    font-weight: bold;
    color: #aaa;
    padding: 0.4rem 0.5rem;
    margin-bottom: 0.25rem;
}

/* 章内ページリスト */
.sidebar-nav-unified .chapter-pages {
    list-style: none;
    padding: 0;
    margin: 0 0 0 0.5rem;
}

.sidebar-nav-unified .chapter-pages li {
    margin: 0;
}

.sidebar-nav-unified .chapter-pages a {
    display: block;
    padding: 0.35rem 0.75rem;
    color: #999;
    text-decoration: none;
    font-size: 0.85rem;
    border-radius: 3px;
    transition: background-color 0.15s ease;
}

.sidebar-nav-unified .chapter-pages a:hover {
    background-color: rgba(248, 152, 32, 0.1);
    color: #f89820;
}

.sidebar-nav-unified .chapter-pages .current-page a {
    background-color: rgba(248, 152, 32, 0.2);
    color: #f89820;
    font-weight: bold;
}

/* 外部リンク */
.sidebar-nav-unified .nav-external {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #333;
}

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

.sidebar-nav-unified .nav-external a:hover {
    color: #f89820;
}

/* ===== メインコンテンツ ===== */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 40px 50px;
    min-height: 100vh;
    background: #0a0a0f;
}

/* ===== モバイルメニュー ===== */
.menu-toggle {
    display: none;
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1100;
    background: #1a1a25;
    border: 1px solid #333;
    border-radius: 4px;
    cursor: pointer;
    padding: 8px;
}

.menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: #f89820;
    margin: 5px 0;
    transition: all 0.3s ease;
}

.menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
}

/* ===== レスポンシブ ===== */
@media (max-width: 900px) {
    .menu-toggle {
        display: block;
    }
    
    .sidebar-menu {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar-menu.active {
        transform: translateX(0);
    }
    
    .menu-overlay.active {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
        padding: 60px 20px 30px;
    }
}

/* ===== サイドバー内検索ボックス ===== */
.sidebar-menu .search-box {
    padding: 0.5rem 0;
    margin-bottom: 1rem;
    border-bottom: 1px solid #333;
    position: relative;
}

.sidebar-menu .search-input-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid #444;
    background: #1a1a25;
    border-radius: 3px;
}

.sidebar-menu .search-input {
    flex: 1;
    border: none;
    padding: 0.4rem 0.5rem;
    font-size: 0.8rem;
    outline: none;
    min-width: 0;
    background: transparent;
    color: #ccc;
}

.sidebar-menu .search-input::placeholder {
    color: #666;
}

.sidebar-menu .search-clear {
    border: none;
    background: transparent;
    color: #666;
    cursor: pointer;
    padding: 0.25rem 0.4rem;
    font-size: 0.9rem;
    line-height: 1;
}

.sidebar-menu .search-clear:hover {
    color: #f89820;
}

.sidebar-menu .search-controls {
    display: none;
    align-items: center;
    justify-content: flex-end;
    margin-top: 0.3rem;
    gap: 0.25rem;
}

.sidebar-menu .search-counter {
    font-size: 0.7rem;
    color: #888;
    margin-right: auto;
}

.sidebar-menu .search-prev,
.sidebar-menu .search-next {
    border: 1px solid #444;
    background: #1a1a25;
    color: #ccc;
    cursor: pointer;
    padding: 0.15rem 0.4rem;
    font-size: 0.75rem;
    line-height: 1;
    border-radius: 2px;
}

.sidebar-menu .search-prev:hover,
.sidebar-menu .search-next:hover {
    background: #2a2a35;
    color: #f89820;
}

/* 全章検索結果ドロップダウン */
.sidebar-menu .search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1a1a25;
    border: 1px solid #444;
    border-top: none;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1001;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    display: none;
}

.sidebar-menu .search-result-item {
    display: block;
    padding: 0.5rem 0.6rem;
    border-bottom: 1px solid #333;
    text-decoration: none;
    color: #ccc;
    font-size: 0.8rem;
}

.sidebar-menu .search-result-item:last-child {
    border-bottom: none;
}

.sidebar-menu .search-result-item:hover {
    background-color: rgba(248, 152, 32, 0.1);
}

.sidebar-menu .search-result-chapter {
    display: inline-block;
    background: #f89820;
    color: #0a0a0f;
    padding: 0.1rem 0.3rem;
    font-size: 0.65rem;
    border-radius: 2px;
    margin-right: 0.4rem;
    font-weight: bold;
}

.sidebar-menu .search-result-title {
    color: #ccc;
}

.sidebar-menu .search-no-results {
    padding: 0.75rem;
    text-align: center;
    color: #666;
    font-size: 0.8rem;
}

.sidebar-menu .search-snippet {
    display: block;
    font-size: 0.7rem;
    color: #888;
    margin-top: 0.2rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-menu .search-snippet mark {
    background-color: #f89820;
    color: #0a0a0f;
    padding: 0 1px;
}

/* ページ内検索ハイライト */
.search-highlight {
    background-color: #f89820;
    color: #0a0a0f;
    padding: 0 2px;
}

.search-highlight-current {
    background-color: #5382a1;
    color: #fff;
}
