/* Teya display serif for headings (matches teya.com). Served from
   /fonts/denton-extrabold.woff2 — no third-party CDN dependency. */
@font-face {
    font-family: 'Denton ExtraBold';
    src: url('/https/docs.teya.com/fonts/denton-extrabold.woff2') format('woff2');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

:root {
    /* Brand - Lemonade Design System */
    --teya-lime: #e1e51a;           /* yellow-lime/500 */
    --teya-blue: #0092b8;           /* cyan/700 */
    --font-display: 'Denton ExtraBold', Georgia, 'Times New Roman', serif;

    /* Semantic tokens - light (default) */
    --bg-page: #f5f5f5;             /* teya.com page background */
    --bg-primary: #ffffff;           /* white */
    --bg-secondary: #f6f7f6;        /* neutral/50 */
    --bg-tertiary: #f1f3f1;         /* neutral/100 */
    --bg-sidebar: #f6f7f6;          /* neutral/50 */
    --bg-code: #1a1e19;             /* neutral/900 */
    --bg-code-header: #10140f;      /* neutral/950 */
    --bg-input: #ffffff;
    --bg-hover: #f1f3f1;            /* neutral/100 */
    --bg-card: #ffffff;
    --bg-overlay: rgba(0, 0, 0, 0.5);
    --bg-callout-info: rgba(0, 146, 184, 0.1);  /* cyan/700 alpha */
    --bg-callout-warn: #fef3c6;     /* amber/100 */
    --bg-admonition: #fffbea;       /* amber/50 */

    --text-primary: #1a1e19;        /* neutral/900 */
    --text-secondary: #535b51;      /* neutral/600 */
    --text-tertiary: #414a3f;       /* neutral/700 */
    --text-muted: #a3a9a2;          /* neutral/400 */
    --text-nav: #414a3f;            /* neutral/700 */
    --text-heading: #1a1e19;        /* neutral/900 */
    --text-code: #c10007;           /* red/700 */
    --text-link: #0092b8;           /* cyan/700 */
    --text-on-dark: #e6e9e6;        /* neutral/200 */

    --border-primary: #e6e9e6;      /* neutral/200 */
    --border-secondary: #d2d9d2;    /* neutral/300 */
    --border-input: #d2d9d2;        /* neutral/300 */
    --border-hover: #a3a9a2;        /* neutral/400 */

    --shadow-sm: rgba(0, 0, 0, 0.08);
    --shadow-md: rgba(0, 0, 0, 0.12);
    --shadow-lg: rgba(0, 0, 0, 0.16);

    /* Status colors - Lemonade */
    --color-success: #00c850;       /* green/500 */
    --color-error: #fa2b36;         /* red/500 */
    --color-warning: #fdc700;       /* amber/400 */
    --color-info: #155cfb;          /* blue/600 */

    /* Legacy aliases */
    --teya-black: #000000;
    --teya-white: #ffffff;
    --teya-gray-light: var(--bg-secondary);
    --teya-gray: #707970;           /* neutral/500 */
    --teya-gray-dark: #414a3f;      /* neutral/700 */
}

[data-theme="dark"] {
    --bg-page: #0d1117;
    --bg-primary: #0d1117;           /* deep navy-black */
    --bg-secondary: #161b22;        /* elevated surface */
    --bg-tertiary: #21262d;         /* tertiary surface */
    --bg-sidebar: #0d1117;
    --bg-code: #0d1117;
    --bg-code-header: #161b22;
    --bg-input: #21262d;
    --bg-hover: #21262d;
    --bg-card: #161b22;
    --bg-overlay: rgba(0, 0, 0, 0.7);
    --bg-callout-info: rgba(0, 146, 184, 0.12);
    --bg-callout-warn: rgba(253, 199, 0, 0.08);
    --bg-admonition: rgba(253, 199, 0, 0.06);

    --text-primary: #e6edf3;        /* high contrast */
    --text-secondary: #8b949e;      /* muted */
    --text-tertiary: #c9d1d9;       /* medium */
    --text-muted: #6e7681;          /* subtle */
    --text-nav: #c9d1d9;
    --text-heading: #f0f6fc;        /* bright */
    --text-code: #ff7b72;           /* soft red */
    --text-link: #58c4dc;           /* soft sky blue */
    --text-on-dark: #e6edf3;

    --border-primary: #21262d;
    --border-secondary: #30363d;
    --border-input: #30363d;
    --border-hover: #484f58;

    --shadow-sm: rgba(0, 0, 0, 0.4);
    --shadow-md: rgba(0, 0, 0, 0.5);
    --shadow-lg: rgba(0, 0, 0, 0.6);

    --teya-black: #f0f6fc;
    --teya-gray-light: var(--bg-secondary);
    --teya-gray: #8b949e;
    --teya-gray-dark: #c9d1d9;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-page);
    padding-top: 64px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Layout */
.main-layout {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Navigation */
.navbar {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-primary);
    box-shadow: 0 1px 3px var(--shadow-sm);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease-in-out;
}

.navbar.scrolled {
    box-shadow: 0 1px 5px var(--shadow-md);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 72px;
    transition: height 0.3s ease-in-out;
}

.navbar.scrolled .nav-container {
    height: 56px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 20px;
    color: var(--text-primary);
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

/* Square icon cropped from the left of the full logo image */
.brand-mark {
    width: 40px;
    height: 40px;
    overflow: hidden;
    flex-shrink: 0;
}

.brand-mark img {
    display: block;
    width: 40px;
    height: 40px;
    object-fit: cover;
    object-position: left center;
}

.brand-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
}

/* Wordmark cropped from the right of the full logo image */
.brand-word {
    position: relative;
    width: 54px;
    height: 26px;
    overflow: hidden;
}

.brand-word img {
    position: absolute;
    width: 100px;
    height: auto;
    max-width: none;
    left: -46px;
    top: -7px;
}

.brand-subtitle {
    width: 54px;
    font-size: 10px;
    font-weight: 600;
    /* spread the word to exactly the wordmark's width */
    letter-spacing: 0.95px;
    margin-right: -0.95px;
    line-height: 1;
    color: var(--text-secondary);
    white-space: nowrap;
}

[data-theme="dark"] .brand-lockup img {
    opacity: 1;
}

.logo {
    height: 38px;
    width: auto;
    object-fit: contain;
    transition: height 0.3s ease-in-out;
}

.navbar.scrolled .logo {
    height: 30px;
}

.nav-center {
    display: flex;
    align-items: center;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    background: transparent;
    padding: 0;
    border-radius: 0;
    border: none;
    transition: all 0.3s ease-in-out;
}

.navbar.scrolled .nav-links {
    gap: 2px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-nav);
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
    padding: 8px 12px;
    border-radius: 6px;
    position: relative;
    white-space: nowrap;
}

.navbar.scrolled .nav-links a {
    font-size: 14px;
    padding: 6px 14px;
}

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

.nav-links a.active {
    color: #333 !important;
    background: var(--teya-lime) !important;
    font-weight: 600;
}

/* Top nav dropdown (Partners) */
.nav-dropdown {
    position: relative;
    display: flex;
    align-items: center;
}

.nav-dropdown-toggle i {
    margin-left: 6px;
    font-size: 10px;
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 320px;
    background: var(--bg-primary);
    border: 1px solid var(--border-secondary);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    padding: 8px;
    z-index: 1000;
}

/* Non-clickable group labels inside dropdown menus */
.nav-dropdown-label {
    padding: 10px 12px 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    cursor: default;
}

.nav-dropdown-label + .nav-dropdown-label,
a + .nav-dropdown-label {
    margin-top: 6px;
    padding-top: 12px;
    border-top: 1px solid var(--border-primary);
}

.nav-dropdown:hover .nav-dropdown-menu {
    display: block;
}

.nav-dropdown-menu a {
    display: block;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 14px;
    white-space: normal;
}

@media (max-width: 768px) {
    .nav-dropdown-menu {
        display: none !important;
    }
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Login dropdown sits at the far right of the nav - anchor its menu to the
   right edge of the toggle instead of the left, so it doesn't overflow
   off-screen the way the left-aligned menus (Partners, Businesses...) do. */
.nav-login-dropdown .nav-dropdown-menu {
    left: auto;
    right: 0;
    min-width: 160px;
}

/* Log in button (matches the Teya Business Portal primary button). It's a
   <button>, not a link - it only opens the Production/Staging menu below,
   it doesn't navigate anywhere itself. */
.nav-login-btn {
    display: inline-flex;
    align-items: center;
    background: var(--teya-lime);
    color: #1a1e19;
    padding: 8px 18px;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s ease;
}

.nav-login-btn:hover {
    background: #cdd117;
    color: #1a1e19;
}

[data-theme="dark"] .nav-login-btn {
    background: var(--teya-lime);
    color: #1a1e19;
}

[data-theme="dark"] .nav-login-btn:hover {
    background: #cdd117;
    color: #1a1e19;
}

/* Production/Staging options inside the Log in menu - sit outside
   .nav-links, so they need their own color/hover treatment to match the
   rest of the nav dropdowns. */
.nav-login-menu a {
    color: var(--text-nav);
    font-weight: 500;
    text-decoration: none;
}

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

/* Inline code styles */
.inline-code {
    background: #f7fafc;
    color: var(--text-code);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', 'Monaco', 'Menlo', monospace;
    font-size: 13px;
    border: 1px solid #e2e8f0;
}

/* Design OAuth Flow Link Styling */
.design-oauth-link {
    background: transparent !important;
    color: var(--teya-gray) !important;
    font-weight: 500 !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 12px 20px !important;
    box-shadow: none !important;
    border: none !important;
    border-left: 3px solid transparent !important;
    transition: all 0.2s ease !important;
}

.design-oauth-link:hover {
    background: var(--teya-gray-light) !important;
    color: var(--teya-black) !important;
    border-left-color: var(--teya-lime) !important;
    transform: none !important;
    box-shadow: none !important;
}

.design-oauth-link.active {
    background: var(--teya-lime) !important;
    color: var(--teya-black) !important;
    border-left-color: var(--teya-lime) !important;
    font-weight: 600 !important;
}

.design-oauth-link i {
    color: inherit !important;
    font-size: 14px !important;
}

.design-oauth-link.active i {
    color: var(--teya-black) !important;
}

/* Callout Styles */
.callout {
    padding: 20px;
    border-radius: 12px;
    margin: 24px 0;
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.callout.info {
    background: rgba(0, 139, 185, 0.1);
    border: 1px solid rgba(0, 139, 185, 0.2);
    color: var(--teya-black);
}

.callout i {
    color: var(--teya-blue);
    font-size: 20px;
    margin-top: 2px;
}

/* Code Tabs */
.code-tabs {
    margin: 24px 0;
}

.tab-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-primary);
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    font-weight: 500;
    color: var(--teya-gray);
    transition: all 0.2s;
}

.tab-btn:hover {
    background: var(--teya-gray-light);
    color: var(--teya-black);
}

.tab-btn.active {
    background: var(--teya-lime);
    color: var(--teya-black);
    font-weight: 600;
}

.tab-content {
    position: relative;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Static HTML remains navigable and readable when JavaScript is unavailable. */
.no-js-label {
    display: none;
}

.no-js .no-js-label {
    display: block;
    font-weight: 600;
}

.no-js #content {
    min-width: 0;
    max-width: 1200px;
    margin: 0 auto;
}

.no-js #sidebar {
    flex-shrink: 0;
}

