/* ============================================
   Documentation-Specific Styles
   ============================================ */

/* --- Docs Layout --- */
.docs-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 0;
    min-height: calc(100vh - var(--header-height));
    padding-top: var(--header-height);
    max-width: 1200px;
    margin: 0 auto;
}

/* --- Sidebar --- */
.docs-sidebar {
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
    padding: 32px 24px;
    border-right: 1px solid var(--border-light);
    background: var(--bg-secondary);
    scrollbar-width: thin;
    scrollbar-color: var(--border-medium) transparent;
}

.docs-sidebar::-webkit-scrollbar {
    width: 4px;
}

.docs-sidebar::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 2px;
}

.sidebar-section {
    margin-bottom: 28px;
}

.sidebar-section-title {
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-tertiary);
    opacity: 0.8;
    margin-bottom: 12px;
    margin-top: 24px !important;
    padding-left: 12px;
}

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

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

.sidebar-nav a {
    display: block;
    padding: 8px 12px;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: all var(--motion-fast) var(--ease-smooth);
    text-decoration: none;
}

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

.sidebar-nav a.active {
    color: var(--accent);
    background: var(--accent-glow);
    border-left: 2px solid var(--accent);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-weight: 600;
}

/* Mobile sidebar toggle */
.docs-sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 100;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    align-items: center;
    justify-content: center;
}

.docs-sidebar-toggle svg {
    width: 24px;
    height: 24px;
}

/* --- Docs Content --- */
.docs-content {
    padding: 48px 64px;
    max-width: 860px;
    min-width: 0;
    margin: 0 auto;
}

.docs-content h1 {
    font-size: var(--font-size-4xl);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

/* --- Docs Hero & Footer --- */
.docs-hero {
    margin-bottom: 48px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--border-light);
}

.docs-hero h1 {
    font-size: var(--font-size-4xl);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
    color: var(--text-primary);
    border-bottom: none;
    padding-bottom: 0;
}

.docs-hero p {
    font-size: var(--font-size-lg);
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 640px;
    margin-bottom: 0;
}

.docs-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-top: 64px;
    padding-top: 48px;
    border-top: 1px solid var(--border-light);
    text-align: center;
}

.docs-footer p {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    margin-bottom: 0;
}

.docs-footer .back-home-link {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--motion-fast);
}

.docs-footer .back-home-link:hover {
    color: var(--accent);
}

.docs-content h2 {
    font-size: var(--font-size-2xl);
    font-weight: 600;
    margin-top: 48px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}

.docs-content h3 {
    font-size: var(--font-size-xl);
    font-weight: 600;
    margin-top: 32px;
    margin-bottom: 12px;
}

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

.docs-content ul,
.docs-content ol {
    margin: 16px 0;
    padding-left: 24px;
    color: var(--text-secondary);
}

.docs-content li {
    margin-bottom: 8px;
    line-height: 1.7;
}

.docs-content a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.docs-content a.docs-card {
    text-decoration: none !important;
}

.docs-content a:hover {
    color: var(--accent-light);
}

.docs-content img {
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    margin: 24px 0;
    box-shadow: var(--shadow-sm);
}

/* --- Code Blocks --- */
.docs-content code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    padding: 2px 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 4px;
    color: var(--accent);
}

.docs-content pre {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    margin: 24px 0;
    overflow-x: auto;
    line-height: 1.6;
}

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

/* --- Callouts --- */
.callout {
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin: 24px 0;
    border-left: 4px solid;
}

.callout p {
    margin-bottom: 0;
}

