/* Documentation theme - CSS variables */
:root {
    --doc-bg: #ffffff;
    --doc-sidebar-bg: #f8f9fa;
    --doc-border: #e0e0e0;
    --doc-text: #333333;
    --doc-text-muted: #555555;
    --doc-text-subtle: #666666;
    --doc-accent: #007bff;
    --doc-accent-hover: #0056b3;
    --doc-info-bg: #e7f3ff;
    --doc-table-head: #f8f9fa;
    --doc-table-stripe: #fafbfc;
    --doc-hover-bg: #e9ecef;
    --doc-shadow: rgba(0, 0, 0, 0.08);
    --doc-search-highlight: #fff3cd;
    --doc-code-bg: #f1f3f5;
    --doc-header-offset: 80px;
    --doc-scroll-margin: calc(var(--doc-header-offset) + 20px);
}

.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, var(--doc-accent), #6f42c1);
    z-index: 10001;
    transition: width 0.1s linear;
}

.doc-wrapper {
    display: flex;
    min-height: 100vh;
    padding-top: var(--doc-header-offset);
    background: var(--doc-bg);
    color: var(--doc-text);
}

.doc-sidebar h4 {
    margin: 0 0 16px;
    font-size: 18px;
    font-weight: 700;
    color: var(--doc-text);
}

.doc-sidebar {
    width: 280px;
    background-color: var(--doc-sidebar-bg);
    border-right: 1px solid var(--doc-border);
    position: fixed;
    top: var(--doc-header-offset);
    height: calc(100vh - var(--doc-header-offset));
    overflow-y: auto;
    padding: 24px 16px;
    z-index: 100;
}

.doc-sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.doc-sidebar > ul > li {
    margin-bottom: 4px;
}

.doc-sidebar a {
    display: block;
    padding: 8px 12px;
    color: var(--doc-text-subtle);
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
    font-size: 14px;
}

.doc-sidebar a:hover,
.doc-sidebar a:focus-visible {
    background-color: var(--doc-hover-bg);
    color: var(--doc-text);
    outline: none;
}

.doc-sidebar a.active {
    background-color: var(--doc-accent);
    color: #fff;
}

.doc-sidebar .submenu {
    padding-left: 12px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
}

.doc-sidebar .submenu.expanded {
    max-height: 3000px;
}

.doc-sidebar .has-submenu > a {
    position: relative;
    padding-right: 28px;
}

.doc-sidebar .has-submenu > a::after {
    content: '\f107';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    right: 12px;
    transition: transform 0.3s;
}

.doc-sidebar .has-submenu.expanded > a::after {
    transform: rotate(180deg);
}

.doc-content {
    flex: 1;
    margin-left: 280px;
    padding: 40px 60px 80px;
    max-width: 960px;
}

.doc-content h1 {
    font-size: clamp(1.6rem, 4vw, 2.25rem);
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--doc-text);
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.doc-content h2,
.doc-content h3 {
    position: relative;
    color: var(--doc-text);
}

.doc-content h2 {
    font-size: clamp(1.25rem, 3vw, 1.65rem);
    font-weight: 600;
    margin-top: 40px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--doc-border);
    line-height: 1.3;
}

.doc-content h3 {
    font-size: clamp(1.1rem, 2.5vw, 1.25rem);
    font-weight: 600;
    margin-top: 28px;
    margin-bottom: 14px;
    line-height: 1.35;
}

.heading-anchor {
    opacity: 0;
    margin-left: 8px;
    color: var(--doc-text-subtle);
    text-decoration: none;
    font-weight: 400;
    font-size: 0.85em;
    transition: opacity 0.2s, color 0.2s;
}

.doc-content h2:hover .heading-anchor,
.doc-content h3:hover .heading-anchor,
.heading-anchor:focus-visible {
    opacity: 1;
    color: var(--doc-accent);
    outline: none;
}

.doc-content p,
.doc-content li {
    font-size: 16px;
    line-height: 1.75;
    color: var(--doc-text-muted);
}

.doc-content p {
    margin-bottom: 16px;
    overflow-wrap: anywhere;
}

.doc-content a {
    overflow-wrap: anywhere;
}

.doc-content code {
    background: var(--doc-code-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    word-break: break-word;
}

.ui-label {
    display: inline-block;
    font-size: 0.55em;
    font-weight: 500;
    color: var(--doc-text-subtle);
    vertical-align: middle;
    margin-left: 8px;
}

.doc-jump-chips {
    display: none;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 28px;
}

.doc-jump-chips a {
    display: inline-flex;
    align-items: center;
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--doc-text);
    background: var(--doc-bg);
    border: 1px solid var(--doc-border);
    border-radius: 999px;
    text-decoration: none;
    transition: color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.doc-jump-chips a:hover,
.doc-jump-chips a:focus-visible {
    color: var(--doc-accent);
    border-color: rgba(0, 123, 255, 0.4);
    box-shadow: 0 2px 8px var(--doc-shadow);
    outline: none;
}

.table-wrap {
    position: relative;
    overflow-x: auto;
    margin: 20px 0;
    border: 1px solid var(--doc-border);
    border-radius: 8px;
    -webkit-overflow-scrolling: touch;
}

.table-wrap::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 28px;
    pointer-events: none;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.9));
    opacity: 0;
    transition: opacity 0.2s;
}