.no-js #sidebar .nav-children,
.no-js #sidebar .nav-grandchildren,
.no-js #sidebar-nav-container,
.no-js #content .tab-content,
.no-js #content .tab-pane,
.no-js #content [data-doc-when] {
    display: block !important;
}

.no-js #sidebar-nav-container {
    max-height: 50vh;
    overflow-y: auto;
}

.no-js #sidebar .desktop-header {
    display: block !important;
}

.no-js .sidebar-toggle,
.no-js #sidebar-collapse-btn,
.no-js #content .tab-buttons,
.no-js #content .doc-switcher {
    display: none !important;
}

.no-js #qs-quickstart-root .playground-selectors,
.no-js #qs-quickstart-root .qs-actions,
.no-js #qs-quickstart-root .qs-panel-tabs,
.no-js #qs-quickstart-root #qs-progress {
    display: none !important;
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    margin: 24px 0;
}

/* Ensure all table headers are left-aligned */
table th,
table thead th {
    text-align: left !important;
}

.error-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-primary);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.error-table th {
    background: var(--teya-gray-light);
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: var(--teya-black);
    border-bottom: 1px solid var(--border-primary);
}

.error-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-primary);
    color: var(--teya-gray);
}

.error-table tr:last-child td {
    border-bottom: none;
}

