:root {
    /* Light Theme Variables */
    --bg-primary: #ffffff;
    --bg-secondary: #fafafa;
    --bg-tertiary: #f4f4f5;
    --text-primary: #09090b;
    --text-secondary: #52525b;
    --text-muted: #71717a;
    --border-color: #e4e4e7;
    --accent-color: #8b5cf6;
    --accent-hover: #7c3aed;
    --accent-light: #ede9fe;
    --code-bg: #fafafa;
    --code-border: #e4e4e7;
    --brand-gradient: linear-gradient(135deg, #8b5cf6 0%, #3b82f6 100%);
    --header-bg: rgba(255, 255, 255, 0.85);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

[data-theme="dark"] {
    /* Dark Theme Variables */
    --bg-primary: #09090b;
    --bg-secondary: #18181b;
    --bg-tertiary: #27272a;
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --border-color: #27272a;
    --accent-color: #a78bfa;
    --accent-hover: #c4b5fd;
    --accent-light: rgba(139, 92, 246, 0.15);
    --code-bg: #121214;
    --code-border: #27272a;
    --brand-gradient: linear-gradient(135deg, #a78bfa 0%, #60a5fa 100%);
    --header-bg: rgba(9, 9, 11, 0.85);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.5);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
    line-height: 1.6;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 0%, rgba(139, 92, 246, 0.05) 0%, transparent 50%);
    z-index: -1;
    pointer-events: none;
    transition: background 0.3s ease;
}

[data-theme="dark"] body::before {
    background: radial-gradient(circle at 50% 0%, rgba(139, 92, 246, 0.1) 0%, transparent 40%);
}

/* Header */
header {
    width: 100%;
    height: 64px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    position: fixed;
    top: 0;
    z-index: 50;
    background-color: var(--header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
}

header .left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    height: 32px;
    width: 32px;
    border-radius: 6px;
    object-fit: contain;
}

.brand-text {
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

header .right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Search */
.search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 10px;
    color: var(--text-muted);
}

#searchInput {
    padding: 8px 12px 8px 36px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    width: 240px;
    outline: none;
    transition: all 0.2s;
}

#searchInput:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-light);
    width: 280px;
}

#searchInput::placeholder {
    color: var(--text-muted);
}

/* Theme Toggle */
#themeToggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 8px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

#themeToggle:hover {
    color: var(--text-primary);
    background-color: var(--bg-secondary);
}

/* Main Content Layout */
main {
    margin-top: 64px;
    flex: 1;
    display: flex;
}

.info-container {
    display: flex;
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
}

/* Sidebar */
.contents-sidebar {
    width: 280px;
    flex-shrink: 0;
    height: calc(100vh - 64px);
    position: sticky;
    top: 64px;
    overflow-y: auto;
    border-right: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    padding: 2rem 1.5rem;
}

.contents-heading {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.contents-list {
    list-style: none;
}

.sidebar-list-item {
    padding: 8px 12px;
    margin: 4px 0;
    border-radius: 6px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: block;
}

.sidebar-list-item:hover {
    color: var(--text-primary);
    background-color: var(--bg-secondary);
}

.sidebar-list-item.active {
    color: var(--accent-color);
    background-color: var(--accent-light);
    font-weight: 500;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Content Area */
.section-container {
    flex: 1;
    padding: 2.5rem 4rem;
    max-width: 900px;
    overflow-y: visible;
    /* Prevent inner scroll clipping */
}

.content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

/* Hero Section */
.docs-hero {
    padding: 2rem 0 3rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.hero-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 9999px;
    background-color: var(--accent-light);
    color: var(--accent-color);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 600px;
    line-height: 1.6;
}

.text-gradient {
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
}

.section-child {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 3rem;
    scroll-margin-top: 100px;
}

.section-child:last-child {
    border-bottom: none;
}

/* Typography styles inside content */
.main-heading {
    font-size: 1.875rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.sub-heading {
    font-size: 1.125rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.section-child-content .content {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.section-child-content .content p {
    margin-bottom: 1rem;
}

.section-child-content .content ul,
.section-child-content .content ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
    list-style-position: outside;
}

.section-child-content .content li {
    margin-bottom: 0.5rem;
}

.section-child-content .content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.section-child-content .content code {
    background-color: var(--code-bg);
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.875em;
    border: 1px solid var(--code-border);
    color: var(--text-primary);
}

.section-child-content .content a {
    color: var(--accent-color);
    text-decoration: none;
}

.section-child-content .content a:hover {
    text-decoration: underline;
}

/* Code Blocks */
.code-content {
    position: relative;
    background-color: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: 8px;
    padding: 1rem;
    padding-right: 3rem;
    /* Space for copy button */
    margin-top: 1.5rem;
    overflow-x: auto;
}

.code-content code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.875rem;
    color: var(--text-secondary);
    white-space: pre-wrap;
    /* Wrap long lines if necessary */
    word-break: break-all;
    display: block;
}

.copy-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.copy-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.copy-btn svg {
    width: 16px;
    height: 16px;
}

.no-results {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px dashed var(--border-color);
}

.no-results h3 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.no-results p {
    color: var(--text-muted);
}

/* Footer */
footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 3rem 2rem 1.5rem;
}

.footer-container {
    max-width: 1440px;
    margin: 0 auto;
    display: flex;
    gap: 3rem;
    align-items: flex-start;
}

.logo-footer img {
    height: 48px;
    width: 48px;
    border-radius: 12px;
    object-fit: contain;
}

.footer-details h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.footer-details p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    max-width: 400px;
    margin-bottom: 1rem;
}

.footer-link {
    color: var(--accent-color);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
}

.footer-link:hover {
    text-decoration: underline;
}

.footer-bottom {
    max-width: 1440px;
    margin: 3rem auto 0;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Responsive Constraints */
@media (max-width: 1024px) {
    .contents-sidebar {
        display: none;
    }

    .section-container {
        padding: 2rem;
        max-width: 100%;
    }

    .footer-container {
        flex-direction: column;
        gap: 1.5rem;
    }
}

@media (max-width: 640px) {
    header {
        padding: 0 1rem;
    }

    .brand-text {
        display: none;
    }

    #searchInput {
        width: 160px;
    }

    #searchInput:focus {
        width: 200px;
    }

    .section-container {
        padding: 1.5rem 1rem;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.1rem;
    }

    .main-heading {
        font-size: 1.5rem;
    }
}