/* ===== Override base template green links ===== */
.docs-page a,
.docs-sidebar a,
.docs-sidebar a:hover,
.docs-header a,
.docs-header a:hover {
    color: inherit !important;
}

/* ===== Clickable links in docs content ===== */
.docs-block a,
.docs-callout a {
    color: #1db954 !important;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s, opacity 0.15s;
}
.docs-block a:hover,
.docs-callout a:hover {
    border-bottom-color: #1db954;
    opacity: 0.85;
    text-decoration: none;
}

/* ===== Docs Page Layout ===== */
.docs-page {
    display: flex;
    min-height: 100vh;
    background: var(--t-bg);
}

/* ===== Hide sidebar & topnav, go full-width ===== */
.app-container:has(.docs-page) .sidebar,
.app-container:has(.docs-page) .mobile-header,
.app-container:has(.docs-page) .sidebar-show-btn,
.app-container:has(.docs-page) .sidebar-edge-toggle,
.app-container:has(.docs-page) .overlay,
body:has(.docs-page) > .vk-topnav {
    display: none !important;
}
.app-container:has(.docs-page) .content {
    margin-left: 0 !important; width: 100% !important; max-width: 100% !important; padding-top: 0 !important;
}
.app-container:has(.docs-page) .content-inner {
    max-width: 100% !important; padding: 0 !important; margin: 0 !important;
}
html:has(.docs-page) {
    overflow-y: scroll;
    scrollbar-gutter: stable;
}
html:has(.docs-page),
body:has(.docs-page),
.content:has(.docs-page),
.content-inner:has(.docs-page),
.app-container:has(.docs-page) {
    background: var(--t-bg) !important;
}
.app-container:has(.docs-page) .footer { display: none !important; }
.app-container:has(.docs-page) .dv-nav { display: none !important; }
body:has(.docs-page) > .vk-mobile-sidebar-toggle { display: none !important; }
body:has(.docs-page) > .vk-mobile-overlay { display: none !important; }