.error-table code {
    background: var(--teya-gray-light);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    color: var(--teya-black);
}

/* Table of Contents */
.toc-sidebar {
    width: 100%;
    margin: 0;
    background: var(--bg-sidebar);
    border-top: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    position: sticky; /* Make TOC sticky so it stays visible when scrolling */
    top: 0; /* Stick to the top of the sidebar-nav-container */
    z-index: 10;
    flex-shrink: 0; /* Don't shrink - stays fixed at top */
    order: -1; /* Ensure TOC appears first in flex container */
    margin-top: 0;
    /* Cap the TOC to ~half the sticky column so a long "On this page" list
       (e.g. OpenAPI reference pages) can't starve the nav below it. The TOC
       scrolls internally when its content exceeds this height. */
    max-height: 45vh;
    overflow-y: auto; /* TOC content can scroll if too long */
    overflow-x: hidden;
}

.toc-sidebar.visible {
    opacity: 1;
    display: block;
}

.toc-header {
    padding: 12px 20px 8px;
    border-bottom: 1px solid #e0e0e0;
    background: var(--bg-sidebar);
    position: sticky;
    top: 0;
    z-index: 11;
}

.toc-header h3 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.toc-nav {
    padding: 8px 0;
    overflow-y: visible;
    max-height: none;
    /* Allow TOC nav to scroll within the sticky container */
}

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

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

.toc-list li {
    margin: 0;
}

.toc-link {
    display: block;
    padding: 6px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    line-height: 1.4;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
    position: relative;
}

.toc-link:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
    border-left-color: var(--teya-lime);
}

.toc-link.active {
    color: var(--text-primary);
    background: var(--bg-hover);
    border-left-color: var(--teya-lime);
    font-weight: 500;
}

.toc-link.toc-level-1 {
    font-weight: 500;
    font-size: 13px;
    color: var(--text-primary);
}

.toc-link.toc-level-2 {
    font-size: 12px;
    padding-left: 28px;
}

.toc-link.toc-level-3 {
    font-size: 12px;
    padding-left: 36px;
    color: var(--text-secondary);
}

.toc-link.toc-level-4,
.toc-link.toc-level-5,
.toc-link.toc-level-6 {
    font-size: 11px;
    padding-left: 44px;
    color: var(--text-secondary);
}

/* Responsive behavior for TOC */
@media (max-width: 768px) {
    .toc-sidebar {
        position: sticky;
        top: 0;
        max-height: calc(100vh - 60px);
    }

    .toc-nav {
        overflow-y: visible;
    }
}

/* Site-wide typography treatment (applied via router.js; skipped on the
   home page and integration-guide pages). Overrides the renderer's uniform
   inline heading styles to give pages a clearer rhythm: bigger title + lede,
   bordered section headings, tighter sub-headings, and a readable text
   measure. Text elements are capped for readability; tables and code blocks
   keep the full column width. */
/* Centered page column with an "On this page" rail to its right.
   toc.js wraps every sectioned page's content in this structure. */
.page-columns {
    display: flex;
    justify-content: center;
    gap: 48px;
}

/* OpenAPI endpoint reference pages skip the centered reading column */
.page-columns.openapi-full-width .page-body {
    max-width: none;
}

/* Two-column endpoint layout: docs and schemas on the left,
   request/response examples in a sticky code column on the right */
.endpoint-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 28px;
    align-items: start;
}

.endpoint-docs-col {
    min-width: 0;
}

.endpoint-code-col {
    min-width: 0;
    position: sticky;
    top: 90px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    padding-top: 15px;
}

.code-pane {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-secondary);
    flex-shrink: 0;
}

/* Parameter lists (endpoint reference pages) */
.param-section-title {
    margin: 24px 0 4px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-secondary);
    padding-bottom: 8px;
}

.param-schema-name {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
    color: var(--text-muted);
    margin-left: 6px;
}

.param-list {
    margin: 0 0 20px;
}

.param-row {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-primary);
}

.param-row:last-child {
    border-bottom: none;
}

.param-children .param-row:first-child {
    padding-top: 8px;
}

.param-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.param-name {
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}

.param-type {
    font-size: 12px;
    color: var(--text-muted);
}

.param-flag {
    font-size: 11px;
    font-weight: 600;
    color: #d97706;
}

.param-desc {
    margin-top: 4px;
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--text-secondary);
    max-width: 640px;
}

.param-enum {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.7;
}

.param-enum span {
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    background: var(--bg-tertiary);
    border-radius: 4px;
    padding: 1px 5px;
    margin-right: 2px;
    white-space: nowrap;
}

/* Child attributes block, inset under the parent parameter */
.param-children {
    margin-top: 10px;
    padding-left: 16px;
    border-left: 1px solid var(--border-secondary);
}

/* Compact status code summary in the Errors section */
.error-status-list {
    padding-top: 4px;
}

.error-status-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 4px 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.error-status-chip {
    flex-shrink: 0;
    min-width: 34px;
    text-align: center;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

/* Each status opens to show its example responses */
.error-status-item {
    max-width: 760px;
}

.error-status-item > summary {
    cursor: pointer;
    list-style: none;
}

.error-status-item > summary::-webkit-details-marker {
    display: none;
}

/* Chevron: points right when closed, down when open */
.error-status-item > summary::before {
    content: "";
    flex-shrink: 0;
    align-self: center;
    width: 5px;
    height: 5px;
    margin: 0 3px 0 1px;
    border-right: 1.5px solid var(--text-secondary);
    border-bottom: 1.5px solid var(--text-secondary);
    transform: rotate(-45deg);
    transition: transform 0.15s;
}

.error-status-item[open] > summary::before {
    transform: rotate(45deg);
}

/* A status with no example keeps its chip aligned with the ones that open */
.error-status-list:has(> .error-status-item) > .error-status-row::before {
    content: "";
    flex-shrink: 0;
    width: 5px;
    margin: 0 3px 0 1px;
    border-right: 1.5px solid transparent;
}

.error-status-example {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 16px 20px;
    margin: 6px 0 12px 20px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.4;
    overflow-x: auto;
}

.code-pane-header {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    background: #1f1f1f;
    color: #c9d1d9;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-bottom: 1px solid #333;
}

@media (max-width: 1100px) {
    .endpoint-columns {
        grid-template-columns: 1fr;
    }

    .endpoint-code-col {
        position: static;
        max-height: none;
        overflow: visible;
        padding-top: 0;
    }
}

.page-columns.openapi-full-width .page-body h1,
.page-columns.openapi-full-width .page-body h2,
.page-columns.openapi-full-width .page-body h3,
.page-columns.openapi-full-width .page-body h4,
.page-columns.openapi-full-width .page-body p,
.page-columns.openapi-full-width .page-body ul,
.page-columns.openapi-full-width .page-body ol {
    max-width: none;
}

.page-body {
    flex: 1;
    min-width: 0;
    max-width: 840px;
    position: relative;
}

.page-toc {
    width: 220px;
    flex-shrink: 0;
    position: sticky;
    top: 96px;
    align-self: flex-start;
    max-height: calc(100vh - 130px);
    overflow-y: auto;
    padding-left: 4px;
    border-left: 1px solid var(--border-primary);
}

.page-toc-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    padding: 2px 12px 8px;
}

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

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

