/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #663399;
    --primary-light: #8a4baf;
    --primary-dark: #4a1a5c;
    --secondary-color: #f8f9fa;
    --accent-color: #007acc;
    --text-primary: #2d3748;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --border-color: #e2e8f0;
    --border-light: #f7fafc;
    --background: #ffffff;
    --background-secondary: #f8f9fa;
    --background-tertiary: #edf2f7;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --sidebar-width: 280px;
    --toc-width: 240px;
    --header-height: 64px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background);
    font-size: 16px;
}

/* Container and layout */
.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--background);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    backdrop-filter: blur(8px);
    background-color: rgba(255, 255, 255, 0.95);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 24px;
    max-width: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 18px;
    color: var(--primary-color);
}

.logo svg {
    color: var(--primary-color);
}

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

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

.search-input {
    width: 300px;
    padding: 8px 16px 8px 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    background: var(--background-secondary);
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 51, 153, 0.1);
    background: var(--background);
}

.search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    pointer-events: none;
}

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.mobile-menu-toggle span {
    width: 20px;
    height: 2px;
    background: var(--text-primary);
    transition: all 0.3s ease;
}

.main-wrapper {
    display: flex;
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--background-secondary);
    border-right: 1px solid var(--border-color);
    position: fixed;
    left: 0;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-content {
    padding: 24px 0;
}

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

.nav-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    padding: 0 24px;
}

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

.nav-section li {
    margin-bottom: 2px;
}

.nav-link {
    display: block;
    padding: 8px 24px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: var(--background);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--background);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    font-weight: 500;
}

/* Main content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
}

.content-wrapper {
    flex: 1;
    display: flex;
    max-width: 100%;
}

.content {
    flex: 1;
    max-width: calc(100% - var(--toc-width));
    padding: 32px 48px 64px;
}

/* Table of contents */
.toc-container {
    width: var(--toc-width);
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
    padding: 32px 24px;
    border-left: 1px solid var(--border-color);
}

.toc h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.toc ul {
    list-style: none;
}

.toc li {
    margin-bottom: 8px;
}

.toc a {
    display: block;
    padding: 4px 0;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    line-height: 1.4;
    transition: color 0.2s ease;
    border-left: 2px solid transparent;
    padding-left: 12px;
}

.toc a:hover,
.toc a.active {
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.toc .toc-h3 {
    padding-left: 24px;
    font-size: 12px;
}

/* Content sections */
.content-section {
    margin-bottom: 48px;
}

.content-section:last-child {
    margin-bottom: 0;
}

.content h1 {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    line-height: 1.2;
}

.content h2 {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 32px 0 16px;
    line-height: 1.3;
}

.content h3 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 24px 0 12px;
    line-height: 1.4;
}

.content p {
    margin-bottom: 16px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.content .lead {
    font-size: 20px;
    color: var(--text-primary);
    margin-bottom: 32px;
    line-height: 1.6;
}

.content ul,
.content ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.content li {
    margin-bottom: 8px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.content a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
}

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

.content code {
    background: var(--background-tertiary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 14px;
    color: var(--primary-dark);
}

.content pre {
    background: var(--background-tertiary);
    padding: 20px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: 20px 0;
    border: 1px solid var(--border-color);
}

.content pre code {
    background: none;
    padding: 0;
    font-size: 14px;
    color: var(--text-primary);
}

/* Info boxes */
.info-box,
.warning-box,
.success-box {
    display: flex;
    gap: 12px;
    padding: 16px;
    border-radius: var(--radius-md);
    margin: 24px 0;
    border-left: 4px solid;
}

.info-box {
    background: rgba(0, 122, 204, 0.05);
    border-left-color: var(--accent-color);
}

.warning-box {
    background: rgba(245, 101, 101, 0.05);
    border-left-color: #f56565;
}

.success-box {
    background: rgba(72, 187, 120, 0.05);
    border-left-color: #48bb78;
}

.info-icon,
.warning-icon,
.success-icon {
    flex-shrink: 0;
    margin-top: 2px;
}

.info-icon {
    color: var(--accent-color);
}

.warning-icon {
    color: #f56565;
}

.success-icon {
    color: #48bb78;
}

/* Step cards */
.step-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin: 32px 0;
}

.step-card {
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    position: relative;
    transition: all 0.2s ease;
}

.step-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.step-number {
    position: absolute;
    top: -12px;
    left: 24px;
    background: var(--primary-color);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.step-card h3 {
    margin: 8px 0 12px;
    font-size: 18px;
}

.step-card p {
    margin: 0;
    font-size: 14px;
}

/* Feature cards */
.feature-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 24px 0;
}

.feature-card {
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all 0.2s ease;
}

.feature-card:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--primary-color);
}

