:root {
    --api-header-height: 56px;
    --api-sidebar-width: 260px;
    
    /* Plaid/Stripe-style Minimalist Grays */
    --api-bg: #ffffff;
    --api-surface: #ffffff;
    --api-surface-alt: #f9fafb; 
    --api-border: #e2e8f0;
    --api-border-dark: #cbd5e1;
    
    --api-text-main: #0f172a; 
    --api-text-muted: #475569; 
    --api-text-light: #94a3b8; 
    
    /* Code Syntax Colors */
    --api-code-bg: #111b27;
    --api-code-text: #e3eaf2;
    --api-code-key: #6cb8e6;    /* Light Blue */
    --api-code-string: #91d076; /* Green */
    --api-code-number: #e6d37a; /* Yellow */
    --api-code-null: #e9ae7e;   /* Orange */
    --api-code-method: #e6d37a; /* GET/POST Highlight */
    
    --api-font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --api-font-mono: 'Fira Code', ui-monospace, SFMono-Regular, Consolas, monospace;
}

* { box-sizing: border-box; }

body.bq-api-body {
    margin: 0;
    padding: 0;
    font-family: var(--api-font-sans);
    background: var(--api-bg);
    color: var(--api-text-main);
    -webkit-font-smoothing: antialiased;
}

/* =========================================
   1. GLOBAL HEADER
   ========================================= */