.page-toc .toc-link {
    display: block;
    padding: 4px 12px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-secondary);
    text-decoration: none;
    border-left: 2px solid transparent;
    margin-left: -1px;
}

.page-toc .toc-link.toc-level-2 {
    padding-left: 24px;
}

.page-toc .toc-link:hover {
    color: var(--text-primary);
    background: transparent;
    border-left-color: var(--border-hover);
}

.page-toc .toc-link.active {
    color: var(--text-primary);
    background: transparent;
    font-weight: 600;
    border-left-color: var(--teya-lime);
}

@media (max-width: 1180px) {
    .page-toc {
        display: none;
    }
}

.prose-v2 h1,
.prose-v2 h2,
.prose-v2 h3,
.prose-v2 h4,
.prose-v2 p,
.prose-v2 ul,
.prose-v2 ol {
    max-width: 760px;
}

.prose-v2 h1 {
    font-family: var(--font-display) !important;
    font-size: 36px !important;
    font-weight: 800 !important;
    letter-spacing: -0.01em;
    line-height: 1.2;
    margin-bottom: 12px !important;
}

.prose-v2 h1 + p {
    font-size: 18px !important;
    color: var(--text-secondary) !important;
    margin-bottom: 32px !important;
}

.prose-v2 h2 {
    font-family: var(--font-display) !important;
    font-size: 24px !important;
    font-weight: 800 !important;
    letter-spacing: 0;
    margin: 48px 0 14px !important;
    padding-top: 28px;
    border-top: 1px solid var(--border-primary);
}

.prose-v2 h3:not(.endpoint-header) {
    font-size: 17px !important;
    font-weight: 600 !important;
    margin: 28px 0 10px !important;
}

.prose-v2 p,
.prose-v2 li {
    line-height: 1.7 !important;
}

.prose-v2 ul,
.prose-v2 ol {
    margin-bottom: 20px;
}

.prose-v2 img,
.prose-v2 iframe {
    border-radius: 10px;
    max-width: 100%;
}

/* Global FAQ / Glossary links at the bottom of every sidebar */
.sidebar-global-links {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-primary);
}

/* Heading anchor links */
#content h1,
#content h2,
#content h3,
#content h4,
#content h5,
#content h6 {
    scroll-margin-top: 90px;
}

/* Display serif for page and section headings (teya.com style).
   Deeper headings stay in Figtree for readability. */
#content h1,
#content h2 {
    font-family: var(--font-display);
}

/* Inline contents list, nested under the active page entry in the side nav */
.toc-inline {
    margin: 2px 0 6px 0;
    padding: 0;
}

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

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

.toc-inline .toc-link {
    display: block;
    padding: 4px 20px 4px var(--toc-indent, 48px);
    font-size: 12px;
    color: var(--text-secondary);
    border-left: 3px solid transparent;
}

.toc-inline .toc-link.toc-level-2 {
    padding-left: calc(var(--toc-indent, 48px) + 10px);
}

.toc-inline .toc-link.toc-level-3,
.toc-inline .toc-link.toc-level-4,
.toc-inline .toc-link.toc-level-5 {
    padding-left: calc(var(--toc-indent, 48px) + 20px);
}

/* Footer */
.footer {
    background: var(--teya-black);
    color: rgb(232, 232, 154);
    padding: 30px 0;
    border-top: 3px solid var(--teya-lime);
    margin-top: auto;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-links {
    display: flex;
    gap: 40px;
    align-items: center;
}

.footer-links a {
    color: rgb(232, 232, 154);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--teya-white);
}

.footer-copyright {
    color: rgb(232, 232, 154);
    font-size: 14px;
}

.footer-copyright p {
    margin: 0;
}

/* Page Layout with Sidebar */
.page-layout {
    display: flex;
    min-height: calc(100vh - 64px);
}

/* Sidebar Styles */
.sidebar {
    width: 280px;
    background: var(--bg-primary);
    border-right: 1px solid var(--border-primary);
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    overflow: hidden; /* Changed from overflow-y: auto to prevent sidebar scrolling */
    transition: background-color 0.3s;
    display: flex;
    flex-direction: column;
}

/* The actual aside#sidebar uses inline styles, so give it the same sticky,
   full-height, internally-scrolling behaviour as .sidebar. This keeps the
   left nav and the "On this page" TOC pinned in view while the main content
   scrolls, instead of scrolling away on long pages.
   (The max-width: 768px block below resets this to static for mobile.) */
#sidebar {
    position: sticky;
    top: 64px;
    align-self: flex-start;
    height: calc(100vh - 64px);
    overflow: hidden;
    flex-direction: column;
}

/* --- Sidebar collapse toggle --- */
.sidebar-collapse-btn {
    position: fixed;
    top: 78px;
    left: 280px;
    transform: translateX(-50%);
    z-index: 60;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border-primary);
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    display: none; /* revealed by sidebar.js only when a sidebar is present */
    align-items: center;
    justify-content: center;
    font-size: 12px;
    box-shadow: 0 1px 4px var(--shadow-sm);
    transition: left 0.2s ease, background-color 0.2s, color 0.2s;
}

.sidebar-collapse-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.sidebar-collapse-btn i {
    transition: transform 0.2s ease;
}

body.sidebar-collapsed .sidebar-collapse-btn {
    left: 0;
    transform: translateX(0);
}

