/* Documentation site custom styles */

/* Layout */
.docs-wrapper {
    padding-top: 72px;
    /* navbar height */
}

.docs-sidebar {
    position: sticky;
    top: 72px;
    height: calc(100vh - 72px);
    overflow-y: auto;
    border-right: 1px solid var(--bs-border-color);
    font-size: 0.875rem;
}

.docs-toc {
    position: sticky;
    top: 76px;
    height: calc(100vh - 76px);
    overflow-y: auto;
    font-size: 0.75rem;
}

.docs-content {
    min-height: calc(100vh - 72px);
    padding: 2rem 2.5rem;
    max-width: 100%;
}

/* ─── Navbar ──────────────────────────────────────────────────────────────── */

.navbar-docs-badge {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--bs-primary);
    background: rgba(var(--bs-primary-rgb), 0.1);
    padding: 0.15rem 0.5rem;
    border-radius: 0.25rem;
    line-height: 1.4;
}

/* Navbar search trigger — prominent, centered bar */
.navbar-search-trigger {
    flex: 1;
    max-width: 480px;
    margin: 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.875rem;
    font-size: 0.875rem;
    color: var(--bs-secondary-color);
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.navbar-search-trigger:hover {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), 0.1);
}

.navbar-search-trigger i {
    font-size: 0.8125rem;
    opacity: 0.5;
}

.navbar-search-trigger span {
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.navbar-search-trigger kbd {
    font-size: 0.625rem;
    padding: 0.1rem 0.35rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.25rem;
    background: var(--bs-tertiary-bg);
    color: var(--bs-secondary-color);
    white-space: nowrap;
    font-weight: 600;
    line-height: 1.4;
}

/* Navbar main-site link — subtle, pill-shaped */
.navbar-site-link {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--bs-secondary-color);
    text-decoration: none;
    padding: 0.3rem 0.65rem;
    border-radius: 1rem;
    border: 1px solid var(--bs-border-color);
    transition: all 0.15s;
    white-space: nowrap;
    align-items: center;
    gap: 0.25rem;
}

.navbar-site-link:hover {
    color: var(--bs-primary);
    border-color: var(--bs-primary);
    background: rgba(var(--bs-primary-rgb), 0.05);
}

/* ─── Sidebar ─────────────────────────────────────────────────────────────── */

.sidebar-group {
    margin-bottom: 0.125rem;
}

.sidebar-group-btn {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--bs-body-color);
    background: transparent;
    text-align: left;
    border-radius: 0.375rem;
    transition: background-color 0.15s, color 0.15s;
}

.sidebar-group-btn:hover {
    background-color: var(--bs-tertiary-bg);
}

/* Chevron rotation */
.sidebar-chevron {
    flex-shrink: 0;
    transition: transform 0.2s ease;
    opacity: 0.5;
}

.sidebar-group-btn[aria-expanded="true"] .sidebar-chevron,
.sidebar-sub-btn[aria-expanded="true"] .sidebar-chevron {
    transform: rotate(90deg);
}

/* Keep old arrow rotation for any leftover markup */
.sidebar-group-btn[aria-expanded="true"] .sidebar-arrow,
.sidebar-sub-btn[aria-expanded="true"] .sidebar-arrow {
    transform: rotate(90deg);
}

.sidebar-arrow {
    font-size: 0.625rem;
    transition: transform 0.2s;
    display: inline-block;
}

/* Sub-group button (nested sections like "API Documentation Versions") */
.sidebar-sub-btn {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--bs-secondary-color);
    background: transparent;
    border-radius: 0.375rem;
    transition: background-color 0.15s, color 0.15s;
    padding: 0.3rem 0.5rem;
}

.sidebar-sub-btn:hover {
    background-color: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
}

.sidebar-sub-btn span {
    font-size: 0.8125rem;
}

/* Sub-sub list — indented with a left border line */
.sidebar-sub-list {
    margin-left: 0.5rem;
    padding-left: 0.75rem !important;
    border-left: 1px solid var(--bs-border-color);
}

/* Leaf links */
.sidebar-link {
    font-size: 0.8125rem;
    color: var(--bs-secondary-color);
    transition: all 0.15s;
    border-radius: 0.375rem;
}

.sidebar-link:hover {
    background-color: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
}

.sidebar-link.active {
    background-color: rgba(var(--bs-primary-rgb), 0.1);
    color: var(--bs-primary) !important;
    font-weight: 600;
}

/* Postman download button in sidebar */
.sidebar-group .btn-outline-primary {
    font-size: 0.8125rem;
}

/* Sidebar scrollbar */
.docs-sidebar::-webkit-scrollbar {
    width: 4px;
}

.docs-sidebar::-webkit-scrollbar-thumb {
    background: var(--bs-border-color);
    border-radius: 4px;
}

.docs-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

/* ─── Content ─────────────────────────────────────────────────────────────── */

.docs-content h2 {
    font-size: 1.5rem;
}