.api-global-header {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--api-header-height); background: var(--api-surface);
    border-bottom: 1px solid var(--api-border); z-index: 1000;
    display: flex; align-items: center;
}
.api-header-container { width: 100%; padding: 0 32px; display: flex; justify-content: space-between; align-items: center; }
.api-header-left { display: flex; align-items: center; }
.api-logo { height: 24px; display: block; }
.api-logo-text { font-family: var(--api-font-sans); font-weight: 600; font-size: 18px; color: #478bff; letter-spacing: -0.02em; margin-top: 1px;}

.api-header-nav { display: flex; align-items: center; gap: 32px; }

/* Custom Link with animated SVG Arrow */
.api-link-bq { 
    display: flex; align-items: center; gap: 4px; color: var(--api-text-muted); 
    text-decoration: none; font-size: 14px; font-weight: 500; transition: color 0.2s; 
}
.api-link-bq svg { transition: transform 0.2s; }
.api-link-bq:hover { color: #478bff; }
.api-link-bq:hover svg { transform: translateX(3px); }

/* Buttons */
.api-header-actions { display: flex; align-items: center; gap: 16px; }
.api-btn-secondary { background: #fff; border: 1px solid var(--api-border-dark); color: var(--api-text-main); padding: 8px 16px; border-radius: 4px; font-weight: 600; font-size: 14px; text-decoration: none; transition: border-color 0.2s; display: inline-flex; justify-content: center; align-items: center; }
.api-btn-secondary:hover { border-color: var(--api-text-main); }
.api-btn-primary { background: var(--api-text-main); border: 1px solid var(--api-text-main); color: #fff; padding: 8px 16px; border-radius: 4px; font-weight: 600; font-size: 14px; text-decoration: none; transition: opacity 0.2s; display: inline-flex; justify-content: center; align-items: center; }
.api-btn-primary:hover { opacity: 0.9; }

/* Mobile Navigation Helpers */
.api-mobile-menu-btn { display: none; }
.api-mobile-only-nav { display: none; }

/* =========================================
   2. SIDEBAR
   ========================================= */
.api-sidebar {
    position: fixed; top: var(--api-header-height); bottom: 0; left: 0;
    width: var(--api-sidebar-width); background: var(--api-surface-alt);
    border-right: 1px solid var(--api-border); overflow-y: auto; z-index: 100;
}
.api-sidebar-inner { padding: 32px 15px; }

/* Fixed Search Button Styling */
.api-search-btn {
    display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 10px 14px;
    background: #ffffff; border: 1px solid var(--api-border); border-radius: 6px; color: var(--api-text-muted);
    cursor: pointer; margin-bottom: 32px; box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
.api-search-btn:hover { border-color: var(--api-border-dark); }
.api-search-placeholder { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500;}
.api-search-shortcut { 
    background: var(--api-surface-alt); border: 1px solid var(--api-border); 
    border-radius: 4px; padding: 2px 8px; font-size: 12px; font-family: var(--api-font-mono); color: var(--api-text-muted);
}

.api-nav-group { margin-bottom: 32px; }
.api-nav-heading { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--api-text-main); margin: 0 0 12px 10px; font-weight: 700; }
.api-nav-list { list-style: none; padding: 0; margin: 0; }
.api-nav-list a { 
    display: flex; justify-content: space-between; align-items: center; 
    padding: 8px 10px; text-decoration: none; color: var(--api-text-muted); 
    font-size: 14px; font-weight: 500; border-radius: 4px; transition: background 0.1s;
}
.api-nav-list a:hover { background: #f1f5f9; color: var(--api-text-main); }
.api-nav-list a.active { background: #e2e8f0; color: var(--api-text-main); font-weight: 600; }

.api-badge { font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px; font-family: var(--api-font-mono); }
.api-badge-get { background: #e0e7ff; color: #3730a3; }
.api-badge-post { background: #fef3c7; color: #92400e; } 

/* =========================================
   3. MAIN CONTENT
   ========================================= */
.api-content {
    margin-left: var(--api-sidebar-width); 
    margin-top: var(--api-header-height);
    width: calc(100% - var(--api-sidebar-width)); 
    padding: 64px 80px 0 80px; 
    min-height: calc(100vh - var(--api-header-height)); 
    display: flex; flex-direction: column;
}
.api-content-inner { 
    width: 100%; 
    max-width: 1400px; 
    margin: 0 auto; 
    flex: 1; 
}

.api-page-header { margin-bottom: 48px; }
.api-page-header h1 { font-size: 32px; font-weight: 700; margin: 0 0 16px; color: var(--api-text-main); letter-spacing: -0.01em; }
.api-description { font-size: 16px; color: var(--api-text-muted); margin: 0; line-height: 1.6; }

/* =========================================
   4. ARTIFACTS & CODE BLOCKS
   ========================================= */
.api-grid { 
    display: flex; 
    justify-content: space-between; 
    gap: 80px; 
    align-items: flex-start; 
}

.api-grid-left { flex: 1; max-width: 650px; }
.api-grid-right { flex: 1; max-width: 550px; margin-left: auto; }

.api-grid h2 { 
    font-size: 18px; margin: 0 0 8px 0; color: var(--api-text-main); 
    font-weight: 700; border-bottom: 1px solid var(--api-border); padding-bottom: 12px;
}

.api-param-description { font-size: 14px; color: var(--api-text-muted); margin: 0 0 24px 0; line-height: 1.5; }

.api-endpoint-box { 
    display: flex; /* Changed from inline-flex */
    align-items: flex-start; /* Keeps the GET badge at the top if text wraps */
    flex-wrap: wrap; /* Allows natural wrapping */
    gap: 12px; 
    background: #ffffff; 
    border: 1px solid var(--api-border); 
    padding: 10px 16px; 
    border-radius: 4px; 
    margin-bottom: 48px; 
    font-family: var(--api-font-mono); 
    font-size: 14px; 
    color: var(--api-text-main); 
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
    
    /* New rules to prevent mobile spilling */
    max-width: 100%;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.6;
}

.api-param-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.api-param-table th, .api-param-table td { padding: 12px 0; border-bottom: 1px solid var(--api-border); text-align: left; vertical-align: top; line-height: 1.5; }
.api-param-table th { color: var(--api-text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; padding-bottom: 12px; }
.api-param-table td:nth-child(1) { font-weight: 600; color: var(--api-text-main); padding-right: 24px; } 

.api-param-table td:nth-child(2) { 
    color: var(--api-text-muted); font-family: var(--api-font-sans); font-size: 14px; 
} 
.api-param-table code {
    font-family: var(--api-font-mono); font-size: 12.5px; background: var(--api-surface-alt);
    padding: 2px 6px; border-radius: 4px; border: 1px solid var(--api-border); color: var(--api-text-main);
}

.api-code-container {
    background: var(--api-code-bg); border-radius: 6px;
    margin-bottom: 32px; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}
.api-code-header {
    display: flex; justify-content: space-between; align-items: center; padding: 10px 16px;
    background: var(--api-code-bg); border-bottom: 1px solid #2e3c51; color: #94a3b8; font-size: 12px; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase;
    border-top-left-radius: 6px; border-top-right-radius: 6px;
}

/* Tooltip Styles for Copy Button */
.api-code-copy-btn {
    position: relative; background: transparent; border: none; color: #94a3b8;
    cursor: pointer; padding: 6px; border-radius: 4px; display: flex;
    align-items: center; justify-content: center; transition: all 0.2s;
}
.api-code-copy-btn::before {
    content: attr(data-tooltip); position: absolute; bottom: 100%; left: 50%;
    transform: translateX(-50%) translateY(-4px); background: #334155; color: #fff;
    font-size: 12px; padding: 4px 8px; border-radius: 4px; white-space: nowrap;
    opacity: 0; visibility: hidden; transition: opacity 0.2s, transform 0.2s; pointer-events: none;
    z-index: 10; font-family: var(--api-font-sans); text-transform: none; font-weight: 500; letter-spacing: 0;
}
.api-code-copy-btn:hover { background: #1e293b; color: #e3eaf2; }
.api-code-copy-btn:hover::before { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(-8px); }

.api-code-block { 
    background: transparent; color: var(--api-code-text); padding: 16px; 
    font-family: var(--api-font-mono); font-size: 13px; overflow-x: auto; 
    margin: 0; line-height: 1.6; white-space: pre-wrap; 
    border-bottom-left-radius: 6px; border-bottom-right-radius: 6px;
}
.api-code-block .token.key { color: var(--api-code-key); }
.api-code-block .token.string { color: var(--api-code-string); }
.api-code-block .token.number { color: var(--api-code-number); }
.api-code-block .token.boolean, .api-code-block .token.null { color: var(--api-code-null); }
.api-code-block .token.method { color: var(--api-code-method); }
.api-code-block .token.punctuation { color: var(--api-code-text); }

/* Modal Search */
.api-search-overlay { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.4); z-index: 99999; align-items: flex-start; justify-content: center; padding-top: 10vh; }
.api-search-overlay.active { display: flex; }
.api-search-modal { background: #fff; width: 100%; max-width: 640px; border-radius: 8px; overflow: hidden; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1); }
.api-search-header { display: flex; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--api-border); }
.api-search-header input { flex: 1; border: none; font-size: 18px; outline: none; width: 100%; color: var(--api-text-main);}
.api-esc-hint { font-size: 11px; font-family: var(--api-font-mono); color: var(--api-text-muted); background: var(--api-surface-alt); padding: 4px 8px; border-radius: 4px; border: 1px solid var(--api-border); }
.api-search-results { list-style: none; margin: 0; padding: 0; max-height: 400px; overflow-y: auto; }
.api-search-results li { border-bottom: 1px solid var(--api-border); }
.api-search-results li:last-child { border-bottom: none; }
.api-search-results a { display: block; padding: 16px 24px; text-decoration: none; color: var(--api-text-main); transition: background 0.1s; }
.api-search-results a:hover, .api-search-results a.active { background: #f8fafc; }
.api-search-results .result-title { display: block; font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.api-search-results .result-path { display: block; font-size: 12px; color: var(--api-text-muted); }

/* =========================================
   5. FOOTER
   ========================================= */
.api-global-footer { border-top: 1px solid var(--api-border); padding: 32px 0; margin-top: 64px; width: 100%; max-width: 1000px; margin-left: auto; margin-right: auto;}
.api-footer-container { display: flex; justify-content: space-between; align-items: center; color: var(--api-text-muted); font-size: 13px; }
.api-footer-links { display: flex; gap: 24px; }
.api-footer-links a { color: var(--api-text-muted); text-decoration: none; font-weight: 500; }
.api-footer-links a:hover { color: var(--api-text-main); }

/* =========================================
   6. RESPONSIVE / MOBILE
   ========================================= */
@media (max-width: 1200px) { 
    .api-grid { flex-direction: column; gap: 40px; } 
    .api-grid-left, .api-grid-right { max-width: 100%; margin-left: 0; }
}
@media (max-width: 900px) {
    .api-header-container { padding: 0 20px; }
    
    .api-mobile-menu-btn { 
        display: flex; background: transparent; border: none; color: var(--api-text-main); 
        cursor: pointer; padding: 8px; align-items: center; justify-content: center;
    }
    .api-header-nav { 
        display: none; position: absolute; top: var(--api-header-height); left: 0; width: 100%; 
        background: var(--api-surface); border-bottom: 1px solid var(--api-border); 
        flex-direction: column; align-items: flex-start; padding: 24px; gap: 20px; 
        box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); max-height: calc(100vh - var(--api-header-height));
        overflow-y: auto;
    }
    .api-header-nav.active { display: flex; }
    
    .api-header-actions { width: 100%; display: flex; gap: 12px; margin-top: 4px; }
    .api-header-actions a { flex: 1; }

    .api-mobile-only-nav { display: block; width: 100%; margin-top: 4px; border-top: 1px solid var(--api-border); padding-top: 24px; }
    .api-mobile-only-nav .api-nav-group { margin-bottom: 24px; }

    .api-sidebar { display: none; }
    .api-content { margin-left: 0; width: 100%; padding: 32px 24px; }
}

/* ==============================================================
   Copy Button & Tooltip Styles
   ============================================================== */
.api-code-copy-btn { 
    position: relative; 
    overflow: visible; 
    cursor: pointer;
    background: transparent;
    border: none;
    color: #6b7280;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.api-code-copy-btn:hover {
    color: #111827;
    background: #f3f4f6;
}

/* The Tooltip Box */
.api-code-copy-btn::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(0px);
    background: #1f2937;
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    z-index: 50;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* The Tooltip Arrow pointing down */
.api-code-copy-btn::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    border-width: 5px;
    border-style: solid;
    border-color: #1f2937 transparent transparent transparent;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    z-index: 50;
}

/* Hover and Active (Copied) States */
.api-code-copy-btn:hover::before,
.api-code-copy-btn.copied::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-8px);
}

.api-code-copy-btn:hover::after,
.api-code-copy-btn.copied::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-3px);
}

/* Success Green State when copied */
.api-code-copy-btn.copied::before {
    background: #10b981; /* Success Green */
}
.api-code-copy-btn.copied::after {
    border-color: #10b981 transparent transparent transparent;
}
.api-code-copy-btn.copied {
    color: #10b981;
}