/* Disable scrolling on the main page body */
body,
html {
    overflow: auto;
    height: 100%;
}

body::-webkit-scrollbar,
html::-webkit-scrollbar {
    width: 0;
    background: transparent;
}

/* Hide scrollbar for Firefox */
body,
html {
    scrollbar-width: none;
}

/* Hide scrollbar for IE/Edge */
body,
html {
    -ms-overflow-style: none;
}

.docs-wrapper {
    display: flex;
    min-height: 100vh;
    margin-top: 80px;
    height: calc(100vh - 80px);
    overflow: hidden;
}

.docs-sidebar {
    width: 280px;
    min-width: 280px;
    background: var(--gray-50);
    border-right: 1px solid var(--gray-200);
    padding: 2rem 0;
    z-index: 100;
    margin-top: 0;
    left: 0;
    right: auto;
    transform: translateX(0);
    will-change: transform;
    overflow-y: auto;
    height: 100%;
}

.docs-content {
    flex: 1;
    padding: 3rem;
    overflow-y: auto;
    height: 100%;
}

/* Sidebar header styles */
.docs-sidebar-header {
    padding: 0 1.5rem 1.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.docs-sidebar-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
}

.docs-sidebar-header p {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin: 0;
}

/* Category styles */
.docs-category {
    margin-bottom: 1.5rem;
}

.docs-category-title {
    padding: 0 1.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
}

/* Navigation items */
.docs-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1.5rem;
    color: var(--gray-700);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border-left: 2px solid transparent;
}

.docs-nav-item i {
    width: 1.25rem;
    font-size: 0.875rem;
    color: var(--gray-500);
    transition: color 0.2s ease;
}

.docs-nav-item:hover {
    background: var(--gray-100);
    color: var(--primary-color);
}

.docs-nav-item:hover i {
    color: var(--primary-color);
}

.docs-nav-item.active {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.08) 0%, transparent 100%);
    border-left-color: var(--primary-color);
    color: var(--primary-color);
}

.docs-nav-item.active i {
    color: var(--primary-color);
}

.docs-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--gray-200);
}

.docs-content h2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

.docs-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.docs-content p {
    color: var(--gray-600);
    line-height: 1.8;
    margin-bottom: 1.25rem;
}

.docs-content ul,
.docs-content ol {
    margin-bottom: 1.25rem;
    padding-left: 1.5rem;
}

.docs-content li {
    color: var(--gray-600);
    line-height: 1.8;
    margin-bottom: 0.5rem;
}

/* Inline code (not the code inside fenced blocks) */
.docs-content p code,
.docs-content li code,
.docs-content h1 code,
.docs-content h2 code,
.docs-content h3 code,
.docs-content blockquote code {
    background: var(--gray-100);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
    color: var(--primary-color);
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    white-space: nowrap;
}

/* ------------------------------------------------------------------ */
/* Fenced code blocks                                                  */
/* ------------------------------------------------------------------ */

.code-block {
    margin-bottom: 1.5rem;
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-md);
    background: var(--gray-50);
}

.code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    background: var(--gray-100);
    border-bottom: 1px solid var(--gray-200);
}

.code-block-lang {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-500);
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

.code-block-copy {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--white);
    border: 1px solid var(--gray-300, #d1d5db);
    color: var(--gray-600);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.code-block-copy:hover {
    background: var(--gray-100);
    border-color: var(--gray-400, #9ca3af);
    color: var(--gray-900);
}

.code-block-copy.copied {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.4);
    color: #16a34a;
}

.code-block pre {
    margin: 0;
    padding: 1.25rem 1.5rem;
    background: var(--white);
    overflow-x: auto;
    border-radius: 0;
}

.code-block pre code {
    background: none;
    padding: 0;
    font-size: 0.875rem;
    line-height: 1.7;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    white-space: pre;
    color: var(--gray-800, #1f2937);
}

/* Fallback styling if a <pre><code> ever appears outside .code-block */
.docs-content > pre {
    background: var(--gray-50);
    color: var(--gray-800, #1f2937);
    border: 1px solid var(--gray-200);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.docs-content > pre code {
    background: none;
    color: inherit;
    padding: 0;
    font-size: 0.875rem;
    line-height: 1.6;
}

.docs-content blockquote {
    border-left: 4px solid var(--primary-color);
    background: var(--gray-50);
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.docs-content blockquote p {
    margin-bottom: 0;
    color: var(--gray-700);
}

.docs-content img {
    max-width: 100%;
    border-radius: var(--border-radius);
    margin: 1.5rem 0;
    box-shadow: var(--shadow-md);
}

.docs-content hr {
    border: none;
    border-top: 1px solid var(--gray-200);
    margin: 2rem 0;
}

.docs-content a {
    color: var(--primary-color);
    text-decoration: underline;
}

.docs-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--gray-200);
}

.docs-nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gray-700);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
}

.docs-nav-link:hover {
    background: var(--gray-50);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.docs-nav-link.prev {
    flex-direction: row;
}

.docs-nav-link.next {
    flex-direction: row-reverse;
    margin-left: auto;
}

.mobile-docs-toggle {
    display: none;
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 56px;
    height: 56px;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    z-index: 999;
    /* Increase touch target size visually */
    transition: all 0.2s ease;
}

.mobile-docs-toggle:active {
    transform: scale(0.95);
    box-shadow: var(--shadow-md);
}

.mobile-docs-toggle:hover,
.mobile-docs-toggle:focus {
    transform: scale(1.05);
    box-shadow: var(--shadow-xl);
}

@media (max-width: 1024px) {
    .docs-wrapper {
        flex-direction: column;
    }

    .docs-sidebar {
        width: 100%;
        min-width: 100%;
        height: calc(100vh - 80px);
        position: fixed;
        top: 80px;
        left: 0;
        z-index: 998;
        background: var(--white);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: var(--shadow-xl);
    }

    .docs-sidebar.open {
        transform: translateX(0);
    }

    .docs-content {
        padding: 1.5rem;
        margin-top: 0;
        height: calc(100vh - 80px);
    }

    .docs-content h1 {
        font-size: 1.75rem;
    }

    .docs-content h2 {
        font-size: 1.375rem;
    }

    .mobile-docs-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-docs-toggle i {
        pointer-events: none;
    }

    .code-block-header {
        padding: 0.5rem 0.75rem;
    }
}

a:link,
a:visited,
a:hover,
a:active {
    text-decoration: none;
}

/* For Firefox */
.docs-sidebar {
    scrollbar-color: var(--gray-700) transparent;
    scrollbar-width: thin;
}

/* For WebKit browsers */
.docs-sidebar::-webkit-scrollbar {
    width: 8px;
}