/*
=========================================
 CSS for the Two-Column Chapter Pages
=========================================
*/

/* --- KEY CHANGE: We are no longer hiding the theme's title on chapter pages --- */
/* This rule is now ONLY for the Table of Contents page to prevent a double title */
.book-toc-active .entry-title,
.book-toc-active header.entry-header {
    display: none !important;
}

/* This is the rule that forces the theme's main container to be full width */
.book-layout-active #primary,
.book-layout-active .content-area,
.book-layout-active .site-content {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Main container for our layout */
.book-layout-container {
    display: flex;
    flex-wrap: wrap;
    gap: 3rem;
    width: 100%;
    max-width: 1300px;
    margin: 2rem auto;
    padding: 0 1.5rem; 
}

.sidebar-wrapper {
    flex: 1 1 350px;
    max-width: 400px;
    position: sticky;
    top: 50px;
    align-self: flex-start;
}

.sidebar-wrapper h2 {
    font-size: 1.8rem;
    margin-top: 0;
    margin-bottom: 1rem;
    text-align: left;
}

.book-layout-sidebar {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    padding: 1.5rem;
    border-radius: 8px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.book-layout-content {
    flex: 2 1 65%;
}

.book-layout-sidebar h3 {
    font-size: 1.2rem;
    font-weight: bold;
    margin: 0;
    padding: 0;
}
.book-layout-sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.book-layout-sidebar li {
    padding-left: 1rem;
    margin-bottom: 0.5rem;
}
.book-layout-sidebar .page_item_has_children > a {
    font-weight: bold;
}
.book-layout-sidebar .children {
    list-style: none;
    padding-left: 1rem;
    margin-top: 0.5rem;
}
.book-layout-sidebar li.current_page_item > a {
    color: #0073aa;
    font-weight: bold;
}

.book-layout-sidebar a {
    text-decoration: none;
    color: #333;
}

.book-layout-sidebar a:hover {
    text-decoration: underline;
}

.book-layout-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 3rem;
    border-top: 1px solid #e0e0e0;
    padding-top: 1.5rem;
}

@media (max-width: 900px) {
    .book-layout-container {
        flex-direction: column;
    }
    .sidebar-wrapper {
        position: static;
        max-width: 100%;
    }
}

/*
=========================================
 CSS for the Main Table of Contents Page
=========================================
*/

.book-toc-container {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.book-toc-container h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.book-toc-container p {
    font-size: 1.1rem;
    color: #555;
    margin-bottom: 2rem;
}

.book-toc-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.book-toc-list li {
    border-bottom: 1px solid #eee;
    padding: 0.75rem 0;
}

.book-toc-list li a {
    text-decoration: none;
    font-size: 1.1rem;
    color: #333;
}

.book-toc-list li a:hover {
    color: #0073aa;
    text-decoration: underline;
}

.book-toc-list > ul > li.page_item_has_children > a {
    font-weight: bold;
    font-size: 1.2rem;
}

.book-toc-list ul.children {
    margin-top: 0.75rem;
    padding-left: 1.5rem;
    border-left: 2px solid #0073aa;
}

.book-toc-list ul.children li {
    border-bottom: none;
    padding: 0.4rem 0;
}

.book-toc-list ul.children li a {
    font-size: 1rem;
}

.book-toc-hr {
    max-width: 900px;
    margin: 2rem auto;
    border: 0;
    border-top: 1px solid #ccc;
}