.docs-content h3 {
    font-size: 1.25rem;
}

.docs-content .anchor-link {
    opacity: 0;
    font-size: 0.875rem;
    transition: opacity 0.15s;
}

.docs-content h2:hover .anchor-link,
.docs-content h3:hover .anchor-link,
.docs-content h4:hover .anchor-link {
    opacity: 0.5;
}

.docs-content .anchor-link:hover {
    opacity: 1 !important;
}

/* Code blocks */
.code-block-wrapper pre {
    margin: 0;
    border: 1px solid var(--bs-border-color);
}

.code-block-title {
    font-size: 0.8125rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Code tabs */
.code-tabs {
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
}

.code-tabs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bs-tertiary-bg);
    padding: 0.25rem 0.5rem 0 0.5rem;
    gap: 1rem;
}

.code-tabs-nav {
    display: flex;
    gap: 0.25rem;
}

.code-tab-btn {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--bs-secondary-color);
    background: transparent;
    border: none;
    border-radius: 0.375rem 0.375rem 0 0;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.code-tab-btn:hover {
    color: var(--bs-body-color);
    background: var(--bs-secondary-bg);
}

.code-tab-btn.active {
    color: var(--bs-primary);
    background: var(--bs-body-bg);
    font-weight: 600;
}

.code-tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--bs-primary);
}

.code-tabs-file {
    font-size: 0.75rem;
    font-family: var(--bs-font-monospace);
    color: var(--bs-secondary-color);
    padding: 0.5rem 0.5rem 0.5rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.code-tabs .tab-content {
    border-top: 1px solid var(--bs-border-color);
}

.code-tabs .tab-pane pre {
    border: none;
    border-radius: 0;
    margin: 0;
}

.code-tabs .tab-pane pre code {
    border-radius: 0;
}

/* Table styles */
.docs-content .table code {
    font-size: 0.8125rem;
}

/* TOC */
.docs-toc .toc-link {
    color: var(--bs-secondary-color);
    text-decoration: none;
    display: block;
    padding: 0.125rem 0;
    border-left: 2px solid transparent;
    padding-left: 0.75rem;
    transition: all 0.15s;
    line-height: 1.25;
}

.docs-toc .toc-link:hover,
.docs-toc .toc-link.active {
    color: var(--bs-primary);
    border-left-color: var(--bs-primary);
}

.docs-toc .toc-link.toc-h3 {
    padding-left: 1.25rem;
}

/* Footer */
.docs-footer {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: #e2e8f0;
    border-top: 3px solid var(--bs-primary);
}

[data-bs-theme="light"] .docs-footer {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    color: #334155;
}

.docs-footer a {
    color: inherit;
    transition: color 0.15s;
}

.docs-footer a:hover {
    color: var(--bs-primary);
}

/* Theme toggle */
.theme-toggle {
    cursor: pointer;
    background: none;
    border: none;
    color: var(--bs-body-color);
    font-size: 1.1rem;
    padding: 0.25rem 0.5rem;
}

/* ─── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 991.98px) {
    .docs-sidebar {
        position: fixed;
        top: 72px;
        left: -280px;
        width: 280px;
        z-index: 1040;
        background: var(--bs-body-bg);
        transition: left 0.3s;
    }

    .docs-sidebar.show {
        left: 0;
        box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
    }

    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 1039;
    }

    .sidebar-backdrop.show {
        display: block;
    }

    .docs-content {
        padding: 1.5rem 1rem;
    }
}

@media (min-width: 992px) {
    .sidebar-toggle-btn {
        display: none !important;
    }
}

/* Hero section */
.hero-section {
    background: linear-gradient(135deg, var(--bs-tertiary-bg) 0%, var(--bs-secondary-bg) 100%);
    border: 1px solid var(--bs-border-color);
}

[data-bs-theme="dark"] .hero-section {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

/* Search overlay */
.search-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1060;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
}

.search-overlay.show {
    display: flex;
}

.search-modal {
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.75rem;
    width: 100%;
    max-width: 560px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    margin: 0 1rem;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.search-input-wrapper .form-control {
    font-size: 1rem;
    background: transparent;
}

.search-input-wrapper kbd {
    font-size: 0.6875rem;
    padding: 0.125rem 0.375rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.25rem;
    background: var(--bs-tertiary-bg);
    white-space: nowrap;
}

.search-results {
    max-height: 400px;
    overflow-y: auto;
}

.search-result-item {
    display: block;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--bs-body-color);
    border-bottom: 1px solid var(--bs-border-color);
    transition: background-color 0.1s;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background-color: rgba(var(--bs-primary-rgb), 0.08);
}

.search-result-title {
    font-weight: 600;
    font-size: 0.9375rem;
    margin-bottom: 0.125rem;
}

.search-result-subtitle {
    font-size: 0.75rem;
    color: var(--bs-secondary-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-empty {
    font-size: 0.875rem;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 70px;
}