/* Documentation page styles */
:root {
    --bg: #0b1020;
    --surface: rgba(255, 255, 255, 0.85);
    --surface-strong: rgba(255, 255, 255, 0.96);
    --text: #0f172a;
    --muted: #475569;
    --muted-2: #64748b;
    --border: rgba(15, 23, 42, 0.10);
    --shadow: 0 18px 60px rgba(2, 6, 23, 0.18);
    --shadow-soft: 0 10px 30px rgba(2, 6, 23, 0.10);
    --accent: #6d28d9;
    --accent-2: #2563eb;
    --accent-3: #06b6d4;
    --danger: #dc2626;
    --warning: #f59e0b;
    --ok: #16a34a;
    --code-bg: #0b1220;
    --code-text: #e5e7eb;
    --highlight: rgba(251, 191, 36, 0.35);
    --radius: 14px;
    --radius-sm: 10px;
    --transition: 180ms ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background:
        radial-gradient(1200px 700px at 10% 0%, rgba(109, 40, 217, 0.30), transparent 55%),
        radial-gradient(1000px 650px at 90% 5%, rgba(37, 99, 235, 0.22), transparent 52%),
        radial-gradient(900px 650px at 50% 100%, rgba(6, 182, 212, 0.16), transparent 55%),
        #0b1020;
    min-height: 100vh;
}

.docs-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.docs-header {
    background: rgba(255, 255, 255, 0.08);
    color: white;
    padding: 1.25rem 0;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(255,255,255,0.10);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    min-width: 320px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background:
        radial-gradient(12px 12px at 30% 30%, rgba(255,255,255,0.95), transparent 60%),
        radial-gradient(22px 22px at 70% 70%, rgba(255,255,255,0.35), transparent 60%),
        linear-gradient(135deg, rgba(109,40,217,1) 0%, rgba(37,99,235,1) 55%, rgba(6,182,212,1) 100%);
    box-shadow: 0 18px 40px rgba(0,0,0,0.20);
}

.brand-title {
    font-size: 1.15rem;
    font-weight: 650;
    letter-spacing: 0.2px;
    color: rgba(255,255,255,0.95);
}

.brand-subtitle {
    font-size: 0.95rem;
    color: rgba(255,255,255,0.72);
    margin-top: 2px;
}

.header-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.2px;
    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.92);
}

.badge-accent {
    background: rgba(109, 40, 217, 0.28);
    border-color: rgba(109, 40, 217, 0.55);
}

.badge-neutral {
    background: rgba(255, 255, 255, 0.07);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: flex-end;
    flex: 1;
    min-width: 320px;
}

.theme-toggle {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.16);
    background: rgba(255,255,255,0.10);
    color: rgba(255,255,255,0.92);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: rgba(255,255,255,0.14);
    border-color: rgba(255,255,255,0.26);
    transform: translateY(-1px);
}

.theme-toggle:active {
    transform: translateY(0);
}

.theme-icon-light,
.theme-icon-dark {
    position: absolute;
    font-size: 1.3rem;
    transition: opacity var(--transition), transform var(--transition);
}

.theme-icon-dark {
    opacity: 0;
    transform: rotate(90deg);
}

body[data-theme="dark"] .theme-icon-light {
    opacity: 0;
    transform: rotate(-90deg);
}

body[data-theme="dark"] .theme-icon-dark {
    opacity: 1;
    transform: rotate(0deg);
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 640px;
}

.search-box input {
    width: 100%;
    padding: 0.9rem 2.75rem 0.9rem 2.7rem;
    border: 1px solid rgba(255,255,255,0.16);
    border-radius: 14px;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.10);
    color: rgba(255,255,255,0.92);
    transition: all var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: rgba(255,255,255,0.36);
    box-shadow: 0 0 0 4px rgba(109, 40, 217, 0.25);
    background: rgba(255, 255, 255, 0.12);
}

.search-icon {
    position: absolute;
    left: 0.95rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    background:
        radial-gradient(circle at 35% 35%, rgba(255,255,255,0.95), rgba(255,255,255,0.55));
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M10 18a8 8 0 1 1 5.293-14.293A8 8 0 0 1 10 18m0-2a6 6 0 1 0 0-12a6 6 0 0 0 0 12m8.707 5.293l-4.1-4.1l1.414-1.414l4.1 4.1z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M10 18a8 8 0 1 1 5.293-14.293A8 8 0 0 1 10 18m0-2a6 6 0 1 0 0-12a6 6 0 0 0 0 12m8.707 5.293l-4.1-4.1l1.414-1.414l4.1 4.1z'/%3E%3C/svg%3E") center / contain no-repeat;
    pointer-events: none;
}

