/* Layout & Components */
#progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--accent);
    width: 0%;
    z-index: 9999;
    transition: width 0.1s linear;
}

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1000;
    backdrop-filter: blur(8px);
    background: rgba(var(--bg-primary-rgb, 255,255,255), 0.85);
}

[data-theme="dark"] .header {
    background: rgba(13, 17, 23, 0.85);
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.logo-img {
    height: 28px;
    width: 28px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box svg {
    position: absolute;
    left: 12px;
    color: var(--text-tertiary);
}

.search-box input {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    padding: 8px 12px 8px 36px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    width: 240px;
    transition: all 0.2s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
    width: 300px;
}

.theme-toggle, .github-link {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: all 0.2s;
}

.theme-toggle:hover, .github-link:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }

.layout {
    display: flex;
    margin-top: 64px;
    min-height: calc(100vh - 64px);
}

.sidebar {
    width: 280px;
    position: fixed;
    top: 64px;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    padding: 24px 16px;
    border-right: 1px solid var(--border-primary);
    background: var(--bg-primary);
    z-index: 900;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    margin-bottom: 8px;
    padding: 0 12px;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav a {
    display: block;
    padding: 6px 12px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-radius: 6px;
    transition: all 0.2s;
    border-left: 2px solid transparent;
}

.sidebar-nav a:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
    text-decoration: none;
}

.sidebar-nav a.active {
    color: var(--accent);
    background: var(--accent-subtle);
    border-left-color: var(--accent);
    font-weight: 500;
}

.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 48px;
    max-width: 900px;
}

.doc-header {
    margin-bottom: 48px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-primary);
}

.doc-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    border: none;
}

.subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.meta-info {
    display: flex;
    gap: 24px;
    font-size: 0.9rem;
    color: var(--text-tertiary);
}

/* Markdown Styles */
.markdown-body h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-top: 48px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-primary);
}

.markdown-body h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 32px;
    margin-bottom: 12px;
}

.markdown-body p, .markdown-body ul, .markdown-body ol {
    margin-bottom: 16px;
}

.markdown-body ul, .markdown-body ol {
    padding-left: 24px;
}

.markdown-body li {
    margin-bottom: 6px;
}

.markdown-body code {
    background: var(--code-bg);
    padding: 0.2em 0.4em;
    border-radius: 6px;
    font-size: 0.9em;
    border: 1px solid var(--border-secondary);
}

.markdown-body pre {
    position: relative;
    background: var(--code-bg);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    margin-bottom: 24px;
}

.markdown-body pre code {
    background: transparent;
    border: none;
    padding: 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.markdown-body pre:hover .copy-btn {
    opacity: 1;
}

.copy-btn:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.alert {
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 24px;
    border-left: 4px solid;
    background: var(--bg-secondary);
}

.alert-warning { border-left-color: var(--warning); }
.alert-tip { border-left-color: var(--success); }
.alert-note { border-left-color: var(--accent); }

#back-to-top {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 800;
}

#back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
}