/* CAISG Premium Corporate Dark Mode Documentation Theme */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Base Colors - CAISG Brand */
    --docs-primary: #0ea5e9;
    --docs-primary-hover: #0284c7;
    --docs-accent: #38bdf8;
    
    /* Dark Theme Default (matches CAISG app) */
    --docs-bg: #0f172a;        /* Slate 900 */
    --docs-sidebar-bg: #020617; /* Slate 950 */
    --docs-header-bg: #020617;  /* Slate 950 */
    --docs-surface: #1e293b;   /* Slate 800 */
    --docs-border: #334155;    /* Slate 700 */
    
    /* Text Colors */
    --docs-text: #f8fafc;      /* Slate 50 */
    --docs-text-muted: #cbd5e1; /* Slate 300 */
    --docs-text-faint: #94a3b8; /* Slate 400 */
    
    /* Structural */
    --docs-sidebar-width: 280px;
    --docs-toc-width: 240px;
    --docs-header-height: 64px;
    --docs-radius: 8px;
    --docs-code-bg: #0f172a;
}

/* Light theme overrides (optional, accessed via toggle) */
[data-theme="light"] {
    --docs-bg: #f8fafc;
    --docs-sidebar-bg: #ffffff;
    --docs-header-bg: #ffffff;
    --docs-surface: #ffffff;
    --docs-border: #e2e8f0;
    
    --docs-text: #0f172a;
    --docs-text-muted: #334155;
    --docs-text-faint: #64748b;
    --docs-code-bg: #f1f5f9;
}

* {
    box-sizing: border-box;
}

body.docs-layout {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--docs-bg);
    color: var(--docs-text);
    margin: 0;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--docs-bg);
}
::-webkit-scrollbar-thumb {
    background: var(--docs-border);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--docs-text-faint);
}

/* Header */
.docs-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--docs-header-height);
    background-color: var(--docs-header-bg);
    border-bottom: 1px solid var(--docs-border);
    z-index: 100;
    display: flex;
    align-items: center;
    padding: 0 24px;
}

.docs-header-inner {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
}

.docs-logo {
    display: flex;
    align-items: center;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--docs-text);
    text-decoration: none;
    margin-right: 48px;
    letter-spacing: 0.5px;
}

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

.docs-logo:hover {
    color: var(--docs-text);
}

.docs-search {
    flex: 1;
    max-width: 400px;
}

.docs-search input {
    width: 100%;
    padding: 10px 18px;
    border: 1px solid var(--docs-border);
    border-radius: 24px;
    background-color: var(--docs-surface);
    color: var(--docs-text);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.docs-search input:focus {
    outline: none;
    border-color: var(--docs-primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

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

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

.docs-header-actions a,
.btn-theme-toggle {
    color: var(--docs-text-faint);
    font-size: 1.1rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.docs-header-actions a:hover,
.btn-theme-toggle:hover {
    color: var(--docs-text);
    background-color: var(--docs-surface);
}

/* Body Layout */
.docs-body {
    display: flex;
    padding-top: var(--docs-header-height);
    min-height: 100vh;
    max-width: 1600px;
    margin: 0 auto;
}

/* Sidebar */
.docs-sidebar {
    position: fixed;
    top: var(--docs-header-height);
    left: max(0px, calc((100vw - 1600px) / 2));
    bottom: 0;
    width: var(--docs-sidebar-width);
    background-color: var(--docs-sidebar-bg);
    border-right: 1px solid var(--docs-border);
    overflow-y: auto;
    padding: 32px 0;
}

.docs-sidebar-inner {
    padding: 0 20px;
}

.docs-nav-group {
    margin-bottom: 32px;
}

.docs-nav-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--docs-text-faint);
    margin: 0 12px 12px 12px;
}

.docs-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.docs-nav-list li {
    margin-bottom: 4px;
}

.docs-nav-link {
    display: block;
    padding: 8px 12px;
    color: var(--docs-text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.docs-nav-link:hover {
    color: var(--docs-text);
    background-color: rgba(255, 255, 255, 0.05);
}

.docs-nav-link.active {
    color: var(--docs-primary);
    background-color: rgba(14, 165, 233, 0.1);
    border-left-color: var(--docs-primary);
}

/* Main Content */
.docs-content {
    flex: 1;
    margin-left: var(--docs-sidebar-width);
    margin-right: var(--docs-toc-width);
    padding: 48px 64px;
    min-width: 0; /* Prevent flex overflow */
}

.docs-content-inner {
    max-width: 800px;
    margin: 0 auto;
}

/* Breadcrumb */
.docs-breadcrumb {
    margin-bottom: 32px;
}

.docs-breadcrumb .breadcrumb {
    background: none;
    padding: 0;
    margin: 0;
    font-size: 0.875rem;
    font-weight: 500;
}

.docs-breadcrumb .breadcrumb-item a {
    color: var(--docs-primary);
    text-decoration: none;
}

.docs-breadcrumb .breadcrumb-item a:hover {
    text-decoration: underline;
}

.docs-breadcrumb .breadcrumb-item.active {
    color: var(--docs-text-faint);
}

.docs-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    content: "/";
    color: var(--docs-text-faint);
}

/* Article & Markdown Content */
.docs-article {
    margin-bottom: 64px;
}

.docs-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: #ffffff;
    margin: 0 0 32px 0;
    letter-spacing: -0.025em;
}

.docs-body-content h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #ffffff;
    margin: 48px 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--docs-border);
    letter-spacing: -0.025em;
}

