#rdmc-theme-toggle {
    position: fixed;
    bottom: 18px;
    right: 18px;
    z-index: 10000;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.15);
    background: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    transition: transform 0.15s ease-in-out, background 0.2s ease-in-out;
}

#rdmc-theme-toggle:hover {
    transform: scale(1.1);
}

html[data-theme="dark"] #rdmc-theme-toggle {
    background: #2d2d2d;
    border-color: rgba(255, 255, 255, 0.2);
}

html[data-theme="dark"] {
    --rdmc-bg: #1a1c1e;
    --rdmc-bg-alt: #22262a;
    --rdmc-bg-code: #262b30;
    --rdmc-text: #d6d8da;
    --rdmc-text-muted: #9aa0a6;
    --rdmc-border: #3c4248;
    --rdmc-link: #6cb2f7;
    --rdmc-link-hover: #9ccdfb;
    color-scheme: dark;
}

html[data-theme="dark"] body,
html[data-theme="dark"] .wy-body-for-nav,
html[data-theme="dark"] .wy-nav-content-wrap,
html[data-theme="dark"] .wy-nav-content {
    background: var(--rdmc-bg) !important;
    color: var(--rdmc-text) !important;
}

html[data-theme="dark"] .rst-content h1,
html[data-theme="dark"] .rst-content h2,
html[data-theme="dark"] .rst-content h3,
html[data-theme="dark"] .rst-content h4,
html[data-theme="dark"] .rst-content h5,
html[data-theme="dark"] .rst-content h6,
html[data-theme="dark"] .rst-content p,
html[data-theme="dark"] .rst-content li,
html[data-theme="dark"] .rst-content dt {
    color: var(--rdmc-text) !important;
}

html[data-theme="dark"] .rst-content a,
html[data-theme="dark"] a {
    color: var(--rdmc-link);
}

html[data-theme="dark"] .rst-content a:hover,
html[data-theme="dark"] a:hover {
    color: var(--rdmc-link-hover);
}

html[data-theme="dark"] .wy-nav-side,
html[data-theme="dark"] .wy-menu-vertical {
    background: #15171a !important;
}

html[data-theme="dark"] .wy-menu-vertical a {
    color: #b9bdc1 !important;
}

html[data-theme="dark"] .wy-menu-vertical a:hover {
    background: #2a2f34 !important;
}

html[data-theme="dark"] .wy-menu-vertical li.current {
    background: var(--rdmc-bg-alt) !important;
}

html[data-theme="dark"] .wy-menu-vertical li.current > a,
html[data-theme="dark"] .wy-menu-vertical li.toctree-l1.current > a {
    background: var(--rdmc-bg-alt) !important;
    color: var(--rdmc-text) !important;
    border-color: var(--rdmc-border) !important;
}

html[data-theme="dark"] .wy-menu-vertical li.current a {
    color: #b9bdc1 !important;
    border-color: var(--rdmc-border) !important;
}

html[data-theme="dark"] .wy-menu-vertical li.current a:hover {
    background: #2a2f34 !important;
}

html[data-theme="dark"] .wy-menu-vertical li.toctree-l2.current > a,
html[data-theme="dark"] .wy-menu-vertical li.toctree-l2.current li.toctree-l3 > a,
html[data-theme="dark"] .wy-menu-vertical li.toctree-l3.current > a,
html[data-theme="dark"] .wy-menu-vertical li.toctree-l3.current li.toctree-l4 > a,
html[data-theme="dark"] .wy-menu-vertical li.toctree-l4.current > a,
html[data-theme="dark"] .wy-menu-vertical li.toctree-l4.current li.toctree-l5 > a,
html[data-theme="dark"] .wy-menu-vertical li.toctree-l5.current > a {
    background: #2a2f34 !important;
    color: #d6d8da !important;
}

html[data-theme="dark"] .wy-menu-vertical li.toctree-l2.current li.toctree-l3 > a:hover,
html[data-theme="dark"] .wy-menu-vertical li.toctree-l3.current li.toctree-l4 > a:hover,
html[data-theme="dark"] .wy-menu-vertical li.toctree-l4.current li.toctree-l5 > a:hover {
    background: #343a40 !important;
}

