/* Custom Sphinx theme styling */

body {
    background-color: var(--background-color);
    color: var(--text-color);
}

/* Highlighted text color */
.highlight,
.green {
    color: var(--highlight-color);
}

/* Homepage title */
.rst-content h1 {
    color: var(--highlight-color) !important;
}

/* Section headlines font color */
.rst-content h2,
.rst-content h3,
.rst-content h4,
.rst-content h5,
.rst-content h6 {
    color: var(--heading-color) !important;
}

/* All regular text */
.rst-content p,
.rst-content li,
.rst-content dl,
.rst-content table,
.rst-content code {
    color: var(--text-color);
}

/* Left drawer background color */
.wy-nav-side {
    background-color: var(--sidebar-background);
}

.wy-side-nav-search,
.wy-menu-vertical {
    background-color: var(--sidebar-background);
}

/* Central panel background color */
.wy-nav-content,
.wy-nav-content-wrap {
    background-color: var(--background-color);
    max-width: none;
}

/* Adjust link colors to match the theme */
a,
a:visited {
    color: var(--link-color);
}

a:hover {
    color: var(--link-hover-color);
}

/* Fix code block background */
.highlight {
    background: var(--code-background);
}

/* Navigation links in sidebar */
.wy-menu-vertical a {
    color: var(--text-color);
}

.wy-menu-vertical a:hover {
    background-color: var(--menu-hover-background);
}

/* Search box */
.wy-side-nav-search input[type="text"] {
    border-color: var(--text-color-lighter);
    background-color: var(--sidebar-background);
    color: var(--text-color);
    box-shadow: none;
    padding-top: 10px;
    padding-bottom: 10px;
}

/* Table of contents links */
.toctree-l1,
.toctree-l2,
.toctree-l3 {
    color: var(--text-color);
}

/* Fix table styles */
.rst-content table.docutils {
    background-color: var(--table-background);
    width: 100%;
    table-layout: fixed;
    word-wrap: break-word;
}

.rst-content table.docutils td {
    white-space: normal;
    word-break: break-word;
}

/* Fix footer color */
footer {
    color: var(--text-color);
}

/* Fix navigation panel text */
.wy-nav-top {
    background-color: var(--sidebar-background);
    color: var(--heading-color);
}

/* Adjust search highlight */
.highlighted {
    background-color: rgba(34, 221, 136, 0.2);
}

.wy-menu-vertical li.current>a,
.wy-menu-vertical li.on a {
    background-color: var(--background-color);
    color: var(--highlight-color);
}

.wy-menu-vertical li.toctree-l1.current>a {
    border-bottom: none;
    border-top: none;
}

.wy-body-for-nav {
    background-color: var(--background-color);
}

.btn-neutral {
    background-color: var(--text-color-lighter) !important;
}

[data-theme="dark"] .btn-neutral,
[data-theme="dark"] .btn-neutral:visited {
    background-color: var(--link-color) !important;
}

.btn-neutral:hover,
[data-theme="dark"] .btn-neutral:hover,
[data-theme="dark"] .btn-neutral:visited:hover {
    background-color: var(--link-hover-color) !important;
}

.wy-menu-vertical li.current {
    background: none;
}

.wy-menu-vertical li.toctree-l2 a,
.wy-menu-vertical li.toctree-l3 a,
.wy-menu-vertical li.toctree-l4 a,
.wy-menu-vertical li.toctree-l5 a,
.wy-menu-vertical li.toctree-l6 a,
.wy-menu-vertical li.toctree-l7 a,
.wy-menu-vertical li.toctree-l8 a,
.wy-menu-vertical li.toctree-l9 a,
.wy-menu-vertical li.toctree-l10 a {
    color: var(--text-color);
}

.wy-menu-vertical li.toctree-l2.current>a,
.wy-menu-vertical li.toctree-l2.current li.toctree-l3.current>a {
    background-color: transparent;
    color: var(--heading-color);
}

.wy-menu-vertical li.toctree-l2.current>a,
.wy-menu-vertical li.toctree-l2.current li.toctree-l3>a {
    background-color: transparent;
}

.wy-menu-vertical li.current a:hover {
    background-color: var(--menu-hover-background);
}

.wy-menu-vertical li.current a {
    border-right: none;
}

.wy-menu-vertical li.toctree-l3.current>a,
.wy-menu-vertical li.toctree-l3.current li.toctree-l4>a {
    background: var(--menu-hover-background);
}

/* Theme switcher button */
.theme-toggle {
    position: absolute;
    top: 1rem;
    right: 2rem;
    z-index: 1000;
    width: 36px;
    height: 36px;
    background-color: var(--heading-color);
    color: #000000;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    padding: 0;
}

.theme-toggle:hover {
    background-color: var(--link-hover-color);
    transform: scale(1.05);
}

.theme-toggle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle-icon svg {
    stroke: #000000;
    stroke-width: 2;
    transition: transform 0.3s ease;
}

[data-theme="dark"] .theme-toggle {
    background-color: var(--highlight-color);
}

[data-theme="dark"] .theme-toggle-icon svg {
    stroke: #000000;
}

img.logo {
    filter: brightness(0) saturate(100%);
    margin-left: 0;
}

[data-theme="dark"] img.logo {
    filter: brightness(0) invert(1) saturate(100%);
}

.wy-side-nav-search {
    text-align: left;
    border-bottom: 1px solid var(--text-color-lighter);
    padding-bottom: 25px;

    >a img.logo {
        height: 34px;
    }
}

div[role="navigation"][aria-label="Page navigation"]>hr {
    border-top: 1px solid var(--text-color-lighter) !important;
}

.rst-content table.docutils:not(.field-list) tr:nth-child(2n-1) td,
.wy-table-backed,
.wy-table-odd td,
.wy-table-striped tr:nth-child(2n-1) td {
    background-color: var(--background-color);
}

[data-theme="dark"] .rst-content .hint,
[data-theme="dark"] .rst-content .important,
[data-theme="dark"] .rst-content .tip,
[data-theme="dark"] .rst-content .wy-alert-success.admonition,
[data-theme="dark"] .rst-content .wy-alert-success.admonition-todo,
[data-theme="dark"] .rst-content .wy-alert-success.attention,
[data-theme="dark"] .rst-content .wy-alert-success.caution,
[data-theme="dark"] .rst-content .wy-alert-success.danger,
[data-theme="dark"] .rst-content .wy-alert-success.error,
[data-theme="dark"] .rst-content .wy-alert-success.note,
[data-theme="dark"] .rst-content .wy-alert-success.seealso,
[data-theme="dark"] .rst-content .wy-alert-success.warning,
[data-theme="dark"] .wy-alert.wy-alert-success {
    background: var(--note-background);
}
