:root {
    --ld-sidebar-width: 270px;
    --ld-right-toc-width: 250px;
    --ld-brand-color: #e53e3e;
    --ld-brand-color-light: #fff5f5;
    --ld-text-color: #2d3748;
    --ld-bg-color: #fff;
    --ld-sidebar-bg: #fff;
    --ld-border-color: #edf2f7;
    --ld-active-bg: #f7fafc;
}

.ld-kb-name {
    font-weight: 700;
    padding: 20px 20px 10px;
    font-size: 16px;
    color: var(--ld-brand-color);
    border-bottom: 1px solid var(--ld-border-color);
    margin-bottom: 15px;
}

/* Astra Theme Width Override - High Specificity */
body.single-ld_docs .ast-container {
    max-width: 1400px !important;
    padding-left: 20px;
    padding-right: 20px;
}

.ld-shell {
    width: 100%;
    min-height: 100vh;
    background: var(--ld-bg-color);
}

.ld-container {
    display: flex;
    max-width: var(--ld-container-max-width, 1400px);
    margin: 0 auto;
    position: relative;
    padding: 0;
}

/* Sidebar */
.ld-sidebar {
    width: var(--ld-sidebar-width);
    flex-shrink: 0;
    border-right: 1px solid var(--ld-border-color);
    background: var(--ld-sidebar-bg);
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    padding: 20px 0;
}

/* Scrollbar styling */
.ld-sidebar::-webkit-scrollbar {
    width: 4px;
}
.ld-sidebar::-webkit-scrollbar-thumb {
    background: transparent;
}
.ld-sidebar:hover::-webkit-scrollbar-thumb {
    background: var(--ld-border-color);
}

.ld-sidebar-list {
    list-style: none !important;
    padding-left: 0 !important;
    margin: 0 !important;
}

.ld-submenu {
    list-style: none !important;
    padding-left: 15px !important;
    margin: 0 !important;
    display: none;
}

.ld-nav-item.is-expanded > .ld-submenu {
    display: block;
}

.ld-link-wrapper {
    display: flex;
    align-items: center;
    padding: 4px 10px;
    position: relative;
    border-radius: 4px;
    margin: 2px 10px;
}

.ld-nav-item.is-active > .ld-link-wrapper {
    background-color: var(--ld-active-bg);
}

.ld-nav-link {
    text-decoration: none !important;
    color: var(--ld-text-color) !important;
    font-size: 14px;
    flex-grow: 1;
    display: block;
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
    transition: color 0.2s;
}

.ld-nav-link:hover {
    color: var(--ld-brand-color) !important;
}

.ld-nav-item.is-active > .ld-link-wrapper .ld-nav-link {
    color: var(--ld-brand-color) !important;
    font-weight: 600;
}

/* CSS Icons */
.ld-icon-menu {
    width: 20px;
    height: 14px;
    background: linear-gradient(
        to bottom,
        #fff 0%, #fff 2px,
        transparent 2px, transparent 6px,
        #fff 6px, #fff 8px,
        transparent 8px, transparent 12px,
        #fff 12px, #fff 14px
    );
}

.ld-icon-arrow {
    width: 6px; height: 6px; border-top: 1.5px solid #a0aec0; border-right: 1.5px solid #a0aec0;
    transform: rotate(45deg); display: inline-block;
}

.ld-icon-file {
    width: 14px; height: 18px; border: 1.5px solid #a0aec0; border-radius: 2px; display: inline-block;
}

.ld-toggle-icon {
    width: 18px;
    height: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a0aec0;
}

.ld-nav-item.is-expanded > .ld-link-wrapper .ld-icon-arrow {
    transform: rotate(135deg);
}

.ld-child-link .ld-icon-file {
    margin-right: 8px;
}

/* Sidebar Search */
.ld-search-wrap {
    padding: 0 15px 15px;
    position: relative;
    border-bottom: 1px solid var(--ld-border-color);
    margin-bottom: 15px;
}

#ld-search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--ld-border-color);
    border-radius: 6px;
    font-size: 14px;
    background: #fcfcfc;
    color: var(--ld-text-color);
    outline: none;
    transition: border-color 0.2s;
}

#ld-search-input:focus {
    border-color: var(--ld-brand-color);
}

#ld-search-results {
    position: absolute;
    top: 100%;
    left: 15px;
    right: 15px;
    background: white;
    border: 1px solid var(--ld-border-color);
    border-top: none;
    border-radius: 0 0 6px 6px;
    z-index: 100;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: none;
}

.ld-search-result-item {
    padding: 10px 12px;
    font-size: 13px;
    color: var(--ld-text-color);
    text-decoration: none;
    display: block;
    border-bottom: 1px solid #f7fafc;
}

.ld-search-result-item:hover {
    background: var(--ld-active-bg);
    color: var(--ld-brand-color);
}