.search-clear {
    position: absolute;
    right: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.16);
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.85);
    cursor: pointer;
    transition: all var(--transition);
    display: none;
}

.search-clear:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.26);
}

.search-meta {
    position: absolute;
    left: 0;
    top: calc(100% + 8px);
    font-size: 0.9rem;
    color: rgba(255,255,255,0.72);
    padding: 0 6px;
    display: none;
}

.search-results {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 10px);
    background: rgba(255,255,255,0.98);
    border: 1px solid rgba(15,23,42,0.14);
    border-radius: 14px;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    display: none;
    z-index: 1200;
}

.search-results .result-item {
    padding: 12px 14px;
    cursor: pointer;
    border-bottom: 1px solid rgba(15,23,42,0.06);
}

.search-results .result-item:last-child {
    border-bottom: none;
}

.search-results .result-item:hover,
.search-results .result-item.active {
    background: rgba(109,40,217,0.08);
}

.search-results .result-title {
    font-weight: 650;
    color: #0f172a;
    font-size: 0.98rem;
    margin-bottom: 4px;
}

.search-results .result-snippet {
    color: #475569;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Main layout */
.docs-body {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    flex: 1;
    padding: 2rem;
    gap: 2rem;
}

/* Sidebar */
.docs-sidebar {
    width: 250px;
    flex-shrink: 0;
    position: sticky;
    top: 120px;
    height: fit-content;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
}

.sidebar-top {
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: var(--radius);
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.10);
    color: rgba(255,255,255,0.86);
}

.sidebar-title {
    font-weight: 700;
    letter-spacing: 0.2px;
    margin-bottom: 4px;
}

.sidebar-hint {
    color: rgba(255,255,255,0.70);
    font-size: 0.92rem;
    line-height: 1.35;
}

.docs-nav ul {
    list-style: none;
    background: rgba(255,255,255,0.10);
    border-radius: var(--radius);
    padding: 1rem 0;
    border: 1px solid rgba(255,255,255,0.10);
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
}

.docs-nav li {
    margin: 0;
}

.docs-nav .nav-group {
    padding: 0.75rem 1.2rem 0.35rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.9px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.58);
}

.docs-nav a {
    display: block;
    padding: 0.65rem 1.2rem;
    color: rgba(255,255,255,0.82);
    text-decoration: none;
    transition: all var(--transition);
    border-left: 3px solid transparent;
}

.docs-nav a:hover {
    background-color: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.95);
    border-left-color: rgba(255,255,255,0.55);
}

.docs-nav a.active {
    background-color: rgba(109,40,217,0.22);
    color: rgba(255,255,255,0.97);
    border-left-color: rgba(109,40,217,0.95);
    font-weight: 650;
}

/* Content */
.docs-content {
    flex: 1;
    background: rgba(255, 255, 255, 0.92);
    border-radius: var(--radius);
    padding: 2.8rem 3rem;
    box-shadow: var(--shadow);
    min-width: 0;
    border: 1px solid rgba(255,255,255,0.25);
    position: relative;
    display: flex;
    gap: 2rem;
}

.docs-content-inner {
    flex: 1;
    min-width: 0;
}

.docs-toc {
    width: 220px;
    flex-shrink: 0;
    position: sticky;
    top: 120px;
    height: fit-content;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    padding-left: 1rem;
    border-left: 1px solid rgba(15,23,42,0.08);
}

.toc-header {
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 1rem;
    padding-left: 0.5rem;
}

.toc-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.toc-nav a {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--muted-2);
    text-decoration: none;
    font-size: 0.9rem;
    border-radius: 8px;
    transition: all var(--transition);
    border-left: 2px solid transparent;
    margin-left: -0.5rem;
    padding-left: calc(0.5rem + 0.75rem);
}

.toc-nav a:hover {
    color: var(--accent);
    background: rgba(109, 40, 217, 0.06);
    border-left-color: rgba(109, 40, 217, 0.4);
}

.toc-nav a.active {
    color: var(--accent);
    font-weight: 600;
    background: rgba(109, 40, 217, 0.10);
    border-left-color: var(--accent);
}

.toc-nav a.toc-h2 {
    font-weight: 500;
}

.toc-nav a.toc-h3 {
    padding-left: calc(0.5rem + 0.75rem + 1rem);
    font-size: 0.85rem;
    color: var(--muted);
}

.toc-nav a.toc-h3.active {
    color: var(--accent);
}

