/* KB Article Page Styles - Agent.ai Documentation Style */

/* Reset and Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --kb-page-bg: #09090b;
    --kb-surface-bg: #151519;
}

html:has(body.kb-article-page),
html:has(body.kb-article-page) body {
    background-color: #09090b !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif !important;
}

html:has(body.kb-article-page) *:not(code):not(pre):not(kbd):not(samp) {
    font-family: inherit !important;
}

.kb-article-page {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #e4e4e7;
    background: #09090b !important;
}
.kb-article-page a:hover {
    text-decoration: none;
}
.kb-related-faqs a {
    display: flex;
    align-items: center;
    border: 1px solid #3f3f46;
    padding: 6px 12px;
    border-radius: 4px;
    transition: background 0.2s, border-color 0.2s;
}
/* Top Bar */
.kb-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(10px); 
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #27272a;
}

/* Account for WordPress admin bar when logged in */
.admin-bar .kb-topbar {
    top: 32px;
}

@media screen and (max-width: 782px) {
    .admin-bar .kb-topbar {
        top: 46px;
    }
}

.kb-topbar-inner {
    max-width: 1560px;
    width: 100%;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kb-topbar-title-section {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.kb-logo {
    height: 40px;
    width: 40px; /* default, overridden by inline style when logo_width is set */
    max-width: none;
    object-fit: contain;
    flex-shrink: 0;
}

.kb-topbar-text-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.kb-topbar-title {
    font-size: 24px;
    line-height: 28px;
    font-weight: 400;
    color: #ffffff;
    white-space: nowrap;
}

.kb-topbar-updated {
    font-size: 12px;
    font-weight: 400;
    color: #a1a1aa;
    white-space: nowrap;
}

/* Main Wrapper */
.kb-wrapper {
    display: flex;
    min-height: 100vh;
    position: relative;
    justify-content: center;
    max-width: 1920px;
    margin-left: auto;
    margin-right: auto;
}

@media screen and (max-width: 782px) {
    .admin-bar .kb-wrapper {
        margin-top: 110px;
    }
}

/* Left Sidebar */
.kb-sidebar {
    position: sticky;
    top: 80px;
    width: 360px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    align-self: flex-start;
    flex-shrink: 0;
}

/* Account for WordPress admin bar */
.admin-bar .kb-sidebar {
    top: 112px;
    max-height: calc(100vh - 112px);
}

@media screen and (max-width: 782px) {
    .admin-bar .kb-sidebar {
        top: 126px;
        max-height: calc(100vh - 126px);
    }
}

.kb-sidebar-inner {
    padding: 30px 16px;
}

.kb-topbar-right a i {
    padding-top: 2px;

}

/* Search Box */
.kb-search-box {
    position: relative;
    max-width: 600px;
    flex: 1;
}

.kb-search-input,
.kb-article-page .kb-search-input,
.kb-article-page input.kb-search-input,
.kb-article-page input[type="search"].kb-search-input {
    width: 100% !important;
    min-width: 360px !important;
    padding: 10px 16px !important;
    padding-right: 48px !important;
    background: #27272a !important;
    border: 1px solid #3f3f46 !important;
    border-radius: 8px !important;
    color: #e4e4e7 !important;
    font-size: 14px !important;
    outline: none !important;
    transition: all 0.2s !important;
    box-shadow: none !important;
    height: auto !important;
    line-height: normal !important;
    margin: 0 !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

/* Suppress all browser-injected autofill/credential buttons */
.kb-search-input::-webkit-credentials-auto-fill-button,
.kb-search-input::-webkit-contacts-auto-fill-button,
.kb-search-input::-webkit-caps-lock-indicator,
.kb-search-input::-ms-clear,
.kb-search-input::-ms-reveal {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    width: 0 !important;
    height: 0 !important;
}

/* Kill yellow autofill background */
.kb-search-input:-webkit-autofill,
.kb-search-input:-webkit-autofill:hover,
.kb-search-input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #27272a inset !important;
    -webkit-text-fill-color: #e4e4e7 !important;
    border-color: #3f3f46 !important;
}

.kb-search-input::placeholder,
.kb-article-page .kb-search-input::placeholder {
    color: #71717a !important;
    opacity: 1 !important;
}

.kb-search-input:focus,
.kb-article-page .kb-search-input:focus {
    border-color: #52525b !important;
    background: #3f3f46 !important;
    outline: none !important;
}

.kb-search-counter {
    position: absolute;
    right: 52px;
    top: 50%;
    transform: translateY(-50%);
    color: #a1a1aa;
    font-size: 12px;
    font-weight: 500;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.kb-search-counter-text {
    pointer-events: none;
}

.kb-search-nav-btn,
button.kb-search-nav-btn,
.kb-article-page .kb-search-nav-btn,
.kb-article-page button.kb-search-nav-btn {
    background: #3f3f46 !important;
    border: none !important;
    color: #a1a1aa !important;
    cursor: pointer !important;
    font-size: 12px !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
    line-height: 1 !important;
    transition: all 0.2s !important;
    pointer-events: auto !important;
    outline: none !important;
    box-shadow: none !important;
}

.kb-search-nav-btn:hover,
button.kb-search-nav-btn:hover,
.kb-article-page .kb-search-nav-btn:hover,
.kb-article-page button.kb-search-nav-btn:hover {
    color: #e4e4e7 !important;
    background: #52525b !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.kb-search-nav-btn:active,
button.kb-search-nav-btn:active,
.kb-article-page .kb-search-nav-btn:active,
.kb-article-page button.kb-search-nav-btn:active {
    color: #ffffff !important;
    background: #52525b !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.kb-search-nav-btn:focus,
button.kb-search-nav-btn:focus,
.kb-article-page .kb-search-nav-btn:focus,
.kb-article-page button.kb-search-nav-btn:focus {
    outline: none !important;
    box-shadow: none !important;
    border-color: transparent !important;
    background: #52525b !important;
}

.kb-search-nav-btn:focus:not(:focus-visible),
button.kb-search-nav-btn:focus:not(:focus-visible),
.kb-article-page .kb-search-nav-btn:focus:not(:focus-visible) {
    outline: none !important;
    box-shadow: none !important;
    border-color: transparent !important;
}

.kb-search-nav-btn:focus-visible,
button.kb-search-nav-btn:focus-visible,
.kb-article-page .kb-search-nav-btn:focus-visible {
    outline: 2px solid var(--kb-highlight-color, #60a5fa) !important;
    outline-offset: 2px !important;
}

.kb-search-shortcut {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: #3f3f46;
    color: #a1a1aa;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    pointer-events: none;
}

.kb-search-clear,
button.kb-search-clear,
.kb-search-box .kb-search-clear,
.kb-article-page .kb-search-clear {
    position: absolute !important;
    right: 12px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    color: #71717a !important;
    font-size: 18px !important;
    font-family: Arial, sans-serif !important;
    line-height: 1 !important;
    cursor: pointer !important;
    padding: 0 2px !important;
    margin: 0 !important;
    display: none;
    transition: color 0.15s !important;
    outline: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    min-width: 0 !important;
    min-height: 0 !important;
    width: auto !important;
    height: auto !important;
    vertical-align: baseline !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

.kb-search-clear:hover,
button.kb-search-clear:hover,
.kb-search-box .kb-search-clear:hover,
.kb-article-page .kb-search-clear:hover {
    background: none !important;
    background-color: transparent !important;
    color: #e4e4e7 !important;
    border: none !important;
    box-shadow: none !important;
}

/* Navigation */
.kb-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.kb-nav-section {
    margin-bottom: 8px;
}

.kb-nav-section .kb-nav-item {
    font-size: 18px;
    font-weight: 400;
    color: #ffffff;
    text-decoration: none;
}

.kb-nav-parent {
    display: flex;
    
    gap: 10px;
    padding: 8px 12px;
    color: #e4e4e7;
    font-weight: 400;
    font-size: 16px;
    line-height: 24px;
    letter-spacing: 0px;
    background: none;
    border: none;
    width: 100%;
    cursor: pointer;
    transition: color 0.2s;
    text-align: left;
}

.kb-nav-parent:hover {
    color: #ffffff;
    background: initial;
    border: initial;
}

.kb-nav-section button:active, .kb-nav-section input[type=button]:active, .kb-nav-section input[type=submit]:active, .kb-nav-section button:focus, .kb-nav-section input[type=button]:focus, .kb-nav-section input[type=submit]:focus {
    background-color: initial !important;
    border: initial !important;
}

.kb-nav-parent-text {
    flex: 1;
}

.kb-nav-icon {
    font-size: 16px;
    flex-shrink: 0;
    color: #a1a1aa;
    margin-right: 2px;
    transition: color 0.2s;
}

/* Hide outline bullet by default, show circle */
.kb-nav-icon.fi-br-square-small{
    display: none;
}

.kb-nav-icon.fi-sr-angle-square-down {
    display: inline-block;
    padding-top: 2px;
}

/* When section is open, hide circle and show outline bullet */
.kb-nav-section-open .kb-nav-icon.fi-sr-angle-square-down {
    display: none;
}

.kb-nav-section-open .kb-nav-icon.fi-br-square-small{
    display: inline-block;
}

.kb-nav-children {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-left: 18px;
    padding-left: 10px;
    margin-top: 4px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.28s ease;
}

.kb-nav-section-open .kb-nav-children {
    border-left: 1px solid #27272a;
}

.kb-nav-link {
    display: block;
    padding: 8px 12px;
    color: #a1a1aa;
    text-decoration: none;
    font-size: 14px;
    border-radius: 6px;
    transition: all 0.2s;
}

.kb-nav-link:hover {
    color: #e4e4e7;
    background: #27272a;
}

.kb-nav-link-active,
body.kb-light-mode .kb-nav-link-active,
body.kb-article-page .kb-nav-link-active {
    color: var(--kb-highlight-color, #60a5fa) !important;
    background: color-mix(in srgb, var(--kb-highlight-color, #60a5fa) 15%, transparent) !important;
    font-weight: 500;
    transition: none;
}

.kb-nav-children a:hover {
    text-decoration: none;
}

/* Main Content Area */
.kb-main {
    flex: 1;
    min-width: 0;
    display: flex;
    gap: 48px;
    padding: 80px 48px;
    max-width: 1200px;
}

.kb-content-wrapper {
    flex: 1;
    /*max-width: 800px;*/
}

/* Article */
.kb-article {
    color: #a1a1aa;
}

.kb-article-header {
    margin-bottom: 32px;
}

.kb-article-title {
    font-size: 42px;
    font-weight: 700;
    line-height: 1.2;
    color: #ffffff;
    margin-bottom: 16px;
}

/* Article Content */
.kb-article-content {
    font-size: 16px;
    line-height: 1.7;
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.kb-article-content * {
    max-width: 100%;
}

.kb-article-content h2 {
    font-size: 32px;
    font-weight: 600;
    color: #ffffff;
    padding-top: 48px;
    margin-bottom: 20px;
    line-height: 1.3;
}

/* First H1 is the main title - no top margin, 20px bottom margin */
.kb-article-content h1:first-child {
    padding-top: 40px;
    margin-bottom: 20px;
}

/* H1 styling */
.kb-article-content h1 {
    font-size: 42px;
    font-weight: 700;
    line-height: 1.2;
    color: #ffffff;
    padding-top: 40px;
    margin-top: 0;
    margin-bottom: 20px;
}

.kb-article-content h3 {
    font-size: 24px;
    font-weight: 600;
    color: #ffffff;
    margin-top: 32px;
    margin-bottom: 16px;
    line-height: 1.4;
}

.kb-article-content p {
    margin-bottom: 20px;
    color: #a1a1aa;
}

.kb-article-content ul,
.kb-article-content ol {
    margin-bottom: 20px;
    padding-left: 28px;
}

.kb-article-content li {
    margin-bottom: 12px;
    color: #d4d4d8;
}

.kb-article-content strong {
    color: #ffffff;
    font-weight: 600;
}

.kb-article-content em {
    font-style: normal;
}

.kb-article-content a:not(.kb-category-link) {
    /* color is set dynamically via inline styles in templates */
    text-decoration: none;
    transition: color 0.2s;
}

/* Link colors are set dynamically via inline styles in templates */

.kb-article-content code {
    background: #27272a;
    color: #ffffff;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
    font-size: 14px;
}

.kb-article-content pre {
    background: #18181b;
    border: 1px solid #27272a;
    border-radius: 8px;
    padding: 20px;
    overflow-x: auto;
    margin-bottom: 24px;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

.kb-article-content pre code {
    background: none;
    color: #e4e4e7;
    padding: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Citations */

.kb-article-content sup a {
    background: #27272a;
    padding: 4px 6px;
    margin: 0px 2px;
    border-radius: 4px;
    color: #ffffff !important;
}

.kb-article-content sup a:hover {
    color: #ffffff;
    text-decoration: none;
}

/* References Section */
.kb-article-content ol:has(li[id^="ref-"]) {
    padding-left: 12px;
    padding-right: 0;
}

.kb-article-content ol li[id^="ref-"] {
    font-size: 14px;
    color: #a1a1aa;
    margin-bottom: 16px;
    scroll-margin-top: 100px;
    list-style-position: inside;
}

.kb-article-content ol li[id^="ref-"]:target,
.kb-article-content ol li[id^="ref-"].kb-ref-highlighted {
    background: #151519;
    padding: 8px 8px 8px 12px;
    margin-left: -12px;
    border-radius: 6px;
}

/* Right Sidebar - Table of Contents */
.kb-toc {
    width: 280px;
    flex-shrink: 0;
}

.kb-toc-inner {
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
}

/* Account for WordPress admin bar */
.admin-bar .kb-toc-inner {
    top: 112px;
    max-height: calc(100vh - 112px);
}

@media screen and (max-width: 782px) {
    .admin-bar .kb-toc-inner {
        top: 126px;
        max-height: calc(100vh - 126px);
    }
}

.kb-toc-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #71717a;
    margin-bottom: 16px;
    margin-top: 40px;
}

.kb-toc-nav {
    display: flex;
    flex-direction: column;
    gap: 0px;
    border-left: 1px solid #3f3f46;
}

.kb-toc-link,
.kb-toc-link:link,
.kb-toc-link:visited,
.kb-toc a.kb-toc-link,
a.kb-toc-link {
    display: block;
    padding: 10px 12px;
    color: #a1a1aa !important;
    text-decoration: none !important;
    font-size: 13px;
    line-height: 1.4;
    border-left: 2px solid transparent;
    transition: all 0.2s;
}

.kb-toc-link:hover,
.kb-toc a.kb-toc-link:hover,
a.kb-toc-link:hover {
    color: #e4e4e7 !important;
    border-left-color: #52525b;
    text-decoration: none !important;
}

.kb-toc-link-active,
.kb-toc-link-active:link,
.kb-toc-link-active:visited,
.kb-toc-link-active:hover,
.kb-toc-link-active:active,
.kb-toc-link-active:focus,
.kb-toc a.kb-toc-link-active,
a.kb-toc-link-active {
    color: var(--kb-highlight-color, #60a5fa) !important;
    border-left-color: var(--kb-highlight-color, #60a5fa);
    text-decoration: none !important;
}

/* Responsive Design */
@media screen and (max-width: 1280px) {
    .kb-main {
        padding: 80px 32px;
        gap: 32px;
    }

    .kb-toc {
        display: none;
    }
}

@media screen and (max-width: 1024px) {
    .kb-sidebar {
        position: fixed;
        left: 0;
        top: 80px;
        height: calc(100vh - 80px);
        max-height: calc(100vh - 80px);
        z-index: 998;
        background: #09090b;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        border-right: 1px solid #27272a;
    }

    .admin-bar .kb-sidebar {
        top: 112px;
        height: calc(100vh - 112px);
        max-height: calc(100vh - 112px);
    }

    .kb-sidebar.kb-sidebar-open {
        transform: translateX(0);
    }

    /* Mobile menu overlay */
    .kb-mobile-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 997;
    }

    .kb-mobile-overlay.active {
        display: block;
    }

    .kb-main {
        margin-left: 0;
        padding: 80px 24px 32px;
    }
}

@media screen and (max-width: 768px) {
    .kb-topbar-inner {
        padding: 0 12px;
    }

    /* Stack topbar on very small screens */
    .kb-topbar {
        height: auto;
        min-height: 64px;
        padding: 8px 0;
    }

    .kb-topbar-inner {
        flex-wrap: wrap;
        gap: 8px;
    }

    .kb-topbar-title-section {
        flex: 1;
        min-width: 0;
    }

    .kb-topbar-title {
        font-size: 18px;
        line-height: 22px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .kb-topbar-updated {
        font-size: 11px;
    }

    /* Fix search input overflow */
    .kb-search-box {
        max-width: none;
        flex: 0 1 auto;
    }

    .kb-search-input,
    .kb-article-page .kb-search-input {
        min-width: 120px !important;
        width: 140px !important;
        padding: 8px 12px !important;
        padding-right: 40px !important;
        font-size: 14px !important;
    }

    .kb-search-shortcut {
        display: none;
    }

    /* Hide some topbar buttons on very small screens */
    .kb-topbar-right {
        gap: 4px !important;
    }

    .kb-glossary-topbar-btn,
    .kb-comparisons-topbar-btn,
    .kb-faq-topbar-btn {
        width: 36px !important;
        height: 36px !important;
    }

    .kb-glossary-topbar-btn i,
    .kb-comparisons-topbar-btn i,
    .kb-faq-topbar-btn i {
        font-size: 16px !important;
    }

    .admin-bar .kb-sidebar {
        top: 46px;
        height: calc(100vh - 46px);
        max-height: calc(100vh - 46px);
    }

    .kb-main {
        margin-left: 0;
        padding: 24px 16px;
        flex-direction: column;
    }

    .kb-article-title,
    .kb-article-content h1 {
        font-size: 28px;
    }

    .kb-article-content h2 {
        font-size: 22px;
        padding-top: 32px;
    }

    .kb-article-content h3 {
        font-size: 18px;
        margin-top: 24px;
    }

    .kb-article-content {
        font-size: 15px;
    }

    .kb-article-content ul,
    .kb-article-content ol {
        padding-left: 20px;
    }

    /* Better touch targets for navigation */
    .kb-nav-parent {
        padding: 12px;
        min-height: 48px;
    }

    .kb-nav-link {
        padding: 12px;
        min-height: 44px;
    }

    /* Category cards full width on mobile */
    .kb-category-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .kb-category-card {
        padding: 16px;
    }
}

/* Extra small devices */
@media screen and (max-width: 480px) {
    .kb-topbar-title {
        font-size: 16px;
    }

    .kb-search-input,
    .kb-article-page .kb-search-input {
        width: 100px !important;
        min-width: 100px !important;
    }

    /* Hide glossary and comparisons on very small screens, keep FAQs */
    .kb-glossary-topbar-btn,
    .kb-comparisons-topbar-btn {
        display: none !important;
    }

    .kb-main {
        padding: 20px 12px;
    }

    .kb-article-content h1,
    .kb-article-title {
        font-size: 24px;
    }

    .kb-article-content h2 {
        font-size: 20px;
    }

    .kb-article-content pre {
        padding: 12px;
        font-size: 12px;
    }
}

/* Mobile menu toggle button */
.kb-mobile-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    cursor: pointer;
    color: #ffffff;
    font-size: 20px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.kb-mobile-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.kb-mobile-menu-toggle:focus-visible {
    outline: 2px solid #60a5fa;
    outline-offset: 2px;
}

@media screen and (max-width: 1024px) {
    .kb-mobile-menu-toggle {
        display: flex;
    }
}

/* =====================================================
   ACCESSIBILITY IMPROVEMENTS
   ===================================================== */

/* Skip to content link */
.kb-skip-link {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: #60a5fa;
    color: #000000;
    padding: 12px 24px;
    border-radius: 0 0 8px 8px;
    font-weight: 600;
    text-decoration: none;
    z-index: 10000;
    transition: top 0.2s;
}

.kb-skip-link:focus {
    top: 0;
    outline: none;
}

/* Focus visible styles for all interactive elements */
/* Note: These are fallback styles. Templates override with KB-specific highlight colors via inline styles */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--kb-highlight-color, #60a5fa);
    outline-offset: 2px;
}

.kb-nav-link:focus-visible {
    outline: 2px solid var(--kb-highlight-color, #60a5fa);
    outline-offset: -2px;
    border-radius: 4px;
}

.kb-nav-parent:focus-visible {
    outline: 2px solid var(--kb-highlight-color, #60a5fa);
    outline-offset: -2px;
    border-radius: 4px;
}

/* Remove focus ring on mouse click, keep for keyboard only */
.kb-nav-parent:focus:not(:focus-visible),
.kb-nav-link:focus:not(:focus-visible) {
    outline: none !important;
    box-shadow: none !important;
    border-color: transparent !important;
}

/* Override theme button focus styles */
button.kb-nav-parent:focus,
.kb-article-page button.kb-nav-parent:focus,
.kb-nav-parent:focus {
    outline: none !important;
    box-shadow: none !important;
}

button.kb-nav-parent:focus-visible,
.kb-article-page button.kb-nav-parent:focus-visible,
.kb-nav-parent:focus-visible {
    outline: 2px solid var(--kb-highlight-color, #60a5fa) !important;
    outline-offset: -2px !important;
    border-radius: 4px;
}

.kb-toc-link:focus-visible {
    outline: 2px solid var(--kb-highlight-color, #60a5fa);
    outline-offset: -2px;
}

.kb-category-card:focus-visible {
    outline: 2px solid var(--kb-highlight-color, #60a5fa);
    outline-offset: 2px;
}

/* Better focus for search input */
.kb-search-input:focus {
    border-color: var(--kb-highlight-color, #60a5fa);
    box-shadow: 0 0 0 3px var(--kb-highlight-color-alpha, rgba(96, 165, 250, 0.2));
}

/* Touch target improvements for search navigation */
.kb-search-nav-btn {
    min-width: 28px;
    min-height: 28px;
    padding: 4px 8px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .kb-article-content {
        color: #ffffff;
    }

    .kb-nav-link {
        color: #ffffff;
    }

    .kb-category-description {
        color: #e4e4e7;
    }

    .kb-search-input {
        border-width: 2px;
    }
}

/* Table responsiveness */
.kb-article-content table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.kb-article-content table th,
.kb-article-content table td {
    min-width: 100px;
}

/* Image responsiveness */
.kb-article-content img {
    max-width: 100%;
    height: auto;
}

/* Custom Scrollbar */
.kb-sidebar::-webkit-scrollbar,
.kb-toc::-webkit-scrollbar {
    width: 6px;
}

.kb-sidebar::-webkit-scrollbar-track,
.kb-toc::-webkit-scrollbar-track {
    background: transparent;
}

.kb-sidebar::-webkit-scrollbar-thumb,
.kb-toc::-webkit-scrollbar-thumb {
    background: #3f3f46;
    border-radius: 3px;
}

.kb-sidebar::-webkit-scrollbar-thumb:hover,
.kb-toc::-webkit-scrollbar-thumb:hover {
    background: #52525b;
}

/* Search Result Highlighting */
.kb-nav-link.kb-search-match,
.kb-nav-link.kb-search-content-match {
    font-style: italic;
}

/* Removed (in content) label for cleaner search results */

/* Article Content Highlighting */
.kb-search-highlight {
    background: #3b82f6;
    color: #ffffff;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 500;
}

/* KB Landing Page Styles */
.kb-category-archive {
    max-width: initial !important
}

.kb-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 40px;
}

.kb-category-card {
    background: transparent;
    border: 1px solid #27272a;
    border-radius: 12px;
    padding: 20px;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

.kb-category-card:hover {
    border-color: #3f3f46;
}

.kb-category-card-header {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex: 1;
}

.kb-category-icon {
    display: flex;
    align-items: center;
    margin-bottom: 0px;
}

.kb-category-icon i {
    font-size: 32px;
    /* color is set dynamically via inline styles in template */
    transition: color 0.2s;
}

/* hover color is set dynamically via inline styles in template for .kb-category-card:hover .kb-category-icon i */

.kb-category-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.kb-category-card h3 {
    margin: 0 0 12px 0;
    font-size: 18px;
    font-weight: 400;
    color: #ffffff;
    transition: color 0.2s;
}

.kb-category-description {
    color: #a1a1aa;
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 0px !important;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.kb-category-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 16px;
}

.kb-category-count {
    color: #71717a;
    font-size: 14px;
}

.kb-category-link {
    /* color is set dynamically via inline styles in template */
    text-transform: uppercase;
    font-size: 12px;
    font-weight: 500;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

@media (max-width: 768px) {
    .kb-category-grid {
        grid-template-columns: 1fr;
    }
}

/* Landing Page Admin Actions */
.kb-landing-admin-actions {
    margin: 24px 0 32px 0;
    display: flex;
    justify-content: center;
}

.kb-landing-action-btn {
    background: #2271b1;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
    text-align: center;
}

.kb-landing-action-btn:hover {
    background: #135e96;
}

/* KB Title Link */
.kb-topbar-title a {
    color: #e4e4e7;
    text-decoration: none;
    transition: color 0.2s;
}

.kb-topbar-title a:hover {
    color: #60a5fa;
}

/* Category Page Article List Styles */
.kb-article-content h3 a {
    /* color is set dynamically via inline styles in template */
    text-decoration: none;
    transition: color 0.2s;
    font-size: 18px;
}

/* Add spacing and styling to article descriptions under H3 headings */
.kb-article-content h3 {
    margin-bottom: 8px;
    padding-bottom: 8px; 
}

/* Improve spacing for paragraphs following H3 article titles */
.kb-article-content h3 + p { 
    color: #a1a1aa;
    line-height: 1.6;
}

/* Style the "Articles in this Category" section heading */
.kb-article-content h2 {
    margin-top: -20px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    /*border-bottom: 2px solid #27272a;*/
    color: #e4e4e7;
}

/* =============================================================
   LIGHT MODE — body.kb-article-page.kb-light-mode overrides
   ============================================================= */

/* Theme toggle button — base styles */
.kb-theme-toggle {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 40px !important;
    height: 40px !important;
    border: none !important;
    border-radius: 8px !important;
    background: none !important;
    background-color: transparent !important;
    cursor: pointer !important;
    transition: color 0.2s !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    line-height: 1 !important;
    color: #ffffff !important;
    text-shadow: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

.kb-theme-toggle:hover {
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    color: var(--kb-highlight-color, #60a5fa) !important;
}

/* SVG icons inherit color from button */
.kb-theme-icon-sun,
.kb-theme-icon-moon {
    display: block;
    width: 20px;
    height: 20px;
}

body.kb-light-mode .kb-theme-toggle {
    color: #27272a !important;
}

body.kb-light-mode .kb-theme-toggle:hover {
    color: var(--kb-highlight-color, #60a5fa) !important;
    background: none !important;
    border: none !important;
}

/* Smooth theme transition — only active during toggle click, not on page load */
body.kb-theme-transitioning,
body.kb-theme-transitioning * {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, fill 0.3s ease !important;
}

/* Topbar icon buttons (glossary, comparisons, FAQs) */
.kb-glossary-topbar-btn:hover i,
.kb-comparisons-topbar-btn:hover i,
.kb-faq-topbar-btn:hover i {
    color: var(--kb-highlight-color, #60a5fa) !important;
}

/* Base + page */
body.kb-article-page.kb-light-mode,
html:has(body.kb-light-mode) {
    background-color: #ffffff !important;
    --kb-page-bg: #ffffff;
    --kb-surface-bg: #f4f4f5;
}

body.kb-article-page.kb-light-mode {
    color: #27272a !important;
    background: #ffffff !important;
}

/* Topbar */
body.kb-light-mode .kb-topbar {
    background: rgba(255, 255, 255, 0.92) !important;
    border-bottom-color: #e4e4e7 !important;
}

body.kb-light-mode .kb-topbar-title a,
body.kb-light-mode .kb-topbar-title {
    color: #18181b !important;
}

body.kb-light-mode .kb-topbar-updated {
    color: #71717a !important;
}

body.kb-light-mode .kb-mobile-menu-toggle {
    color: #18181b !important;
    border-color: rgba(0, 0, 0, 0.15) !important;
}

body.kb-light-mode .kb-mobile-menu-toggle:hover {
    background: rgba(0, 0, 0, 0.05) !important;
}

body.kb-light-mode .kb-glossary-topbar-btn,
body.kb-light-mode .kb-comparisons-topbar-btn,
body.kb-light-mode .kb-faq-topbar-btn {
    border-color: rgba(0, 0, 0, 0.15) !important;
}

body.kb-light-mode .kb-glossary-topbar-btn:hover,
body.kb-light-mode .kb-comparisons-topbar-btn:hover,
body.kb-light-mode .kb-faq-topbar-btn:hover {
    background-color: rgba(0, 0, 0, 0.05) !important;
    border-color: rgba(0, 0, 0, 0.25) !important;
}

body.kb-light-mode .kb-glossary-topbar-btn i,
body.kb-light-mode .kb-comparisons-topbar-btn i,
body.kb-light-mode .kb-faq-topbar-btn i {
    color: #18181b !important;
}

body.kb-light-mode .kb-glossary-topbar-btn:hover i,
body.kb-light-mode .kb-comparisons-topbar-btn:hover i,
body.kb-light-mode .kb-faq-topbar-btn:hover i {
    color: var(--kb-highlight-color, #60a5fa) !important;
}


/* Sidebar — transparent on desktop (inherits body bg), solid on mobile (fixed overlay needs opaque bg) */
body.kb-light-mode .kb-sidebar {
    background: transparent !important;
    border-right-color: #e4e4e7 !important;
}

@media screen and (max-width: 1024px) {
    body.kb-light-mode .kb-sidebar {
        background: #ffffff !important;
    }
}

body.kb-light-mode .kb-nav-section-title {
    color: #71717a !important;
    border-bottom-color: #e4e4e7 !important;
}

body.kb-light-mode .kb-nav-parent {
    color: #27272a !important;
}

body.kb-light-mode .kb-nav-parent:hover,
body.kb-light-mode button.kb-nav-parent:hover {
    color: #18181b !important;
    background: none !important;
}

body.kb-light-mode .kb-nav-link {
    color: #52525b !important;
}

body.kb-light-mode .kb-nav-link:hover {
    color: #18181b !important;
    background: #f4f4f5 !important;
}

body.kb-light-mode .kb-nav-link.kb-nav-link-active {
    color: var(--kb-highlight-color, #60a5fa) !important;
    background: color-mix(in srgb, var(--kb-highlight-color, #60a5fa) 15%, transparent) !important;
}

body.kb-light-mode .kb-nav-section-open .kb-nav-children {
    border-left-color: #e4e4e7 !important;
}

body.kb-light-mode .kb-nav-icon {
    color: #a1a1aa !important;
}

body.kb-light-mode .kb-mobile-overlay {
    background: rgba(0, 0, 0, 0.4) !important;
}

/* Search */
body.kb-light-mode .kb-search-input,
body.kb-light-mode .kb-article-page .kb-search-input,
body.kb-light-mode input.kb-search-input {
    background: #ffffff !important;
    border-color: #d4d4d8 !important;
    color: #18181b !important;
}

body.kb-light-mode .kb-search-input::placeholder {
    color: #a1a1aa !important;
}

body.kb-light-mode .kb-search-input:focus {
    background: #ffffff !important;
    border-color: #a1a1aa !important;
}

body.kb-light-mode .kb-search-shortcut {
    background: #e4e4e7 !important;
    color: #52525b !important;
}

body.kb-light-mode .kb-search-clear,
body.kb-light-mode button.kb-search-clear {
    color: #71717a !important;
}

body.kb-light-mode .kb-search-clear:hover,
body.kb-light-mode button.kb-search-clear:hover {
    color: #27272a !important;
}

body.kb-light-mode .kb-search-counter {
    color: #71717a !important;
}

body.kb-light-mode .kb-search-nav-btn,
body.kb-light-mode button.kb-search-nav-btn {
    background: #e4e4e7 !important;
    color: #52525b !important;
}

body.kb-light-mode .kb-search-nav-btn:hover,
body.kb-light-mode button.kb-search-nav-btn:hover {
    background: #d4d4d8 !important;
    color: #18181b !important;
}

body.kb-light-mode .kb-search-results-panel {
    background: #ffffff !important;
    border-color: #e4e4e7 !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1) !important;
}

body.kb-light-mode .kb-search-result-item {
    border-bottom-color: #f4f4f5 !important;
    color: #27272a !important;
}

body.kb-light-mode .kb-search-result-item:hover,
body.kb-light-mode .kb-search-result-item.kb-search-active {
    background: #f4f4f5 !important;
}

body.kb-light-mode .kb-search-result-category {
    color: #71717a !important;
}

body.kb-light-mode .kb-search-no-results,
body.kb-light-mode .kb-search-loading {
    color: #71717a !important;
}

/* Main content area */
body.kb-light-mode .kb-main,
body.kb-light-mode .kb-content-wrapper,
body.kb-light-mode .kb-article {
    background: transparent !important;
}

body.kb-light-mode .kb-article-content {
    color: #27272a !important;
    background: transparent !important;
}

body.kb-light-mode .kb-article-title,
body.kb-light-mode .kb-article-content h1,
body.kb-light-mode .kb-article-content h2,
body.kb-light-mode .kb-article-content h3,
body.kb-light-mode .kb-article-content h4,
body.kb-light-mode .kb-article-content h5,
body.kb-light-mode .kb-article-content h6,
body.kb-light-mode .kb-article-content strong {
    color: #18181b !important;
}

body.kb-light-mode .kb-article-content p {
    color: #27272a !important;
}

body.kb-light-mode .kb-article-content ul li,
body.kb-light-mode .kb-article-content ol li {
    color: #27272a !important;
}

body.kb-light-mode .kb-article-content blockquote {
    border-left-color: #d4d4d8 !important;
    background: #f4f4f5 !important;
    color: #52525b !important;
}

/* Citations */
body.kb-light-mode .kb-article-content sup a {
    background: #e4e4e7 !important;
    color: #18181b !important;
}

body.kb-light-mode .kb-article-content sup a:hover {
    color: var(--kb-highlight-color, #60a5fa) !important;
}

body.kb-light-mode .kb-article-content ol li[id^="ref-"] {
    color: #71717a !important;
}

body.kb-light-mode .kb-article-content ol li[id^="ref-"]:target,
body.kb-light-mode .kb-article-content ol li[id^="ref-"].kb-ref-highlighted {
    background: #f4f4f5 !important;
}

body.kb-light-mode .kb-article-content code {
    background: #e4e4e7 !important;
    color: #18181b !important;
}

body.kb-light-mode .kb-article-content pre {
    background: #f4f4f5 !important;
    border-color: #e4e4e7 !important;
    color: #27272a !important;
}

body.kb-light-mode .kb-article-content pre code {
    background: none !important;
    color: #27272a !important;
}

body.kb-light-mode .kb-article-content table th {
    background: #f4f4f5 !important;
    color: #18181b !important;
    border-color: #e4e4e7 !important;
}

body.kb-light-mode .kb-article-content table td {
    color: #27272a !important;
    border-color: #e4e4e7 !important;
}

body.kb-light-mode .kb-article-content table tr:nth-child(even) {
    background: #fafafa !important;
}

body.kb-light-mode .kb-article-content hr {
    border-color: #e4e4e7 !important;
}

/* Overview / intro box */
body.kb-light-mode .kb-overview {
    background: #f4f4f5 !important;
    border-color: #e4e4e7 !important;
    color: #52525b !important;
}

body.kb-light-mode .kb-glossary-header .kb-overview,
body.kb-light-mode .kb-article-content > h1 + .kb-overview {
    background: none !important;
    border-color: transparent !important;
}

/* Category landing page cards */
body.kb-light-mode .kb-category-card {
    border-color: #e4e4e7 !important;
    background: transparent !important;
}

body.kb-light-mode .kb-category-card:hover {
    border-color: #d4d4d8 !important;
    background: transparent !important;
}

body.kb-light-mode .kb-category-card h3 {
    color: #18181b !important;
}

body.kb-light-mode .kb-category-description {
    color: #52525b !important;
}

body.kb-light-mode .kb-category-count {
    color: #71717a !important;
}

/* Related FAQs */
body.kb-light-mode .kb-related-faqs a {
    border-color: #e4e4e7 !important;
    color: #27272a !important;
}

body.kb-light-mode .kb-related-faqs a:hover {
    background: #f4f4f5 !important;
    border-color: #d4d4d8 !important;
}

/* TOC */
body.kb-light-mode .kb-toc {
    background: transparent !important;
}

body.kb-light-mode .kb-toc-inner {
    background: transparent !important;
}

body.kb-light-mode .kb-toc-title {
    color: #71717a !important;
}

body.kb-light-mode .kb-toc-nav {
    border-left-color: #e4e4e7 !important;
}

body.kb-light-mode .kb-toc-link {
    color: #52525b !important;
    border-left-color: transparent !important;
}

body.kb-light-mode .kb-toc-link:hover {
    color: #18181b !important;
    border-left-color: #a1a1aa !important;
}

body.kb-light-mode .kb-toc-link-active,
body.kb-light-mode .kb-toc a.kb-toc-link-active,
body.kb-light-mode a.kb-toc-link-active {
    color: var(--kb-highlight-color, #60a5fa) !important;
    border-left-color: var(--kb-highlight-color, #60a5fa) !important;
}

/* FAQ-specific (overrides inline template styles) */
body.kb-light-mode .kb-faq-item {
    background: transparent !important;
    border-color: #e4e4e7 !important;
}

body.kb-light-mode .kb-faq-question {
    color: #18181b !important;
}

body.kb-light-mode .kb-faq-answer {
    color: #27272a !important;
    border-top-color: #f4f4f5 !important;
}

body.kb-light-mode .kb-faq-toggle {
    color: #71717a !important;
}

body.kb-light-mode .kb-faq-meta {
    color: #71717a !important;
}

body.kb-light-mode .kb-faq-answer p {
    color: #52525b !important;
}

/* Glossary-specific (overrides inline template styles) */
body.kb-light-mode .kb-glossary-header {
    background: #ffffff !important;
}

body.kb-light-mode .kb-glossary-index-letter {
    color: rgba(0, 0, 0, 0.2) !important;
}

body.kb-light-mode .kb-glossary-index-letter.active {
    color: #71717a !important;
}

body.kb-light-mode .kb-glossary-index-letter.active:hover {
    color: #18181b !important;
    border-bottom-color: #d4d4d8 !important;
}

body.kb-light-mode .kb-glossary-section-letter {
    color: #18181b !important;
    border-color: #e4e4e7 !important;
}

body.kb-light-mode .kb-glossary-term-title {
    color: #18181b !important;
}

body.kb-light-mode .kb-glossary-alias {
    color: #71717a !important;
}

body.kb-light-mode .kb-glossary-definition {
    color: #27272a !important;
}

body.kb-light-mode .kb-glossary-why-matters,
body.kb-light-mode .kb-glossary-example {
    background: none !important;
}

body.kb-light-mode .kb-glossary-why-it-matters-example-con {
    border-left-color: #e4e4e7 !important;
}

body.kb-light-mode .kb-glossary-section-title {
    color: #52525b !important;
}

body.kb-light-mode .kb-glossary-related {
    background: #f4f4f5 !important;
}

body.kb-light-mode .kb-glossary-article-link {
    color: #52525b !important;
}

body.kb-light-mode .kb-glossary-article-link a {
    color: var(--kb-highlight-color, #60a5fa) !important;
}

/* Comparison-specific (overrides inline template styles) */
body.kb-light-mode .kb-comparison-title {
    color: #18181b !important;
}

body.kb-light-mode .kb-comparison-card {
    border-bottom-color: #e4e4e7 !important;
}

body.kb-light-mode .kb-comparison-item {
    background: #f4f4f5 !important;
}

body.kb-light-mode .kb-comparison-item-title {
    color: #18181b !important;
}

body.kb-light-mode .kb-comparison-content {
    color: #27272a !important;
}

body.kb-light-mode .kb-comparison-section-title {
    color: #52525b !important;
}

body.kb-light-mode .kb-comparison-details-container {
    border-left-color: rgba(0, 0, 0, 0.1) !important;
}

body.kb-light-mode .kb-decision-matrix-table {
    background: #ffffff !important;
}

body.kb-light-mode .kb-decision-matrix-table th {
    background: #f4f4f5 !important;
    color: #52525b !important;
}

body.kb-light-mode .kb-decision-matrix-table td {
    color: #27272a !important;
    background: #ffffff !important;
}

body.kb-light-mode .kb-decision-matrix-table th:first-child {
    color: #18181b !important;
}

body.kb-light-mode .kb-decision-matrix-table td:first-child {
    color: #18181b !important;
    background-color: #f4f4f5 !important;
}

body.kb-light-mode .kb-decision-matrix-table tr:nth-child(even) td:first-child {
    background-color: #ebebeb !important;
}

body.kb-light-mode .kb-comparison-related {
    background: #f4f4f5 !important;
}

/* Scrollbars */
body.kb-light-mode .kb-sidebar::-webkit-scrollbar-thumb,
body.kb-light-mode .kb-toc::-webkit-scrollbar-thumb {
    background: #d4d4d8 !important;
}

body.kb-light-mode .kb-sidebar::-webkit-scrollbar-thumb:hover,
body.kb-light-mode .kb-toc::-webkit-scrollbar-thumb:hover {
    background: #a1a1aa !important;
}