.table-wrap.is-scrollable::after {
    opacity: 1;
}

.doc-content table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 480px;
}

.doc-content table thead {
    background-color: var(--doc-table-head);
}

.doc-content table tbody tr:nth-child(even) {
    background-color: var(--doc-table-stripe);
}

.doc-content table th,
.doc-content table td {
    padding: 10px 14px;
    border: 1px solid var(--doc-border);
    text-align: left;
    vertical-align: top;
}

.doc-content table th {
    font-weight: 600;
    color: var(--doc-text);
    white-space: nowrap;
}

.doc-content .info-box {
    padding: 18px 20px;
    margin: 20px 0;
    background-color: var(--doc-info-bg);
    border-left: 4px solid var(--doc-accent);
    border-radius: 6px;
}

.doc-content .info-box p:last-child,
.doc-content .info-box ul:last-child {
    margin-bottom: 0;
}

.section-nav {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--doc-border);
}

.section-nav a {
    flex: 1;
    max-width: 48%;
    padding: 14px 16px;
    border: 1px solid var(--doc-border);
    border-radius: 8px;
    text-decoration: none;
    color: var(--doc-text);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.section-nav a:hover,
.section-nav a:focus-visible {
    border-color: var(--doc-accent);
    box-shadow: 0 2px 8px var(--doc-shadow);
    outline: none;
}

.section-nav .nav-label {
    display: block;
    font-size: 12px;
    color: var(--doc-text-subtle);
    margin-bottom: 4px;
}

.section-nav .nav-next {
    text-align: right;
    margin-left: auto;
}

.search-box {
    margin-bottom: 16px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.search-box input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--doc-border);
    border-radius: 8px;
    font-size: 16px;
    background: var(--doc-bg);
    color: var(--doc-text);
}

.search-box input:focus-visible {
    outline: 2px solid var(--doc-accent);
    outline-offset: 1px;
}

.search-status {
    font-size: 12px;
    color: var(--doc-text-subtle);
    margin-top: 6px;
    min-height: 18px;
}

.search-results {
    max-height: 220px;
    overflow-y: auto;
    margin-top: 8px;
    display: none;
}

.search-results.visible {
    display: block;
}

.search-results button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    border: none;
    background: transparent;
    color: var(--doc-text);
    font-size: 13px;
    cursor: pointer;
    border-radius: 6px;
}

.search-results button:hover,
.search-results button:focus-visible,
.search-results button.is-active {
    background: var(--doc-hover-bg);
    outline: none;
}

.search-results button.is-active {
    box-shadow: inset 3px 0 0 var(--doc-accent);
}

.search-results .result-section {
    font-size: 11px;
    color: var(--doc-text-subtle);
    display: block;
    margin-top: 2px;
}

mark.search-highlight {
    background: var(--doc-search-highlight);
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
}

.doc-section-flash,
.doc-content h1.doc-section-flash,
.doc-content h2.doc-section-flash,
.doc-content h3.doc-section-flash {
    animation: doc-section-flash 1.5s ease;
}

@keyframes doc-section-flash {
    0% { background-color: var(--doc-search-highlight); }
    100% { background-color: transparent; }
}

.doc-toast {
    position: fixed;
    left: 50%;
    bottom: 88px;
    transform: translateX(-50%) translateY(12px);
    background: #1f2937;
    color: #fff;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10002;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.doc-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

body.cookie-notice-visible .doc-toast {
    bottom: 128px;
}

.doc-extras-toggle-cell {
    display: none;
}

.doc-extras-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    color: var(--doc-accent);
    font-size: 13px;
    font-weight: 600;
    padding: 0;
    cursor: pointer;
}

.doc-extras-toggle:focus-visible {
    outline: 2px solid var(--doc-accent);
    outline-offset: 2px;
    border-radius: 4px;
}

.section {
    scroll-margin-top: var(--doc-scroll-margin);
}

.doc-content h2,
.doc-content h3 {
    scroll-margin-top: var(--doc-scroll-margin);
}

.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--doc-accent);
    color: #fff;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--doc-shadow);
    z-index: 999;
    border: none;
    transition: transform 0.2s, background 0.2s, bottom 0.2s;
}

.back-to-top.show {
    display: flex;
}

.back-to-top:hover,
.back-to-top:focus-visible {
    background: var(--doc-accent-hover);
    transform: translateY(-2px);
    outline: none;
}

body.cookie-notice-visible .back-to-top {
    bottom: 70px;
}

.doc-mobile-toolbar {
    display: none;
}