html[data-theme="dark"] .wy-menu-vertical li.on a,
html[data-theme="dark"] .wy-menu-vertical li.current > a {
    background: #2a2f34 !important;
    color: #ffffff !important;
    border-color: var(--rdmc-border) !important;
}

html[data-theme="dark"] .wy-menu-vertical a:active,
html[data-theme="dark"] .wy-menu-vertical li.on a:hover,
html[data-theme="dark"] .wy-menu-vertical li.current > a:hover {
    background: #343a40 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .wy-menu-vertical li.current > a button.toctree-expand,
html[data-theme="dark"] .wy-menu-vertical li button.toctree-expand {
    color: #9aa0a6 !important;
}

html[data-theme="dark"] .wy-side-nav-search input[type="text"] {
    background: var(--rdmc-bg-alt);
    color: var(--rdmc-text);
    border-color: var(--rdmc-border);
}

html[data-theme="dark"] .wy-breadcrumbs li,
html[data-theme="dark"] .wy-breadcrumbs li a,
html[data-theme="dark"] footer,
html[data-theme="dark"] footer p,
html[data-theme="dark"] .rst-footer-buttons {
    color: var(--rdmc-text-muted) !important;
}

html[data-theme="dark"] .rst-footer-buttons .btn {
    background: var(--rdmc-bg-alt);
    color: var(--rdmc-text);
    border: 1px solid var(--rdmc-border);
    box-shadow: none;
}

html[data-theme="dark"] .rst-content div[class^="highlight"],
html[data-theme="dark"] .rst-content pre.literal-block {
    background: var(--rdmc-bg-code) !important;
    border-color: var(--rdmc-border) !important;
}

html[data-theme="dark"] .highlight {
    background: var(--rdmc-bg-code) !important;
}

html[data-theme="dark"] .highlight pre,
html[data-theme="dark"] .rst-content pre.literal-block {
    color: #e8eaed !important;
}

html[data-theme="dark"] .highlight .c,
html[data-theme="dark"] .highlight .c1,
html[data-theme="dark"] .highlight .cm { color: #7f8b99 !important; }
html[data-theme="dark"] .highlight .k,
html[data-theme="dark"] .highlight .kn,
html[data-theme="dark"] .highlight .kd { color: #c792ea !important; }
html[data-theme="dark"] .highlight .s,
html[data-theme="dark"] .highlight .s1,
html[data-theme="dark"] .highlight .s2 { color: #a5d6a7 !important; }
html[data-theme="dark"] .highlight .n { color: #e8eaed !important; }
html[data-theme="dark"] .highlight .nb,
html[data-theme="dark"] .highlight .nf { color: #82aaff !important; }
html[data-theme="dark"] .highlight .m,
html[data-theme="dark"] .highlight .mi { color: #f78c6c !important; }
html[data-theme="dark"] .highlight .o,
html[data-theme="dark"] .highlight .p { color: #b0bec5 !important; }
html[data-theme="dark"] .highlight .nv,
html[data-theme="dark"] .highlight .vg { color: #ffcb6b !important; }
html[data-theme="dark"] .highlight .gp { color: #7f8b99 !important; }

html[data-theme="dark"] .rst-content code.literal,
html[data-theme="dark"] .rst-content tt.literal {
    background: var(--rdmc-bg-code) !important;
    color: #f48fb1 !important;
    border-color: var(--rdmc-border) !important;
}

html[data-theme="dark"] .rst-content table.docutils,
html[data-theme="dark"] .wy-table-bordered-all {
    border-color: var(--rdmc-border) !important;
}

html[data-theme="dark"] .rst-content table.docutils td,
html[data-theme="dark"] .rst-content table.docutils th,
html[data-theme="dark"] .wy-table-bordered-all td {
    border-color: var(--rdmc-border) !important;
    color: var(--rdmc-text) !important;
}

html[data-theme="dark"] .rst-content table.docutils thead th,
html[data-theme="dark"] .wy-table thead th {
    background: var(--rdmc-bg-alt) !important;
    color: var(--rdmc-text) !important;
}

html[data-theme="dark"] .wy-table-odd td,
html[data-theme="dark"] .wy-table-striped tr:nth-child(2n-1) td,
html[data-theme="dark"] .rst-content table.docutils:not(.field-list) tr:nth-child(2n-1) td {
    background: var(--rdmc-bg-alt) !important;
}

html[data-theme="dark"] .scrollable-table {
    border-color: var(--rdmc-border);
}

html[data-theme="dark"] .rst-content .admonition,
html[data-theme="dark"] .rst-content .note,
html[data-theme="dark"] .rst-content .warning,
html[data-theme="dark"] .rst-content .tip,
html[data-theme="dark"] .rst-content .important,
html[data-theme="dark"] .rst-content .caution,
html[data-theme="dark"] .rst-content .danger,
html[data-theme="dark"] .rst-content .error,
html[data-theme="dark"] .rst-content .hint,
html[data-theme="dark"] .rst-content .seealso {
    background: var(--rdmc-bg-alt) !important;
    color: var(--rdmc-text) !important;
}

html[data-theme="dark"] .rst-content .admonition p,
html[data-theme="dark"] .rst-content .admonition li {
    color: var(--rdmc-text) !important;
}

html[data-theme="dark"] details.sd-dropdown,
html[data-theme="dark"] .sd-card {
    background: var(--rdmc-bg-alt) !important;
    border-color: var(--rdmc-border) !important;
    color: var(--rdmc-text) !important;
}

html[data-theme="dark"] details.sd-dropdown summary.sd-summary-title {
    background: #2a2f34 !important;
    color: var(--rdmc-text) !important;
}

html[data-theme="dark"] details.sd-dropdown .sd-summary-content {
    background: var(--rdmc-bg-alt) !important;
    color: var(--rdmc-text) !important;
}

html[data-theme="dark"] .sd-tab-set > label {
    color: var(--rdmc-text-muted) !important;
}

html[data-theme="dark"] .sd-tab-set > input:checked + label {
    color: var(--rdmc-link) !important;
    border-color: var(--rdmc-link) !important;
}

html[data-theme="dark"] .sd-tab-content {
    background: var(--rdmc-bg) !important;
    border-color: var(--rdmc-border) !important;
    box-shadow: 0 -0.0625rem var(--rdmc-border),
                0 0.0625rem var(--rdmc-border) !important;
}

html[data-theme="dark"] .sphinx-tabs-panel {
    background: var(--rdmc-bg-alt) !important;
    border-color: var(--rdmc-border) !important;
    color: var(--rdmc-text) !important;
}

html[data-theme="dark"] .sphinx-tabs-tab {
    background: var(--rdmc-bg) !important;
    color: var(--rdmc-text-muted) !important;
    border-color: var(--rdmc-border) !important;
}

html[data-theme="dark"] .sphinx-tabs-tab[aria-selected="true"] {
    background: var(--rdmc-bg-alt) !important;
    color: var(--rdmc-link) !important;
}

html[data-theme="dark"] button.copybtn {
    background: var(--rdmc-bg-alt) !important;
    border-color: var(--rdmc-border) !important;
}

html[data-theme="dark"] .rst-content .highlighted {
    background: #5c4800 !important;
    color: #ffe082 !important;
    box-shadow: 0 0 0 2px #5c4800 !important;
}

html[data-theme="dark"] .wy-nav-top {
    background: #15171a !important;
}

html[data-theme="dark"] .rst-content img {
    filter: brightness(0.9);
}

html[data-theme="dark"] #zoom-container img {
    filter: none;
}

html[data-theme="dark"] .rst-content hr {
    border-color: var(--rdmc-border) !important;
}

html[data-theme="dark"] .wy-side-nav-search > div.version {
    color: var(--rdmc-text-muted) !important;
}
