html {
    box-sizing: border-box;
}

*,
*::before,
*::after {
    box-sizing: inherit;
}

body {
    margin: 0;
    padding: 0;
    width: 100%;
    font-family: "Amazon Ember", "Helvetica Neue", Roboto, Arial, sans-serif;
    background-color: #fff;
    color: #16191f;
    word-wrap: break-word;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.header {
    background-color: #232f3e;
    color: #fff;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
    position: -webkit-sticky; /* For Safari */
    position: sticky;
    top: 0;
    z-index: 1002;
}

.logo a {
    display: block;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 24px;
    align-items: center;
}

.nav-link {
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    padding: 8px 12px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.nav-link:hover {
    color: #d5dbdb;
    background-color: rgba(255, 255, 255, 0.1);
}

.container {
    display: flex;
}

.toc {
    width: 280px;
    min-width: 220px;
    padding: 20px;
    border-right: 1px solid #e6e6e6;
    position: sticky;
    top: 72px; /* Adjusted for sticky header height */
    height: calc(100vh - 72px); /* Adjusted for sticky header height */
    overflow-y: auto;
    transition: width 0.3s, min-width 0.3s, padding 0.3s;
}

.toc-title {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.collapse-icon {
    cursor: pointer;
    font-size: 24px;
    font-weight: bold;
    padding: 0 10px;
    border-radius: 4px;
    color: gray;
}

.collapse-icon:hover {
    color: #9e9e9e;
}

.toc.collapsed {
    width: 40px;
    min-width: 40px;
    padding: 20px 0;
    overflow: hidden;
    border-right: none;
}

.toc.collapsed .toc-title-text,
.toc.collapsed ul,
.toc.collapsed .collapse-icon {
    display: none;
}

.burger-menu {
    display: none;
    position: fixed;
    top: 82px;
    left: 20px;
    font-size: 24px;
    background: #fff;
    border: 0px solid #e6e6e6;
    border-radius: 4px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    z-index: 1003;
}

.burger-menu:hover {
    color: #9e9e9e;
}

.toc-title h2 {
    font-size: 20px;
    margin: 0 0 5px 0;
}

.toc-title p {
    font-size: 14px;
    margin: 0;
    color: #545b64;
}

.toc ul {
    list-style: none;
    padding: 0;
    margin-top: 20px;
}

.toc ul li {
    margin-bottom: 5px;
}

.toc ul li a {
    text-decoration: none;
    color: #16191f;
    display: block;
    padding: 5px 0;
    font-size: 14px;
}

.toc .chapter > a {
    font-weight: normal;
}

.toc .chapter a.active {
    font-weight: bold;
}

.toc .chapter .sub-menu {
    display: none;
    padding-left: 25px;
}

.toc .chapter.open .sub-menu {
    display: block;
}

.toc .chapter .arrow {
    display: inline-block;
    width: 0;
    height: 0;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-left: 4px solid #545b64;
    margin-right: 10px;
    transition: transform 0.2s;
}

/* .toc .chapter.open .arrow {
    transform: rotate(90deg);
} */

.content {
    padding: 20px 40px;
    flex-grow: 1;
}

.breadcrumb {
    font-size: 12px;
    color: #545b64;
    margin-bottom: 20px;
}

.breadcrumb a {
    color: #007bff;
    text-decoration: none;
}

.content div[id^="chapter-"],
.content div[id^="appendix-"] {
    scroll-margin-top: 92px;
}

.content h1 {
    font-size: 40px;
    margin-top: 0;
    margin-bottom: 16px;
    font-weight: 700;
}

.content h2 {
    font-size: 24px;
    margin-top: 40px;
    margin-bottom: 16px;
    border-bottom: 1px solid #e6e6e6;
    padding-bottom: 8px;
    scroll-margin-top: 92px;
}

.content p {
    line-height: 1.6;
    font-size: 16px;
}

.content ul {
    padding-left: 20px;
}

.content li {
    margin-bottom: 10px;
}

.note {
    background-color: #f0f8ff;
    border: 1px solid #b0d0ff;
    border-radius: 4px;
    padding: 16px;
    margin: 20px 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

th,
td {
    border: 1px solid #e6e6e6;
    padding: 12px;
    text-align: left;
}

th {
    background-color: #f7f7f7;
    font-weight: bold;
}

code-block {
    position: relative;
    background-color: #f5f5f5;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 16px;
    font-family: "Courier New", Courier, monospace;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 0.9em;
    display: block;
    margin: 20px 0;
}

.copy-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: gray;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
}

.copy-button:hover {
    background-color: rgb(114, 114, 114);
}

code-block.directory-tree {
    line-height: 1.2;
}

img {
    max-width: 100%;
    height: auto;
}

@media (max-width: 768px) {
    .header {
        position: -webkit-sticky; /* For Safari */
        position: sticky;
        top: 0;
        z-index: 1002;
    }

    .container {
        flex-direction: column;
    }

    .burger-menu {
        display: block;
        position: fixed;
        top: 82px; /* CHANGED: Moved down below the sticky header */
        left: 8px;
        z-index: 1003;
    }

    .toc {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: #fff;
        z-index: 1001;
        overflow-y: auto;
        padding-top: 80px;
    }

    .toc.mobile-open {
        display: block;
    }

    .toc .collapse-icon {
        position: fixed;
        top: 82px; /* CHANGED: Aligned with the burger menu */
        right: 20px;
    }

    .content {
        padding: 20px;
        margin-top: 50px;
    }

    .content h1 {
        font-size: 28px;
    }

    .content h2 {
        font-size: 22px;
    }

    .content p {
        font-size: 16px;
    }

    .content img {
        max-width: 100%;
        height: auto;
    }

    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}