.callout-title {
    font-weight: 700;
    font-size: var(--font-size-sm);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.callout-info {
    background: rgba(0, 200, 200, 0.06);
    border-color: var(--accent);
}

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

.callout-warning {
    background: rgba(255, 165, 0, 0.06);
    border-color: #ff9500;
}

.callout-warning .callout-title {
    color: #ff9500;
}

.callout-tip {
    background: rgba(52, 199, 89, 0.06);
    border-color: #34c759;
}

.callout-tip .callout-title {
    color: #34c759;
}

/* --- Steps --- */
.steps {
    counter-reset: step-counter;
    list-style: none;
    padding-left: 0;
}

.steps li {
    counter-increment: step-counter;
    position: relative;
    padding-left: 48px;
    margin-bottom: 24px;
}

.steps li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: var(--font-size-sm);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Table of Contents --- */
.toc {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    margin: 24px 0 40px;
}

.toc-title {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.toc ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

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

.toc a {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    text-decoration: none;
}

.toc a:hover {
    color: var(--accent);
}

/* --- Docs Landing Cards --- */
.docs-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin: 32px 0 48px;
}

.docs-card {
    padding: 32px;
    min-height: 220px;
    background: var(--glass-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    transition: transform var(--motion-normal) var(--ease-smooth),
        box-shadow var(--motion-normal) var(--ease-smooth),
        border-color var(--motion-normal) var(--ease-smooth);
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
}

.docs-card:hover {
    border-color: var(--accent-light);
    box-shadow: 0 12px 32px var(--accent-glow);
    transform: translateY(-4px);
    color: inherit;
}

.docs-card h3 {
    font-size: var(--font-size-lg);
    margin-top: 0;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.docs-card p {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: 0;
    line-height: 1.6;
}

.docs-card .card-icon {
    width: 40px;
    height: 40px;
    color: var(--accent);
    margin-bottom: 16px;
    padding: 8px;
    background: var(--accent-glow);
    border-radius: var(--radius-md);
}

/* --- Prev/Next Navigation --- */
.docs-nav-footer {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    margin-top: 64px;
    padding-top: 32px;
    border-top: 1px solid var(--border-light);
}

.docs-nav-link {
    display: flex;
    flex-direction: column;
    padding: 16px 20px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    text-decoration: none;
    flex: 1;
    transition: all var(--motion-fast) var(--ease-smooth);
}

.docs-nav-link:hover {
    border-color: var(--accent);
    background: rgba(0, 200, 200, 0.04);
}

.docs-nav-link .nav-label {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.docs-nav-link .nav-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--accent);
}

.docs-nav-link.next {
    text-align: right;
}

/* --- Search --- */
.docs-search {
    position: relative;
    margin-bottom: 24px;
    padding: 0 0 16px;
    border-bottom: 1px solid var(--border-light);
}

.docs-search-input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    font-size: var(--font-size-sm);
    font-family: var(--font-family);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    outline: none;
    transition: border-color var(--motion-fast) var(--ease-smooth);
    box-sizing: border-box;
}

.docs-search-input::placeholder {
    color: var(--text-tertiary);
}

.docs-search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.docs-search-icon {
    position: absolute;
    left: 10px;
    top: 11px;
    width: 16px;
    height: 16px;
    color: var(--text-tertiary);
    pointer-events: none;
}

.docs-search-results {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 200;
    background: var(--bg-elevated);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 400px;
    overflow-y: auto;
    margin-top: 4px;
}

.docs-search-results.visible {
    display: block;
}

.search-result-item a {
    display: block;
    padding: 12px 16px;
    text-decoration: none;
    border-bottom: 1px solid var(--border-light);
    transition: background var(--motion-fast);
}

.search-result-item:last-child a {
    border-bottom: none;
}

.search-result-item a:hover,
.search-result-item.selected a {
    background: rgba(0, 200, 200, 0.06);
}

.search-result-section {
    display: block;
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}

.search-result-title {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.search-result-snippet {
    display: block;
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    line-height: 1.5;
}

.search-result-snippet mark,
.search-result-title mark {
    background: rgba(0, 200, 200, 0.2);
    color: var(--accent);
    padding: 0 2px;
    border-radius: 2px;
}

.search-no-results {
    padding: 16px;
    text-align: center;
    font-size: var(--font-size-sm);
    color: var(--text-tertiary);
}

/* --- Responsive Docs --- */
@media (max-width: 1024px) {
    .docs-content {
        padding: 40px 40px;
    }
}

@media (max-width: 768px) {
    .docs-layout {
        grid-template-columns: 1fr;
    }

    .docs-sidebar {
        position: fixed;
        top: var(--header-height);
        left: 0;
        bottom: 0;
        width: 280px;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform var(--motion-normal) var(--ease-smooth);
    }

    .docs-sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-xl);
    }

    .docs-sidebar-toggle {
        display: flex;
    }

    .docs-content {
        padding: 32px 20px;
    }

    .docs-content h1 {
        font-size: var(--font-size-3xl);
    }

    .docs-nav-footer {
        flex-direction: column;
    }

    .docs-card-grid {
        grid-template-columns: 1fr;
    }
}