body.sidebar-collapsed .sidebar-collapse-btn i {
    transform: rotate(180deg);
}

body.sidebar-collapsed #sidebar {
    width: 0 !important;
    min-width: 0 !important;
    padding: 0 !important;
    border-right: none !important;
    overflow: hidden !important;
}

body.sidebar-collapsed #content {
    max-width: none !important;
}

@media (max-width: 768px) {
    .sidebar-collapse-btn {
        display: none !important;
    }
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border-primary);
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.sidebar-header p {
    font-size: 14px;
    color: var(--teya-gray);
    margin: 0;
}

.sidebar-nav {
    padding: 16px 0;
    position: relative;
}

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

.nav-item {
    margin: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--teya-gray);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s;
    border-right: 3px solid transparent;
}

.nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-right-color: var(--teya-lime);
}

.nav-link.active {
    background: var(--teya-lime);
    color: #29320c;
    border-right-color: var(--teya-lime);
    font-weight: 600;
}

.nav-link i {
    width: 16px;
    text-align: center;
    font-size: 14px;
}

.nav-parent {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    cursor: pointer;
    color: var(--teya-gray);
    background: transparent;
    border-right: 3px solid transparent;
    font-weight: 500;
    font-size: 15px;
    transition: all 0.2s;
}

.nav-parent:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-right-color: var(--teya-lime);
}

.nav-parent.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-right-color: var(--teya-lime);
    font-weight: 500;
}

.nav-parent i {
    margin-right: 8px;
    width: 16px;
    text-align: center;
    font-size: 14px;
}

.nav-parent i:last-child {
    margin-left: auto;
    margin-right: 0;
    transition: transform 0.2s ease;
}

/* Sub Navigation */
.sub-nav {
    list-style: none;
    margin: 0;
    padding: 0;
    margin-left: 20px;
    margin-top: 8px;
    display: none;
}

.nav-item:hover .sub-nav,
.nav-item.active .sub-nav {
    display: block;
}

.sub-nav-item {
    margin: 0;
}

.sub-nav-link {
    display: block;
    padding: 10px 20px 10px 44px;
    text-decoration: none;
    color: var(--teya-gray);
    font-size: 14px;
    font-weight: 400;
    transition: all 0.2s;
    border-right: 2px solid transparent;
}

.sub-nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-right-color: var(--teya-lime);
}

.sub-nav-link.active {
    background: var(--teya-lime);
    color: #29320c;
    border-right-color: var(--teya-lime);
    font-weight: 600;
}

.sub-nav-link i {
    margin-right: 8px;
    width: 14px;
}

/* Sub-Sub Navigation (Third Level) */
.sub-sub-nav {
    list-style: none;
    margin: 0;
    padding: 0;
    margin-left: 20px;
    margin-top: 4px;
    display: none;
}

.sub-nav-item:hover .sub-sub-nav,
.sub-nav-item.active .sub-sub-nav {
    display: block;
}

.sub-sub-nav-item {
    margin: 0;
}

.sub-sub-nav-link {
    display: block;
    padding: 6px 60px;
    text-decoration: none;
    color: var(--teya-gray);
    font-size: 13px;
    transition: all 0.2s;
}

.sub-sub-nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sub-sub-nav-link.active {
    background: var(--teya-lime);
    color: #29320c;
    font-weight: 600;
}

/* Main Content */
.main-content {
    flex: 1;
    background: var(--bg-primary);
    transition: background-color 0.3s;
}

main {
    flex: 1;
}

.content-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 24px;
}

.content-section {
    margin-bottom: 60px;
}

.content-section h1 {
    font-size: 36px;
    font-weight: 700;
    color: var(--teya-black);
    margin-bottom: 16px;
}

.content-section h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--teya-black);
    margin-bottom: 16px;
    margin-top: 40px;
}

.section-intro {
    font-size: 18px;
    color: var(--teya-gray);
    line-height: 1.6;
    margin-bottom: 32px;
}

/* Code Block */
.code-block {
    background: #1e1e1e;
    border-radius: 8px;
    overflow: hidden;
    margin: 16px 0;
    border: 1px solid #333;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #2d2d2d;
    padding: 12px 16px;
    border-bottom: 1px solid #333;
}

.code-header span, .code-language {
    color: #d4d4d4;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.copy-code-btn, .copy-btn {
    background: none;
    border: none;
    color: #a0aec0;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    transition: all 0.2s ease;
}

.copy-code-btn:hover, .copy-btn:hover {
    background: #404040;
    color: var(--teya-lime);
}

.code-block pre {
    margin: 0;
    padding: 16px;
    overflow-x: auto;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.5;
}

.code-block code {
    color: #d4d4d4;
    background: none;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
    white-space: pre;
    display: block;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    border: none;
    font-size: 16px;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--teya-lime);
    color: #1a1e19;
    border: 2px solid var(--teya-lime);
}

.btn-primary:hover {
    background: #cdd117;
    color: #1a1e19;
    border-color: #cdd117;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.btn-secondary {
    background: var(--bg-primary);
    color: var(--teya-black);
    border: 2px solid var(--teya-black);
}

.btn-secondary:hover {
    background: var(--teya-blue);
    color: var(--teya-white);
    border-color: var(--teya-blue);
    transform: translateY(-2px);
}

/* Feature Card - Used in some pages */
.feature-card {
    background: var(--bg-primary);
    padding: 32px;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: all 0.3s;
    border: 1px solid var(--border-primary);
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.feature-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--teya-lime), var(--teya-blue));
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.feature-icon i {
    color: var(--teya-black);
    font-size: 20px;
}

.feature-card h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.feature-card p {
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.6;
}

/* Responsive Images */
img {
    max-width: 100%;
    height: auto;
    box-sizing: border-box;
}

/* Images in content areas */
.content-container img,
.content-section img,
.message-content img,
main img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 16px 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Badge images (like Maven badges) should maintain their aspect ratio */
img[src*="shield"], 
img[src*="badge"],
img[src*="img.shields.io"] {
    max-width: 200px !important;
    width: auto !important;
    height: auto !important;
    display: inline-block !important;
    margin: 4px !important;
    border-radius: 4px !important;
    box-shadow: none !important;
}