.feature-card h3 {
    margin: 0 0 8px;
    font-size: 16px;
    color: var(--primary-color);
}

.feature-card p {
    margin: 0;
    font-size: 14px;
}

/* Interface grid */
.interface-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 24px 0;
}

.interface-item {
    text-align: center;
    padding: 20px;
}

.interface-item h3 {
    margin: 0 0 8px;
    font-size: 16px;
    color: var(--primary-color);
}

.interface-item p {
    margin: 0;
    font-size: 14px;
}

/* Method list */
.method-list {
    background: var(--background-secondary);
    border-radius: var(--radius-md);
    padding: 20px;
    margin: 20px 0;
}

.method-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
}

.method-item:last-child {
    border-bottom: none;
}

/* Code example */
.code-example {
    margin: 24px 0;
}

.code-example pre {
    margin: 0;
}

/* Link types */
.link-types {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 24px 0;
}

.link-type {
    background: var(--background-secondary);
    border-radius: var(--radius-md);
    padding: 20px;
}

.link-type h3 {
    margin: 0 0 8px;
    font-size: 16px;
    color: var(--primary-color);
}

.link-type code {
    display: block;
    margin: 8px 0;
    font-size: 13px;
}

.link-type p {
    margin: 0;
    font-size: 14px;
}

/* Plugin grid */
.plugin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin: 24px 0;
}

.plugin-card {
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all 0.2s ease;
}

.plugin-card:hover {
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.plugin-card h3 {
    margin: 0 0 8px;
    font-size: 16px;
    color: var(--primary-color);
}

.plugin-card p {
    margin: 0;
    font-size: 14px;
}

/* Shortcuts */
.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 32px;
    margin: 32px 0;
}

.shortcut-category h3 {
    margin: 0 0 16px;
    font-size: 18px;
    color: var(--primary-color);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 8px;
}

.shortcut-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
}

.shortcut-item:last-child {
    border-bottom: none;
}

kbd {
    background: var(--background-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Responsive design */
@media (max-width: 1200px) {
    .toc-container {
        display: none;
    }
    
    .content {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 100%;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .search-input {
        width: 200px;
    }
    
    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        transform: none;
    }
    
    .main-content {
        margin-left: 0;
        flex-direction: column;
    }
    
    .content {
        padding: 24px 20px 48px;
    }
    
    .content h1 {
        font-size: 28px;
    }
    
    .content h2 {
        font-size: 24px;
    }
    
    .content h3 {
        font-size: 20px;
    }
    
    .step-grid,
    .feature-cards,
    .plugin-grid,
    .shortcuts-grid {
        grid-template-columns: 1fr;
    }
    
    .header-content {
        padding: 0 16px;
    }
}

@media (max-width: 480px) {
    .content {
        padding: 20px 16px 40px;
    }
    
    .info-box,
    .warning-box,
    .success-box {
        flex-direction: column;
        gap: 8px;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Focus styles */
*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Selection styles */
::selection {
    background: rgba(102, 51, 153, 0.2);
}

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

::-webkit-scrollbar-track {
    background: var(--background-secondary);
}

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

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