.doc-sidebar-backdrop {
    display: none;
}

body.doc-sidebar-open {
    overflow: hidden;
}

@media (max-width: 991px) {
    .doc-wrapper {
        padding-top: 0;
    }

    .doc-mobile-toolbar {
        display: flex;
        align-items: center;
        position: sticky;
        top: var(--doc-header-offset);
        margin-top: var(--doc-header-offset);
        z-index: 998;
        background: rgba(255, 255, 255, 0.96);
        border-bottom: 1px solid var(--doc-border);
        padding: 8px 12px;
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
    }

    .mobile-menu-toggle {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        background: var(--doc-accent);
        color: #fff;
        border: none;
        padding: 9px 14px;
        border-radius: 8px;
        cursor: pointer;
        font-size: 14px;
        font-weight: 600;
        line-height: 1;
    }

    .mobile-menu-toggle:focus-visible {
        outline: 2px solid var(--doc-accent-hover);
        outline-offset: 2px;
    }

    .doc-sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.35);
        z-index: 1000;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.25s, visibility 0.25s;
    }

    .doc-sidebar-backdrop.visible {
        opacity: 1;
        visibility: visible;
    }

    .doc-sidebar {
        left: -280px;
        top: var(--doc-header-offset);
        transition: left 0.3s;
        z-index: 1001;
        box-shadow: 4px 0 20px var(--doc-shadow);
    }

    .doc-sidebar.mobile-open {
        left: 0;
    }

    .doc-content {
        margin-left: 0;
        padding: 20px 20px 60px;
    }

    .doc-jump-chips {
        display: flex;
    }

    .ui-label {
        display: block;
        font-size: 13px;
        margin: 6px 0 0;
        line-height: 1.4;
    }

    .section-nav {
        flex-direction: column;
    }

    .section-nav a {
        max-width: 100%;
    }

    .section-nav .nav-next {
        text-align: left;
    }

    .section {
        scroll-margin-top: calc(var(--doc-header-offset) + 56px);
    }

    .doc-content h2,
    .doc-content h3 {
        scroll-margin-top: calc(var(--doc-header-offset) + 56px);
    }

    .heading-anchor {
        opacity: 0.55;
    }

    .heading-anchor:hover,
    .heading-anchor:focus-visible {
        opacity: 1;
        color: var(--doc-accent);
    }
}

@media (max-width: 767px) {
    .table-wrap {
        overflow-x: visible;
        border: none;
        border-radius: 0;
        background: transparent;
    }

    .table-wrap::after {
        display: none;
    }

    .doc-content table {
        min-width: 0;
        border-collapse: separate;
        border-spacing: 0 12px;
        font-size: 15px;
    }

    .doc-content table thead {
        display: none;
    }

    .doc-content table tbody,
    .doc-content table tr,
    .doc-content table td {
        display: block;
        width: 100%;
    }

    .doc-content table tbody tr {
        background: var(--doc-bg);
        border: 1px solid var(--doc-border);
        border-radius: 8px;
        margin: 0;
        overflow: hidden;
        box-shadow: 0 1px 3px var(--doc-shadow);
    }

    .doc-content table tbody tr:nth-child(even) {
        background: var(--doc-table-stripe);
    }

    .doc-content table th,
    .doc-content table td {
        border: none;
        border-bottom: 1px solid var(--doc-border);
        padding: 10px 14px;
        white-space: normal;
    }

    .doc-content table td:last-child {
        border-bottom: none;
    }

    .doc-content table td::before {
        content: attr(data-label);
        display: block;
        font-size: 11px;
        font-weight: 700;
        color: var(--doc-text-subtle);
        text-transform: uppercase;
        letter-spacing: 0.03em;
        margin-bottom: 4px;
    }

    .doc-content table td:first-child {
        font-weight: 600;
        color: var(--doc-text);
        background: var(--doc-table-head);
    }

    .doc-content table td.doc-table-extra {
        display: none;
    }

    .doc-content table tr.extras-open td.doc-table-extra {
        display: block;
    }

    .doc-extras-toggle-cell {
        display: block;
        border-bottom: none !important;
        background: transparent;
        padding: 8px 14px 12px !important;
    }

    .doc-extras-toggle-cell::before {
        content: none !important;
        display: none !important;
    }

    .doc-content table tr:not(.extras-open) td.doc-keep-field:last-of-type {
        border-bottom: none;
    }
}

@media (max-width: 575px) {
    .doc-content {
        padding: 16px 14px 56px;
    }

    .doc-jump-chips {
        gap: 6px;
        margin-bottom: 20px;
    }

    .doc-jump-chips a {
        font-size: 12px;
        padding: 6px 10px;
    }

    .doc-content .info-box {
        padding: 14px 14px;
    }

    .back-to-top {
        right: 16px;
        bottom: 20px;
    }

    body.cookie-notice-visible .back-to-top {
        bottom: 60px;
    }
}