/* Mobile responsive */
@media (max-width: 768px) {
    /* Navigation */
    body {
        padding-top: 60px;
    }
    
    .nav-container {
        padding: 0 16px;
        height: 60px;
    }
    
    .logo {
        height: 28px !important;
    }
    
    .navbar.scrolled .logo {
        height: 24px !important;
    }
    
    /* Hide desktop navigation on mobile */
    .nav-center {
        display: none !important;
    }

    .mobile-nav-toggle {
        display: block !important;
        background: none !important;
        border: none !important;
        color: var(--text-nav) !important;
        font-size: 18px !important;
        padding: 8px !important;
        border-radius: 6px !important;
        cursor: pointer !important;
        transition: all 0.2s ease !important;
        margin-right: 12px !important;
    }
    
    /* Page layout mobile adjustments */
    .page-layout {
        flex-direction: column;
    }
    
    /* Force flex direction to column for main layout on mobile */
    div[style*="display: flex"][style*="flex: 1"] {
        flex-direction: column !important;
    }
    
    /* Sidebar mobile adjustments */
    .sidebar,
    aside[style*="width: 280px"],
    #sidebar {
        width: 100% !important;
        position: static !important;
        height: auto !important;
        border-right: none !important;
        border-bottom: 1px solid var(--border-primary) !important;
        max-height: 300px !important;
        overflow-y: auto !important;
        flex: none !important;
    }
    
    /* Make sidebar collapsible on mobile */
    .sidebar-header {
        cursor: pointer;
        user-select: none;
        position: relative;
    }
    
    .sidebar-header::after {
        content: '\f107';
        font-family: 'Font Awesome 6 Free';
        font-weight: 900;
        position: absolute;
        right: 20px;
        top: 50%;
        transform: translateY(-50%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.collapsed .sidebar-header::after {
        transform: translateY(-50%) rotate(-90deg);
    }
    
    .sidebar.collapsed .sidebar-nav {
        display: none;
    }
    
    /* Main content mobile adjustments */
    .content-container {
        padding: 24px 16px;
        max-width: 100%;
    }
    
    main[id="content"],
    main[style*="flex: 1"] {
        padding: 20px 16px !important;
        width: 100% !important;
        flex: none !important;
        max-width: none !important;
    }
    
    .content-section h1 {
        font-size: 28px;
    }
    
    .content-section h2 {
        font-size: 20px;
    }
    
    /* Tables mobile */
    .table-container {
        margin: 16px -16px;
        overflow-x: auto;
    }
    
    .error-table {
        font-size: 14px;
        border-radius: 0;
        min-width: 600px;
    }
    
    .error-table th,
    .error-table td {
        padding: 12px;
    }
    
    /* Code blocks mobile */
    .code-block {
        margin: 16px -16px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    pre {
        font-size: 12px !important;
        line-height: 1.3 !important;
        overflow-x: auto !important;
    }
    
    /* Better mobile typography */
    h1 { font-size: clamp(1.75rem, 5vw, 2.5rem); }
    h2 { font-size: clamp(1.5rem, 4vw, 2rem); }
    h3 { font-size: clamp(1.25rem, 3.5vw, 1.75rem); }
    h4 { font-size: clamp(1.1rem, 3vw, 1.5rem); }
    
    /* Prevent horizontal scroll */
    body, html {
        overflow-x: hidden;
    }
    
    /* Footer mobile */
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }
    
    .footer-links {
        gap: 20px;
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Mobile navigation toggle - hidden by default on desktop */
.mobile-nav-toggle {
    display: none;
}

.mobile-nav-toggle:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* Mobile menu overlay */
.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-nav-menu {
    position: fixed;
    top: 80px;
    right: -100%;
    width: 280px;
    height: calc(100vh - 80px);
    background: var(--bg-primary);
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 10000;
    overflow-y: auto;
    padding: 20px;
}

.mobile-nav-menu.active {
    right: 0;
}

.mobile-nav-links {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mobile-nav-links a {
    color: var(--teya-gray-dark);
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: color 0.2s ease;
}

.mobile-nav-links a:hover {
    color: var(--teya-blue);
}

.mobile-nav-links a:last-child {
    border-bottom: none;
}

.mobile-nav-links i {
    width: 20px;
    text-align: center;
    color: var(--teya-lime);
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Touch-friendly buttons on mobile */
@media (hover: none) and (pointer: coarse) {
    button, a, .nav-link, .feature-card {
        min-height: 44px;
        min-width: 44px;
    }
    
    .nav-links a {
        padding: 8px 12px;
    }
    
    .btn {
        padding: 14px 28px;
        font-size: 16px;
    }
}

/* Tablet responsive adjustments */
@media (max-width: 1024px) and (min-width: 769px) {
    .nav-links {
        gap: 2px;
    }
    
    .content-container {
        padding: 32px 20px;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .nav-container {
        padding: 0 12px;
    }
    
    .logo {
        height: 24px !important;
    }
    
    .navbar.scrolled .logo {
        height: 20px !important;
    }
    
    .content-container {
        padding: 20px 12px;
    }
    
    .content-section h1 {
        font-size: 24px;
    }
    
    .content-section h2 {
        font-size: 18px;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 12px;
    }
}

/* Modern Responsive Sidebar */
.sidebar-toggle {
    display: none;
    align-items: center;
    gap: 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-primary);
    width: 100%;
    text-align: left;
    transition: all 0.2s ease;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.sidebar-toggle:hover {
    background: var(--bg-sidebar);
}

.sidebar-toggle .hamburger-icon {
    font-size: 18px;
    color: var(--text-secondary);
}

.sidebar-toggle .section-title {
    flex: 1;
}

.sidebar-toggle .chevron-icon {
    font-size: 14px;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
}

.sidebar-toggle.expanded .chevron-icon {
    transform: rotate(90deg);
}

.sidebar-nav-container {
    transition: all 0.3s ease;
    flex: 1;
    overflow: hidden; /* Container doesn't scroll - nav scrolls instead */
    display: flex;
    flex-direction: column;
    min-height: 0; /* Ensure proper flex behavior */
    align-items: stretch; /* Ensure full width for children */
}

/* Make the nav element scroll independently, not the container */
.sidebar-nav-container > nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0; /* Important for flex scrolling to work */
}

.sidebar-nav-container.collapsed {
    max-height: 0;
    overflow: hidden;
}

.sidebar-nav-container.expanded {
    max-height: none; /* Remove max-height to allow flex to work */
    overflow: hidden; /* Container doesn't scroll, nav does */
}

.sidebar-nav-container.expanded > nav {
    overflow-y: auto; /* Nav scrolls when expanded */
    min-height: 0; /* Important for flex scrolling */
}

.desktop-header {
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

/* Mobile-first responsive sidebar */
@media (max-width: 768px) {
    .sidebar-toggle {
        display: flex !important;
    }
    
    /* Hide desktop header on mobile */
    .desktop-header {
        display: none !important;
    }
    
    /* Ensure the sidebar navigation is collapsible */
    .sidebar-nav-container {
        background: var(--bg-primary);
        border-top: 1px solid var(--border-primary);
    }
    
    /* Style the header section differently on mobile */
    #sidebar > div:first-child {
        display: none !important;
    }
    
    /* Navigation links mobile adjustments */
    #sidebar .nav-link,
    #sidebar .sub-nav-link,
    #sidebar .sub-sub-nav-link {
        padding: 14px 20px !important;
        font-size: 15px !important;
        border-bottom: 1px solid var(--border-primary) !important;
        background: var(--bg-primary) !important;
        display: flex !important;
        align-items: center !important;
        min-height: 48px !important;
    }
    
    #sidebar .nav-link:hover,
    #sidebar .sub-nav-link:hover,
    #sidebar .sub-sub-nav-link:hover {
        background: var(--bg-sidebar) !important;
    }
    
    #sidebar .nav-link.active,
    #sidebar .sub-nav-link.active,
    #sidebar .sub-sub-nav-link.active {
        background: var(--teya-lime) !important;
        color: #29320c !important;
        border-left: 3px solid #29320c !important;
    }

    /* Section parent items on mobile */
    .nav-parent {
        padding: 14px 20px !important;
        background: var(--bg-primary) !important;
        border-bottom: 1px solid var(--border-primary) !important;
        min-height: 48px !important;
    }
    
    .nav-parent:hover {
        background: var(--bg-sidebar) !important;
    }
    
    /* Child navigation sections */
    .nav-children {
        background: var(--bg-sidebar) !important;
    }
    
    .nav-children .sub-nav-link {
        background: var(--bg-sidebar) !important;
        padding-left: 40px !important;
    }
    
    .nav-children .sub-nav-link:hover {
        background: var(--border-primary) !important;
    }
    
    /* Grandchildren navigation */
    .nav-grandchildren .sub-sub-nav-link {
        background: var(--border-primary) !important;
        padding-left: 60px !important;
        font-size: 14px !important;
    }
    
    .nav-grandchildren .sub-sub-nav-link:hover {
        background: var(--bg-hover) !important;
    }
    
    /* Main layout container fixes */
    .main-layout {
        display: flex !important;
        flex-direction: column !important;
    }
    
    .main-layout > div[style*="display: flex"] {
        flex-direction: column !important;
    }
}

/* Only used in specific pages */
.desktop-two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    margin: 32px 0;
}

@media (max-width: 768px) {
    .desktop-two-column {
        grid-template-columns: 1fr !important;
        gap: 24px !important;
    }
}

/* Feature grid - used in apis/overview.html */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 32px;
}