/* ===== Top Header Bar (Mem0-style, no hard borders) ===== */
.docs-header {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    height: 48px;
    display: flex; align-items: center;
    padding: 0 1.25rem;
    background: var(--t-bg);
    border-bottom: none;
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.docs-header-left {
    display: flex; align-items: center; gap: 1rem;
}
.docs-header-logo {
    font-size: 14px; font-weight: 700; color: var(--t-text);
    text-decoration: none; letter-spacing: -0.02em;
    display: flex; align-items: center; gap: 0.5rem;
}
.docs-header-logo:hover { color: var(--t-text); text-decoration: none; }
.docs-header-logo .logo-separator {
    color: var(--t-text-dimmer); font-weight: 400; margin: 0 0.1rem;
}
.docs-header-logo .logo-docs {
    color: var(--t-text-muted); font-weight: 500;
}
.docs-header-right {
    display: flex; align-items: center; gap: 0.75rem;
    margin-left: auto;
}
.docs-header-btn {
    padding: 0.35rem 0.75rem; border-radius: 6px; font-size: 12px; font-weight: 500;
    border: none; background: transparent; color: var(--t-text-muted);
    cursor: pointer; transition: all 0.15s; text-decoration: none;
    display: flex; align-items: center; gap: 0.35rem;
}
.docs-header-btn:hover {
    color: var(--t-text); background: var(--t-bg-hover);
    text-decoration: none;
}

/* ===== Your Dashboard Button ===== */
.docs-header a.docs-dashboard-btn {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.4rem 0.9rem; border-radius: 20px; font-size: 11.5px; font-weight: 600;
    background: var(--t-bg-hover); color: var(--t-text-dimmer) !important;
    border: none;
    text-decoration: none !important; transition: all 0.15s; white-space: nowrap;
}
.docs-header a.docs-dashboard-btn:hover { color: var(--t-text) !important; background: var(--t-bg-active); text-decoration: none !important; }
.docs-header a.docs-dashboard-btn i { font-size: 10px; color: var(--t-text-dimmer) !important; }

/* ===== Theme Toggle ===== */
.docs-theme-toggle {
    width: 30px; height: 30px; border-radius: 50%;
    border: none; background: var(--t-bg-hover);
    color: var(--t-text-muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; transition: all 0.15s;
}
.docs-theme-toggle:hover { color: var(--t-text); background: var(--t-bg-active); }

/* ===== Center group (search + AI) ===== */
.docs-header-center {
    position: absolute; left: 50%; transform: translateX(-50%);
    display: flex; align-items: center; gap: 0.4rem;
}

/* ===== Search Bar (in header) ===== */
.docs-search-wrapper {
    position: relative;
    width: 280px;
}
.docs-search-input {
    width: 100%; padding: 0.4rem 4.2rem 0.4rem 2rem;
    border: none; border-radius: 8px;
    background: var(--t-bg-hover); color: var(--t-text);
    font-size: 12px; outline: none; transition: all 0.15s;
}
.docs-search-input::placeholder { color: var(--t-text-dimmer); }
.docs-search-input:focus {
    background: var(--t-bg-active);
    box-shadow: none;
}
.docs-search-icon {
    position: absolute; left: 0.6rem; top: 50%; transform: translateY(-50%);
    color: var(--t-text-dimmer); font-size: 12px; pointer-events: none;
}
.docs-search-kbd {
    position: absolute; right: 3.2rem; top: 50%; transform: translateY(-50%);
    font-size: 10px; color: var(--t-text-dimmer); background: transparent;
    border: none; border-radius: 3px;
    padding: 0.1rem 0.35rem; font-family: 'SF Mono', 'Menlo', monospace;
    pointer-events: none;
}

/* Search results dropdown */
.docs-search-results {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0;
    background: var(--t-bg-card); border: 1px solid var(--t-border);
    border-radius: 8px; box-shadow: var(--shadow-lg);
    max-height: 400px; overflow-y: auto; display: none; z-index: 200;
}
.docs-search-results.active { display: block; }
.docs-search-result-item {
    padding: 0.6rem 0.75rem; cursor: pointer; transition: background 0.1s;
    border-bottom: 1px solid var(--t-border-light);
}
.docs-search-result-item:last-child { border-bottom: none; }
.docs-search-result-item:hover { background: var(--t-bg-hover); }
.docs-search-result-title {
    font-size: 12px; font-weight: 600; color: var(--t-text); margin-bottom: 0.15rem;
}
.docs-search-result-category {
    font-size: 10px; color: var(--t-text-dimmer);
}
.docs-search-result-snippet {
    font-size: 11px; color: var(--t-text-muted); margin-top: 0.2rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.docs-search-result-item mark {
    background: rgba(54, 118, 224, 0.2); color: var(--t-text); border-radius: 2px;
    padding: 0 1px;
}
.docs-search-empty {
    padding: 1.5rem; text-align: center; font-size: 12px; color: var(--t-text-dimmer);
}

/* ===== Sidebar ===== */
.docs-sidebar {
    position: fixed; top: 48px; left: 0; bottom: 0;
    width: 220px; overflow-y: auto;
    padding: 1rem 0;
    border-right: none;
    background: var(--t-bg);
    scrollbar-width: thin;
}
.docs-sidebar::-webkit-scrollbar { width: 4px; }
.docs-sidebar::-webkit-scrollbar-thumb { background: var(--t-border); border-radius: 2px; }

.docs-nav-category {
    padding: 0 1rem; margin-bottom: 0.25rem;
}
.docs-nav-category-title {
    font-size: 11px; font-weight: 700; color: var(--t-text-muted);
    text-transform: uppercase; letter-spacing: 0.05em;
    padding: 0.5rem 0.5rem 0.35rem; margin: 0;
}
.docs-nav-item {
    display: block; padding: 0.35rem 0.5rem 0.35rem 0.75rem;
    font-size: 12.5px; color: var(--t-text-secondary);
    text-decoration: none; border-radius: 5px;
    transition: all 0.1s; cursor: pointer;
    line-height: 1.5;
}
.docs-nav-item:hover {
    color: var(--t-text); background: var(--t-bg-hover); text-decoration: none;
}
.docs-nav-item.active {
    color: var(--t-text); background: var(--t-bg-active); font-weight: 600;
}
.docs-nav-parent {
    position: relative;
}
.docs-nav-parent::after {
    content: '\F285'; /* bi-chevron-right */
    font-family: 'bootstrap-icons';
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    font-size: 10px; color: var(--t-text-dimmer);
    transition: transform 0.2s;
}
.docs-nav-parent.expanded::after {
    transform: translateY(-50%) rotate(90deg);
}
.docs-nav-children {
    display: none;
    padding-left: 0.5rem;
    margin: 2px 0;
    border-left: 1.5px solid var(--t-border);
    margin-left: 1rem;
}
.docs-nav-children.open {
    display: block;
}
.docs-nav-child {
    font-size: 12px !important;
    padding: 0.25rem 0.5rem 0.25rem 0.65rem !important;
    color: var(--t-text-dimmer) !important;
}

/* ===== Main Content Area ===== */
.docs-main {
    margin-left: 220px; margin-top: 48px;
    flex: 1; min-height: calc(100vh - 48px);
    display: flex; justify-content: center;
    transition: margin-right 0.25s ease;
}
.docs-main.ai-open {
    margin-right: 340px;
}
.docs-main.ai-open.ai-expanded {
    margin-right: 560px;
}
.docs-content {
    width: 100%; max-width: 1200px;
    padding: 2.5rem 2rem 4rem;
}

/* ===== Article Sections ===== */
.docs-section {
    display: none;
}
.docs-section.active {
    display: block;
}

/* Section header */
.docs-section-header {
    margin-bottom: 2rem;
}
.docs-section-breadcrumb {
    font-size: 11px; color: var(--t-text-dimmer); margin-bottom: 0.5rem;
    display: flex; align-items: center; gap: 0.35rem;
}
.docs-section-breadcrumb a {
    color: var(--t-text-dimmer); text-decoration: none;
}
.docs-section-breadcrumb a:hover { color: var(--t-text-muted); }
.docs-section-title {
    font-size: 1.5rem; font-weight: 700; color: var(--t-text);
    letter-spacing: -0.03em; margin: 0 0 0.5rem;
    line-height: 1.3;
}
.docs-section-desc {
    font-size: 13px; color: var(--t-text-muted); line-height: 1.7;
}

/* Content blocks */
.docs-block {
    margin-bottom: 2rem;
}
.docs-block h3 {
    font-size: 15px; font-weight: 700; color: var(--t-text);
    margin: 0 0 0.75rem; letter-spacing: -0.01em;
    padding-top: 0.5rem;
}
.docs-block p {
    font-size: 13px; color: var(--t-text-secondary); line-height: 1.8;
    margin: 0 0 0.75rem;
}
.docs-block ul, .docs-block ol {
    font-size: 13px; color: var(--t-text-secondary); line-height: 1.8;
    padding-left: 1.25rem; margin: 0 0 0.75rem;
}
.docs-block li {
    margin-bottom: 0.35rem;
}
.docs-block strong {
    color: var(--t-text); font-weight: 600;
}
.docs-block code {
    font-size: 11.5px; background: var(--t-bg-hover); border: 1px solid var(--t-border);
    border-radius: 3px; padding: 0.1rem 0.35rem; font-family: 'SF Mono', 'Menlo', monospace;
    color: var(--t-text);
}

/* Info / Tip cards */
.docs-callout {
    padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1.25rem;
    font-size: 12.5px; line-height: 1.7;
    display: flex; gap: 0.6rem; align-items: flex-start;
}
.docs-callout-icon {
    flex-shrink: 0; font-size: 14px; margin-top: 1px;
}
.docs-callout-info {
    background: rgba(54, 118, 224, 0.06); border: 1px solid rgba(54, 118, 224, 0.15);
    color: var(--t-text-secondary);
}
.docs-callout-info .docs-callout-icon { color: #3676E0; }
.docs-callout-tip {
    background: var(--t-green-bg); border: 1px solid rgba(16, 185, 129, 0.2);
    color: var(--t-text-secondary);
}
.docs-callout-tip .docs-callout-icon { color: var(--t-green-text); }
.docs-callout-warn {
    background: var(--t-yellow-bg); border: 1px solid var(--t-yellow-border);
    color: var(--t-text-secondary);
}
.docs-callout-warn .docs-callout-icon { color: var(--t-yellow-text); }

/* Feature comparison table */
.docs-table {
    width: 100%; border-collapse: collapse; margin-bottom: 1.25rem;
    font-size: 12.5px;
}
.docs-table th {
    text-align: left; padding: 0.5rem 0.75rem;
    font-weight: 600; color: var(--t-text);
    border-bottom: 2px solid var(--t-border);
    background: var(--t-bg-hover);
}
.docs-table td {
    padding: 0.5rem 0.75rem; color: var(--t-text-secondary);
    border-bottom: 1px solid var(--t-border-light);
}
.docs-table tr:hover td { background: var(--t-bg-hover); }

/* ===== FAQ Section ===== */
.docs-faq-list {
    margin-top: 0.5rem;
}
.docs-faq-item {
    border: 1px solid var(--t-border); border-radius: 8px;
    margin-bottom: 0.5rem; overflow: hidden;
}
.docs-faq-question {
    padding: 0.75rem 1rem; font-size: 13px; font-weight: 600;
    color: var(--t-text); cursor: pointer;
    display: flex; align-items: center; justify-content: space-between;
    transition: background 0.15s; user-select: none;
}
.docs-faq-question:hover { background: var(--t-bg-hover); }
.docs-faq-question .toggle-icon {
    font-size: 10px; color: var(--t-text-muted);
    transition: transform 0.2s;
}
.docs-faq-item.open .docs-faq-question .toggle-icon {
    transform: rotate(180deg);
}
.docs-faq-answer {
    max-height: 0; overflow: hidden; transition: max-height 0.3s ease;
}
.docs-faq-item.open .docs-faq-answer {
    max-height: 800px;
}
.docs-faq-answer-inner {
    padding: 0 1rem 0.75rem; font-size: 12.5px;
    color: var(--t-text-secondary); line-height: 1.8;
}
.docs-faq-answer-inner p { margin: 0.35rem 0; }
.docs-faq-answer-inner strong { color: var(--t-text); }

/* ===== Feature Grid (home page) ===== */
.docs-feature-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 0.75rem; margin-bottom: 1.5rem;
}
.docs-feature-card {
    padding: 1rem 1.1rem; border: 1px solid var(--t-border);
    border-radius: 8px; cursor: pointer; transition: all 0.15s;
    text-decoration: none;
}
.docs-feature-card:hover {
    border-color: var(--t-border-hover); background: var(--t-bg-hover);
    text-decoration: none;
}
.docs-feature-card-icon {
    font-size: 18px; margin-bottom: 0.5rem; color: var(--t-text-muted);
}
.docs-feature-card-title {
    font-size: 13px; font-weight: 600; color: var(--t-text); margin-bottom: 0.25rem;
}
.docs-feature-card-desc {
    font-size: 11.5px; color: var(--t-text-muted); line-height: 1.5;
}

/* ===== Platform badges ===== */
.docs-platforms {
    display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.docs-platform-badge {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.25rem 0.6rem; border-radius: 20px;
    font-size: 11px; font-weight: 500;
    background: var(--t-bg-hover); border: 1px solid var(--t-border);
    color: var(--t-text-muted) !important; text-decoration: none !important;
}
.docs-platform-badge:hover { color: var(--t-text) !important; text-decoration: none !important; }

/* ===== Quota table ===== */
.docs-quota-table {
    width: 100%; margin: 0.5rem 0 1rem;
}
.docs-quota-row {
    display: flex; justify-content: space-between;
    padding: 0.4rem 0; border-bottom: 1px solid var(--t-border-light);
    font-size: 12.5px;
}
.docs-quota-row:last-child { border-bottom: none; }
.docs-quota-fn { color: var(--t-text-secondary); }
.docs-quota-val { color: var(--t-text); font-weight: 600; font-family: 'SF Mono', 'Menlo', monospace; }

/* ===== Mobile sidebar toggle ===== */
.docs-mobile-toggle {
    display: none;
    position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 150;
    width: 48px; height: 48px; border-radius: 14px;
    background: var(--t-bg-card); border: 1px solid var(--t-border);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15); color: var(--t-text);
    font-size: 20px; cursor: pointer;
    align-items: center; justify-content: center;
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .docs-sidebar {
        position: fixed; top: 0; left: 0; bottom: 0;
        width: 280px; max-width: 85vw;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 200;
        background: var(--t-bg);
        border-right: 1px solid var(--t-border);
        box-shadow: 4px 0 24px rgba(0,0,0,0.2);
        padding-top: 52px;
    }
    .docs-sidebar.mobile-open {
        transform: translateX(0);
    }
    .docs-main {
        margin-left: 0;
    }
    .docs-content {
        padding: 1.5rem 1rem 5rem;
    }
    .docs-mobile-toggle {
        display: flex;
    }
    .docs-feature-grid {
        grid-template-columns: 1fr;
    }
    .docs-header {
        flex-wrap: wrap;
        height: auto;
        padding: 0.5rem 0.75rem;
        gap: 0.4rem;
    }
    .docs-header-center {
        position: static;
        transform: none;
        order: 3;
        width: 100%;
    }
    .docs-search-wrapper {
        width: 100%;
    }
    .docs-search-kbd {
        display: none;
    }
    .docs-header-logo .logo-separator,
    .docs-header-logo .logo-docs {
        display: none;
    }
    .docs-section-title {
        font-size: 1.25rem;
    }
    .docs-table {
        font-size: 11.5px;
    }
    .docs-table th, .docs-table td {
        padding: 0.4rem 0.5rem;
    }
}

/* Mobile overlay */
.docs-mobile-overlay {
    position: fixed; inset: 0; z-index: 190;
    background: rgba(0,0,0,0);
    pointer-events: none;
    transition: background 0.3s ease;
}
.docs-mobile-overlay.active {
    background: rgba(0,0,0,0.4);
    pointer-events: auto;
    backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}

/* ===== Scrollbar for main ===== */
.docs-main::-webkit-scrollbar { width: 6px; }
.docs-main::-webkit-scrollbar-thumb { background: var(--t-border); border-radius: 3px; }

/* ===== Step indicators ===== */
.docs-steps {
    counter-reset: step-counter;
    list-style: none; padding: 0; margin: 0 0 1.25rem;
}
.docs-step {
    counter-increment: step-counter;
    position: relative;
    padding: 0.75rem 0 0.75rem 2.5rem;
    border-left: 2px solid var(--t-border);
    margin-left: 0.75rem;
}
.docs-step:last-child { border-left-color: transparent; }
.docs-step::before {
    content: counter(step-counter);
    position: absolute; left: -11px; top: 0.75rem;
    width: 20px; height: 20px; border-radius: 50%;
    background: var(--t-bg-active); border: 2px solid var(--t-border-hover);
    color: var(--t-text); font-size: 10px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.docs-step-title {
    font-size: 13px; font-weight: 600; color: var(--t-text); margin-bottom: 0.25rem;
}
.docs-step-desc {
    font-size: 12.5px; color: var(--t-text-secondary); line-height: 1.7;
}