.ld-search-no-results {
    padding: 10px 12px;
    font-size: 12px;
    color: #a0aec0;
}

/* Main Content */
.ld-main {
    flex-grow: 1;
    padding: 20px 40px;
    min-width: 0;
}

.ld-entry-title {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #1a202c;
    line-height: 1.2;
}

.ld-entry-content {
    line-height: 1.7;
    font-size: 16px;
    color: #4a5568;
}

/* Breadcrumbs */
.ld-breadcrumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12px;
    color: #718096;
    margin-bottom: 24px;
}

.ld-breadcrumb-item {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}

.ld-breadcrumb-item:hover {
    color: var(--ld-brand-color);
}

.ld-breadcrumb-item.is-current {
    color: #a0aec0;
}

.ld-collection-name {
    font-weight: 600;
    color: var(--ld-brand-color);
}

/* Right TOC */
.ld-right-toc {
    width: var(--ld-right-toc-width);
    flex-shrink: 0;
    padding: 30px 15px;
    height: 100vh;
    position: sticky;
    top: 0;
    border-left: 1px solid var(--ld-border-color);
    overflow-y: auto; /* Independent scrolling */
}

/* Right TOC Scrollbar */
.ld-right-toc::-webkit-scrollbar {
    width: 4px;
}
.ld-right-toc::-webkit-scrollbar-thumb {
    background: transparent;
}
.ld-right-toc:hover::-webkit-scrollbar-thumb {
    background: var(--ld-border-color);
}

.ld-right-toc-title {
    font-size: 11px;
    text-transform: uppercase;
    color: #a0aec0;
    margin-bottom: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

#ld-page-nav ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

#ld-page-nav li {
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 10px; /* Buffer for ellipsis */
}

/* Indent H3 items to reflect structure */
#ld-page-nav li.ld-toc-level-h3 {
    padding-left: 12px;
    font-size: 12px;
    opacity: 0.9;
}

#ld-page-nav a {
    text-decoration: none;
    color: #718096;
    font-size: 13px;
    transition: color 0.2s;
}

#ld-page-nav a:hover {
    color: var(--ld-brand-color);
}

/* Pagination Box */
.ld-pagination {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px solid var(--ld-border-color);
}

.ld-page-nav-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 15px 20px;
    border: 1px solid var(--ld-border-color);
    border-radius: 8px;
    text-decoration: none !important;
}

.ld-page-nav-box:hover {
    border-color: var(--ld-brand-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.ld-page-nav-box.is-prev { align-items: flex-start; }
.ld-page-nav-box.is-next { align-items: flex-end; }

.ld-nav-label { font-size: 12px; color: #a0aec0; margin-bottom: 4px; }
.ld-nav-title { font-size: 16px; font-weight: 600; color: var(--ld-brand-color); }

/* Child List */
.ld-child-list {
    margin-top: 30px;
    padding: 0; /* Removed background and padding */
    border-top: 1px solid var(--ld-border-color);
    padding-top: 25px;
}

.ld-child-list-title {
    font-size: 14px;
    text-transform: uppercase;
    color: #a0aec0;
    margin-bottom: 15px;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.ld-child-list ul {
    list-style: none !important;
    padding: 0 !important;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.ld-child-link {
    text-decoration: none !important;
    color: var(--ld-text-color) !important;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: #fcfcfc;
    border: 1px solid var(--ld-border-color);
    border-radius: 6px;
    transition: all 0.2s;
}

.ld-child-link i {
    width: 16px;
    height: 16px;
    stroke-width: 1.2px;
    color: #a0aec0;
}

.ld-child-link:hover {
    border-color: var(--ld-brand-color);
    background: var(--ld-active-bg);
}

.ld-child-link:hover i {
    color: var(--ld-brand-color);
}

/* Mobile Drawer Toggle */
.ld-drawer-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--ld-brand-color);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 10001;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

/* Ensure menu icon is visible inside the button */
.ld-drawer-toggle .ld-icon-menu {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 20px;
    height: 14px;
    margin: 0 auto;
}

.ld-drawer-toggle .ld-icon-menu span {
    display: block;
    height: 2px;
    background: #fff; /* Ensure it is white */
    border-radius: 2px;
}

/* Loading Bar */
#ld-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: var(--ld-brand-color);
    z-index: 9999;
    transition: width 0.3s ease;
}

@media (max-width: 1024px) {
    .ld-right-toc {
        display: none;
    }
}

@media (max-width: 768px) {
    .ld-drawer-toggle {
        display: flex;
    }
    .ld-sidebar {
        position: fixed;
        left: -300px;
        top: 0;
        z-index: 10000;
        transition: left 0.3s ease;
        box-shadow: 4px 0 12px rgba(0,0,0,0.1);
        width: 280px;
        background: white;
    }
    .ld-sidebar.is-open {
        left: 0;
    }
    .ld-main {
        padding: 20px;
    }
}