@media (max-width: 768px) {
    .feature-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* Endpoint Code Panel - two-column layout */
.endpoint-section-container {
    margin: 40px 0;
    align-items: start;
}

.endpoint-docs-column {
    min-width: 0; /* Allow column to shrink */
}

.endpoint-code-column {
    position: sticky;
    top: 80px;
    align-self: start;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.endpoint-code-panel {
    background: var(--bg-primary);
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 24px;
}

.code-panel-header {
    margin-bottom: 12px;
}

.code-panel-header h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.code-panel-content {
    margin-bottom: 20px;
}

.code-panel-content pre {
    background: #2d2d2d;
    border-radius: 6px;
    padding: 16px;
    margin: 0;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.5;
}

.code-panel-content code {
    color: #f8f8f2;
    font-family: 'Courier New', 'Monaco', 'Menlo', monospace;
}

/* Make tables in endpoint docs column fit better */
.endpoint-docs-column table {
    max-width: 100%;
    font-size: 13px;
}

/* Responsive: Stack columns on smaller screens */
@media (max-width: 1024px) {
    .endpoint-section-container {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    .endpoint-code-column {
        position: static;
        max-height: none;
        overflow-y: visible;
    }
    
    .endpoint-code-panel {
        margin-top: 24px;
    }
}

/* --- Copy as Markdown Button --- */

.copy-page-md-btn {
    position: absolute;
    top: 12px;
    right: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    font-size: 12.5px;
    font-family: 'Figtree', sans-serif;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    z-index: 10;
    white-space: nowrap;
}

.copy-page-md-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.copy-page-md-btn.copied {
    background: #f0fdf4;
    border-color: #86efac;
    color: #16a34a;
}

[data-theme="dark"] .copy-page-md-btn {
    background: #161b22;
    border-color: #30363d;
    color: #8b949e;
}

[data-theme="dark"] .copy-page-md-btn:hover {
    background: #21262d;
    color: #c9d1d9;
}

.copy-page-md-btn i {
    font-size: 12px;
}

#content {
    position: relative;
}

@media (max-width: 768px) {
    .copy-page-md-btn {
        position: static;
        margin-bottom: 16px;
    }
}

/* --- Theme Toggle Button --- */

.theme-toggle-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    padding: 0;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 15px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle-btn:hover {
    background: var(--bg-hover);
    color: var(--teya-lime);
    border-color: var(--teya-lime);
}

[data-theme="dark"] .theme-toggle-btn {
    background: var(--bg-tertiary);
    color: #f5c542;
    border-color: rgba(245, 197, 66, 0.3);
}

[data-theme="dark"] .theme-toggle-btn:hover {
    background: rgba(245, 197, 66, 0.1);
    color: #fad565;
    border-color: rgba(245, 197, 66, 0.5);
}

/* --- Card Name Pill --- */
.card-name-pill {
    background: var(--teya-blue);
    color: #fff;
}

[data-theme="dark"] .card-name-pill {
    background: #E0E722;
    color: #333 !important;
}

/* --- Dark Mode Overrides --- */

[data-theme="dark"] body {
    color-scheme: dark;
}

[data-theme="dark"] .navbar {
    border-bottom-color: var(--border-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}


[data-theme="dark"] .footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-primary);
}

[data-theme="dark"] .footer-links a,
[data-theme="dark"] .footer-copyright p {
    color: var(--text-secondary);
}

[data-theme="dark"] .inline-code {
    background: var(--bg-tertiary);
    border-color: var(--border-primary);
}

[data-theme="dark"] .toc-link:hover,
[data-theme="dark"] .toc-link.active {
    background: var(--bg-tertiary);
}

[data-theme="dark"] #sidebar .nav-link.active,
[data-theme="dark"] #sidebar .sub-nav-link.active,
[data-theme="dark"] #sidebar .sub-sub-nav-link.active {
    background: var(--teya-lime) !important;
    color: #29320c !important;
}