@media (max-width: 1200px) {
    .docs-toc {
        display: none;
    }
    
    .docs-content {
        flex-direction: column;
    }
}

.doc-section {
    margin-bottom: 4rem;
    scroll-margin-top: 120px;
}

.doc-section:last-child {
    margin-bottom: 0;
}

.doc-section h2 {
    font-size: 2rem;
    color: #0f172a;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(15,23,42,0.10);
}

.doc-section h3 {
    font-size: 1.5rem;
    color: #111827;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.doc-section h4 {
    font-size: 1.25rem;
    color: #334155;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.doc-section p {
    margin-bottom: 1rem;
    color: #334155;
    line-height: 1.8;
}

.doc-section ul,
.doc-section ol {
    margin: 1rem 0 1rem 2rem;
    color: #334155;
}

.doc-section li {
    margin-bottom: 0.5rem;
    line-height: 1.8;
}

/* Code blocks */
pre {
    background: var(--code-bg);
    color: var(--code-text);
    padding: 1.5rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 1.5rem 0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    position: relative;
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 14px 40px rgba(2,6,23,0.22);
}

code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
}

.doc-section code:not(pre code) {
    background: rgba(109, 40, 217, 0.10);
    color: #5b21b6;
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-size: 0.9em;
    border: 1px solid rgba(109, 40, 217, 0.18);
}

.copy-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.16);
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.92);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
}

.copy-btn:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.26);
}

.copy-btn:active {
    transform: translateY(1px);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(2,6,23,0.08);
    border: 1px solid rgba(15,23,42,0.08);
}

thead {
    background: linear-gradient(135deg, rgba(109,40,217,1) 0%, rgba(37,99,235,1) 55%, rgba(6,182,212,1) 100%);
    color: white;
}

th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.95rem;
}

td {
    padding: 1rem;
    border-bottom: 1px solid #e2e8f0;
    color: #4a5568;
}

tbody tr:hover {
    background-color: rgba(2,6,23,0.03);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* Search highlight */
.highlight {
    background: var(--highlight);
    padding: 0.1em 0.2em;
    border-radius: 6px;
    font-weight: 650;
}

/* Callouts */
.callout {
    border-radius: var(--radius);
    padding: 14px 16px;
    margin: 16px 0 22px;
    border: 1px solid rgba(15,23,42,0.10);
    box-shadow: 0 12px 26px rgba(2,6,23,0.06);
    background: rgba(255,255,255,0.88);
}

.callout-title {
    font-weight: 750;
    margin-bottom: 8px;
    letter-spacing: 0.1px;
    color: #0f172a;
}

.callout-info {
    border-left: 5px solid rgba(6,182,212,0.95);
}

.callout-warning {
    border-left: 5px solid rgba(245,158,11,0.95);
}

/* Layout helpers */
.two-col {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 14px;
}

.mini-card {
    padding: 14px 14px;
    border-radius: var(--radius);
    border: 1px solid rgba(15,23,42,0.10);
    background: rgba(255,255,255,0.92);
    box-shadow: 0 10px 22px rgba(2,6,23,0.06);
}

.mini-card p {
    margin-bottom: 0;
}

.steps {
    margin-left: 1.2rem;
}

.steps li {
    margin-bottom: 18px;
}

.faq-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 14px;
}

.faq-item {
    border-radius: var(--radius);
    border: 1px solid rgba(15,23,42,0.10);
    background: rgba(255,255,255,0.92);
    padding: 14px 14px;
    box-shadow: 0 10px 22px rgba(2,6,23,0.06);
}

.faq-item h4 {
    margin-top: 0;
}

.toast {
    position: fixed;
    right: 22px;
    bottom: 22px;
    background: rgba(255,255,255,0.98);
    border: 1px solid rgba(15,23,42,0.12);
    border-radius: 14px;
    box-shadow: var(--shadow-soft);
    padding: 12px 14px;
    color: #0f172a;
    font-weight: 650;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: all 220ms ease;
    z-index: 5000;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive */
@media (max-width: 1024px) {
    .docs-body {
        flex-direction: column;
        padding: 1rem;
    }
    
    .docs-sidebar {
        width: 100%;
        position: static;
        max-height: none;
    }
    
    .docs-nav ul {
        display: flex;
        overflow-x: auto;
        padding: 0.5rem;
        gap: 6px;
    }
    
    .docs-nav li {
        white-space: nowrap;
    }

    .docs-nav .nav-group {
        display: none;
    }

    .docs-nav a {
        border-left: none;
        border-radius: 12px;
        border: 1px solid rgba(255,255,255,0.10);
    }
    
    .docs-content {
        padding: 2rem 1.5rem;
    }

    .two-col,
    .faq-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: stretch;
    }

    .header-left,
    .header-right {
        min-width: 0;
    }

    .search-box {
        max-width: 100%;
    }
    
    .docs-content {
        padding: 1.5rem 1rem;
    }
    
    .doc-section h2 {
        font-size: 1.5rem;
    }
    
    .doc-section h3 {
        font-size: 1.25rem;
    }
    
    pre {
        padding: 1rem;
        font-size: 0.85rem;
    }
    
    table {
        font-size: 0.9rem;
    }
    
    th, td {
        padding: 0.75rem 0.5rem;
    }
}