.docs-body-content h3 {
    font-size: 1.35rem;
    font-weight: 600;
    color: #ffffff;
    margin: 32px 0 16px 0;
}

.docs-body-content p {
    margin: 0 0 20px 0;
    font-size: 1.1rem;
}

.docs-body-content ul,
.docs-body-content ol {
    margin: 0 0 24px 0;
    padding-left: 24px;
    font-size: 1.1rem;
}

.docs-body-content li {
    margin-bottom: 10px;
}

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

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

.docs-body-content strong {
    color: #ffffff;
    font-weight: 600;
}

.docs-body-content code {
    background-color: var(--docs-surface);
    color: var(--docs-accent);
    padding: 3px 6px;
    border-radius: 6px;
    font-size: 0.9em;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    border: 1px solid var(--docs-border);
}

.docs-body-content pre {
    background-color: var(--docs-code-bg);
    border: 1px solid var(--docs-border);
    padding: 20px;
    border-radius: var(--docs-radius);
    overflow-x: auto;
    margin: 24px 0;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.docs-body-content pre code {
    background: none;
    color: #e2e8f0;
    padding: 0;
    border: none;
    font-size: 0.9em;
}

.docs-body-content blockquote {
    border-left: 4px solid var(--docs-primary);
    background-color: rgba(14, 165, 233, 0.05);
    padding: 16px 24px;
    margin: 24px 0;
    border-radius: 0 var(--docs-radius) var(--docs-radius) 0;
    color: var(--docs-text-muted);
}

.docs-body-content blockquote p {
    margin-bottom: 0;
}

.docs-body-content table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 32px 0;
    border: 1px solid var(--docs-border);
    border-radius: var(--docs-radius);
    overflow: hidden;
}

.docs-body-content th,
.docs-body-content td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--docs-border);
}

.docs-body-content th {
    background-color: var(--docs-surface);
    font-weight: 600;
    color: #ffffff;
}

.docs-body-content tr:last-child td {
    border-bottom: none;
}

.docs-body-content hr {
    border: none;
    border-top: 1px solid var(--docs-border);
    margin: 48px 0;
}

/* Pagination */
.docs-pagination {
    display: flex;
    gap: 24px;
    margin-top: 64px;
    padding-top: 32px;
    border-top: 1px solid var(--docs-border);
}

.docs-pagination-link {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 24px;
    background-color: var(--docs-surface);
    border: 1px solid var(--docs-border);
    border-radius: var(--docs-radius);
    text-decoration: none;
    transition: all 0.2s ease;
}

.docs-pagination-link:hover {
    border-color: var(--docs-primary);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.docs-pagination-link.prev {
    justify-content: flex-start;
}

.docs-pagination-link.next {
    justify-content: flex-end;
    text-align: right;
}

.docs-pagination-link i {
    color: var(--docs-text-faint);
    font-size: 1.25rem;
    transition: color 0.2s;
}

.docs-pagination-link:hover i {
    color: var(--docs-primary);
}

.docs-pagination-link small {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--docs-text-faint);
    margin-bottom: 6px;
}

.docs-pagination-link div {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--docs-text);
}

/* Right TOC */
.docs-toc {
    position: fixed;
    top: var(--docs-header-height);
    right: max(0px, calc((100vw - 1600px) / 2));
    bottom: 0;
    width: var(--docs-toc-width);
    border-left: 1px solid var(--docs-border);
    padding: 32px 24px;
    overflow-y: auto;
}

.docs-toc-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--docs-text-faint);
    margin: 0 0 16px 0;
}

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

.docs-toc-list li {
    margin-bottom: 10px;
}

.docs-toc-list a {
    display: block;
    font-size: 0.875rem;
    color: var(--docs-text-muted);
    text-decoration: none;
    line-height: 1.4;
    transition: color 0.2s;
}

.docs-toc-list a:hover {
    color: var(--docs-text);
}

/* Footer */
.docs-footer {
    margin-left: var(--docs-sidebar-width);
    margin-right: var(--docs-toc-width);
    padding: 48px 64px;
    border-top: 1px solid var(--docs-border);
    background-color: var(--docs-bg);
}

.docs-footer-inner {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    font-size: 0.9rem;
    color: var(--docs-text-faint);
}

.docs-footer .separator {
    margin: 0 12px;
    color: var(--docs-border);
}

/* Responsive */
@media (max-width: 1280px) {
    .docs-toc {
        display: none;
    }
    .docs-content {
        margin-right: 0;
    }
    .docs-footer {
        margin-right: 0;
    }
}

@media (max-width: 850px) {
    .docs-sidebar {
        display: none;
    }
    .docs-content {
        margin-left: 0;
        padding: 32px 24px;
    }
    .docs-footer {
        margin-left: 0;
        padding: 32px 24px;
    }
    .docs-header-inner {
        justify-content: space-between;
    }
    .docs-search {
        display: none;
    }
}