[data-theme="dark"] .copy-page-md-btn.copied {
    background: rgba(22, 163, 106, 0.15);
    border-color: rgba(134, 239, 172, 0.3);
    color: #86efac;
}

[data-theme="dark"] .ig-nav-card:hover {
    border-color: var(--teya-lime);
    box-shadow: 0 4px 12px rgba(224, 231, 34, 0.15);
}

/* Informational cards are not links — keep them inert on hover. */
[data-theme="dark"] .ig-nav-card--static:hover {
    border-color: var(--border-primary);
    box-shadow: none;
}

[data-theme="dark"] .ig-badge-recommended {
    background: rgba(0, 139, 185, 0.15);
    color: var(--text-link);
}

[data-theme="dark"] .ig-section-icon {
    background: var(--bg-tertiary) !important;
}

[data-theme="dark"] .ig-nav-card-icon {
    opacity: 0.85;
}

[data-theme="dark"] img:not(.logo) {
    opacity: 0.9;
}

.logo-dark {
    display: none;
}

[data-theme="dark"] .logo-light {
    display: none;
}

[data-theme="dark"] .logo-dark {
    display: block;
}

[data-theme="dark"] a {
    color: var(--text-link);
}

[data-theme="dark"] .nav-links a {
    color: var(--text-nav);
}

/* Match the Pay at Table nested subsection to leaf link color so the
   subgroup header doesn't look dimmer than its siblings. Attribute
   selector catches the PAT subgroup on every platform (android, ios,
   windows) without affecting the platform headers themselves. */
.nav-child:has(> [id$="-pay-at-table-chevron"]) {
    color: var(--teya-gray) !important;
}
[data-theme="dark"] .nav-child:has(> [id$="-pay-at-table-chevron"]) {
    color: var(--text-link) !important;
}

[data-theme="dark"] .endpoint-code-panel {
    border-color: var(--border-primary);
}

[data-theme="dark"] .toc-sidebar {
    border-color: var(--border-primary);
}

[data-theme="dark"] .toc-header {
    border-color: var(--border-primary);
    background: var(--bg-sidebar);
}

/* ===== Search Modal ===== */

.search-trigger-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 13px;
    transition: all 0.2s;
    height: 32px;
}

.search-trigger-btn:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
    background: var(--bg-hover);
}

.search-trigger-btn i {
    font-size: 12px;
}

.search-trigger-label {
    font-weight: 400;
}

.search-trigger-kbd {
    font-size: 10px;
    padding: 1px 5px;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 3px;
    color: var(--text-muted);
    font-family: inherit;
    line-height: 1.4;
}

.search-overlay {
    position: fixed;
    inset: 0;
    z-index: 10001;
    background: var(--bg-overlay);
    display: flex;
    justify-content: center;
    padding-top: 12vh;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s, visibility 0.15s;
}

.search-overlay.active {
    opacity: 1;
    visibility: visible;
}

.search-modal-container {
    width: 100%;
    max-width: 620px;
    max-height: 70vh;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    box-shadow: 0 16px 48px var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(-8px) scale(0.98);
    transition: transform 0.15s;
    height: fit-content;
}

.search-overlay.active .search-modal-container {
    transform: translateY(0) scale(1);
}

.search-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-primary);
    gap: 10px;
}

.search-input-icon {
    color: var(--text-muted);
    font-size: 14px;
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 15px;
    color: var(--text-primary);
    font-family: inherit;
}

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

.search-header .search-kbd {
    font-size: 10px;
    padding: 2px 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    color: var(--text-muted);
    font-family: inherit;
    flex-shrink: 0;
}

.search-results {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    min-height: 60px;
    max-height: 50vh;
}

.search-empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted);
    font-size: 14px;
}

.search-result-item {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: background 0.1s;
}

.search-result-item:hover,
.search-result-item.selected {
    background: var(--bg-tertiary);
}

.search-result-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.search-result-title i {
    color: var(--text-link);
    font-size: 12px;
    width: 14px;
    flex-shrink: 0;
}

.search-result-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    padding: 2px 0 2px 22px;
}

.search-result-heading i {
    font-size: 9px;
    color: var(--text-muted);
    width: 14px;
    flex-shrink: 0;
}

.search-result-desc {
    font-size: 12px;
    color: var(--text-muted);
    padding: 2px 0 0 22px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 16px;
    border-top: 1px solid var(--border-primary);
    font-size: 11px;
    color: var(--text-muted);
}

.search-shortcut {
    display: flex;
    align-items: center;
    gap: 4px;
}

.search-shortcut kbd {
    font-size: 10px;
    padding: 1px 4px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 3px;
    font-family: inherit;
    min-width: 16px;
    text-align: center;
}

@media (max-width: 768px) {
    .search-trigger-label,
    .search-trigger-kbd {
        display: none;
    }

    .search-trigger-btn {
        padding: 5px 8px;
    }

    .search-modal-container {
        max-width: 100%;
        border-radius: 0;
        max-height: 100vh;
    }

    .search-overlay {
        padding-top: 0;
    }

    .search-footer {
        display: none;
    }
}

/* Custom brand icons (no Font Awesome glyph available).
   Rendered as a mask so they inherit color and size like <i class="fas ..."> icons. */
.icon-unas {
    display: inline-block;
    position: relative;
    width: 1.25em;
    height: 1em;
    vertical-align: -0.125em;
}

.icon-unas::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1.9em;
    height: 0.55em;
    transform: translate(-50%, -50%);
    background-color: currentColor;
    -webkit-mask: url('/https/docs.teya.com/images/plugins/unas.svg') center / contain no-repeat;
    mask: url('/https/docs.teya.com/images/plugins/unas.svg') center / contain no-repeat;
}

.nav-subsection .icon-unas::before {
    width: 1.6em;
}