/* Scrollbar */
.docs-sidebar::-webkit-scrollbar {
    width: 6px;
}

.docs-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.docs-sidebar::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.docs-sidebar::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Dark theme */
body[data-theme="dark"] {
    --bg: #0b1020;
    --surface: rgba(255, 255, 255, 0.85);
    --surface-strong: rgba(255, 255, 255, 0.96);
    --text: #0f172a;
    --muted: #475569;
    --muted-2: #64748b;
    --border: rgba(15, 23, 42, 0.10);
}

body[data-theme="light"] {
    --bg: #ffffff;
    --surface: rgba(15, 23, 42, 0.03);
    --surface-strong: rgba(15, 23, 42, 0.05);
    --text: #0f172a;
    --muted: #64748b;
    --muted-2: #94a3b8;
    --border: rgba(15, 23, 42, 0.08);
    background:
        radial-gradient(1200px 700px at 10% 0%, rgba(109, 40, 217, 0.08), transparent 55%),
        radial-gradient(1000px 650px at 90% 5%, rgba(37, 99, 235, 0.06), transparent 52%),
        radial-gradient(900px 650px at 50% 100%, rgba(6, 182, 212, 0.04), transparent 55%),
        #ffffff;
}

body[data-theme="light"] .docs-header {
    background: rgba(255, 255, 255, 0.95);
    color: #0f172a;
    border-bottom: 1px solid rgba(15,23,42,0.08);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

body[data-theme="light"] .brand-title {
    color: #0f172a;
}

body[data-theme="light"] .brand-subtitle {
    color: #64748b;
}

body[data-theme="light"] .badge {
    border-color: rgba(15,23,42,0.12);
    background: rgba(15,23,42,0.04);
    color: #334155;
}

body[data-theme="light"] .theme-toggle {
    border-color: rgba(15,23,42,0.12);
    background: rgba(15,23,42,0.04);
    color: #334155;
}

body[data-theme="light"] .theme-toggle:hover {
    background: rgba(15,23,42,0.08);
    border-color: rgba(15,23,42,0.18);
}

body[data-theme="light"] .search-box input {
    border-color: rgba(15,23,42,0.12);
    background: rgba(15,23,42,0.04);
    color: #0f172a;
}

body[data-theme="light"] .search-box input:focus {
    border-color: rgba(109, 40, 217, 0.4);
    background: rgba(15,23,42,0.06);
}

body[data-theme="light"] .sidebar-top {
    background: rgba(15,23,42,0.04);
    border-color: rgba(15,23,42,0.08);
    color: #334155;
}

body[data-theme="light"] .sidebar-hint {
    color: #64748b;
}

body[data-theme="light"] .docs-nav ul {
    background: rgba(15,23,42,0.04);
    border-color: rgba(15,23,42,0.08);
}

body[data-theme="light"] .docs-nav .nav-group {
    color: #64748b;
}

body[data-theme="light"] .docs-nav a {
    color: #475569;
}

body[data-theme="light"] .docs-nav a:hover {
    background-color: rgba(15,23,42,0.06);
    color: #0f172a;
}

body[data-theme="light"] .docs-nav a.active {
    background-color: rgba(109,40,217,0.12);
    color: #6d28d9;
}

body[data-theme="light"] .docs-content {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(15,23,42,0.08);
}

body[data-theme="light"] .docs-toc {
    border-left-color: rgba(15,23,42,0.08);
}

body[data-theme="light"] .toc-header {
    color: #64748b;
}

body[data-theme="light"] .toc-nav a {
    color: #64748b;
}

body[data-theme="light"] .toc-nav a:hover {
    background: rgba(109, 40, 217, 0.08);
}

body[data-theme="light"] .toc-nav a.active {
    background: rgba(109, 40, 217, 0.12);
    color: #6d28d9;
}
