/* Dark Theme for APCloudy Documentation - Read the Docs Compatible */

/* Root variables for consistent dark theme colors */
:root {
    --bg-color: #1a1a1a;
    --content-bg: #2d2d2d;
    --sidebar-bg: #252525;
    --text-color: #e0e0e0;
    --text-muted: #b0b0b0;
    --link-color: #66d9ff;
    --link-hover: #4dc3ff;
    --border-color: #404040;
    --code-bg: #1e1e1e;
    --code-border: #404040;
    --header-bg: #1f2937;
    --accent-color: #10b981;
}

/* Force dark theme on all elements */
html[data-theme="dark"],
html.dark,
.wy-body-for-nav,
body {
    background-color: var(--bg-color) !important;
    color: var(--text-color) !important;
}

/* Navigation sidebar - more specific selectors */
.wy-grid-for-nav .wy-nav-side {
    background: var(--sidebar-bg) !important;
    border-right: 1px solid var(--border-color) !important;
}

.wy-nav-side .wy-side-scroll {
    background-color: var(--sidebar-bg) !important;
}

.wy-side-nav-search {
    background-color: var(--header-bg) !important;
    border-bottom: 1px solid var(--border-color) !important;
}

.wy-side-nav-search input[type=text] {
    background-color: var(--code-bg) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-color) !important;
}

.wy-side-nav-search input[type=text]:focus {
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 0 1px var(--accent-color) !important;
}

.wy-side-nav-search .wy-dropdown > a,
.wy-side-nav-search > a {
    color: var(--text-color) !important;
}

/* Navigation menu items - more specific */
.wy-menu-vertical li a {
    color: var(--text-color) !important;
    background-color: transparent !important;
}

.wy-menu-vertical li a:hover {
    background-color: var(--border-color) !important;
    color: var(--link-hover) !important;
}

.wy-menu-vertical li.current a {
    background-color: var(--accent-color) !important;
    color: #ffffff !important;
    border-right: none !important;
}

.wy-menu-vertical li.current > a {
    background-color: var(--accent-color) !important;
    border: none !important;
}

.wy-menu-vertical li.toctree-l2.current > a {
    background-color: rgba(16, 185, 129, 0.8) !important;
}

.wy-menu-vertical li.toctree-l3.current > a {
    background-color: rgba(16, 185, 129, 0.6) !important;
}

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

/* Main content area - FIX WIDTH ISSUES */
.wy-nav-content-wrap {
    background-color: var(--bg-color) !important;
    width: 100% !important;
    margin-left: 0 !important;
}

.wy-nav-content {
    background-color: var(--content-bg) !important;
    color: var(--text-color) !important;
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 1.618em 3.236em !important;
}

/* Ensure full width for desktop */
@media screen and (min-width: 769px) {
    .wy-nav-content-wrap {
        margin-left: 300px !important;
        width: calc(100% - 300px) !important;
    }

    .wy-nav-content {
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
    }
}

/* Responsive layout adjustments */
@media screen and (max-width: 768px) {
    .wy-nav-content-wrap {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .wy-nav-content {
        width: 100% !important;
        padding: 1.618em 1em !important;
    }
}

.rst-content {
    color: var(--text-color) !important;
    background-color: transparent !important;
    width: 100% !important;
    max-width: none !important;
}

.document {
    background-color: var(--content-bg) !important;
    width: 100% !important;
}

/* Section content should use full width */
.section {
    width: 100% !important;
    max-width: none !important;
}

/* Headers with more specificity */
.rst-content h1,
.rst-content h2,
.rst-content h3,
.rst-content h4,
.rst-content h5,
.rst-content h6,
h1, h2, h3, h4, h5, h6 {
    color: var(--text-color) !important;
}

.rst-content h1 {
    border-bottom: 2px solid var(--accent-color) !important;
    padding-bottom: 0.3em !important;
}

.rst-content h2 {
    border-bottom: 1px solid var(--border-color) !important;
    padding-bottom: 0.2em !important;
}

/* Links with higher specificity */
.rst-content a:link,
.rst-content a:visited,
.rst-content a,
a {
    color: var(--link-color) !important;
}

.rst-content a:hover,
a:hover {
    color: var(--link-hover) !important;
    text-decoration: underline !important;
}

/* Code blocks with high specificity */
.rst-content pre,
.rst-content code,
pre, code {
    background-color: var(--code-bg) !important;
    border: 1px solid var(--code-border) !important;
    color: var(--text-color) !important;
}

.rst-content .highlight,
.highlight {
    background-color: var(--code-bg) !important;
}

.rst-content .highlight pre,
.highlight pre {
    background-color: var(--code-bg) !important;
    border: 1px solid var(--code-border) !important;
    color: var(--text-color) !important;
}

/* Inline code with more specificity */
.rst-content code.literal,
.rst-content .literal,
code.literal {
    background-color: var(--code-bg) !important;
    border: 1px solid var(--code-border) !important;
    color: var(--accent-color) !important;
    padding: 2px 4px !important;
    border-radius: 3px !important;
}

/* Tables with high specificity */
.rst-content table.docutils,
.rst-content table,
table {
    border: 1px solid var(--border-color) !important;
    background-color: var(--content-bg) !important;
    width: 100% !important;
}

.rst-content table.docutils thead,
.rst-content table thead,
table thead {
    background-color: var(--header-bg) !important;
}

.rst-content table.docutils th,
.rst-content table.docutils td,
.rst-content table th,
.rst-content table td,
table th, table td {
    border: 1px solid var(--border-color) !important;
    color: var(--text-color) !important;
    background-color: transparent !important;
}

.rst-content table.docutils th,
.rst-content table th,
table th {
    background-color: var(--header-bg) !important;
    font-weight: bold !important;
}

/* Admonitions (notes, warnings, etc.) */
.rst-content .admonition,
.admonition {
    background-color: var(--content-bg) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-color) !important;
}

.rst-content .admonition .admonition-title,
.admonition .admonition-title {
    background-color: var(--header-bg) !important;
    color: var(--text-color) !important;
}

.rst-content .note {
    border-left: 4px solid #3498db !important;
}

.rst-content .warning {
    border-left: 4px solid #f39c12 !important;
}

.rst-content .danger {
    border-left: 4px solid #e74c3c !important;
}

.rst-content .tip {
    border-left: 4px solid var(--accent-color) !important;
}

/* Breadcrumbs */
.wy-breadcrumbs,
.wy-breadcrumbs-aside {
    background-color: var(--content-bg) !important;
    border-bottom: 1px solid var(--border-color) !important;
}

.wy-breadcrumbs a {
    color: var(--link-color) !important;
}

.wy-breadcrumbs li {
    color: var(--text-color) !important;
}

/* Footer and pagination */
.rst-footer-buttons {
    border-top: 1px solid var(--border-color) !important;
}

.btn,
.btn-neutral {
    background-color: var(--header-bg) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-color) !important;
}

.btn:hover,
.btn-neutral:hover {
    background-color: var(--accent-color) !important;
    color: #ffffff !important;
}

/* Search results */
.rst-content .search li {
    border-bottom: 1px solid var(--border-color) !important;
}

.rst-content .highlighted {
    background-color: var(--accent-color) !important;
    color: #ffffff !important;
    padding: 2px 4px !important;
    border-radius: 3px !important;
}

/* Version selector and RTD elements */
.rst-versions {
    background-color: var(--header-bg) !important;
    border-top: 1px solid var(--border-color) !important;
    color: var(--text-color) !important;
}

.rst-versions a {
    color: var(--link-color) !important;
}

.rst-versions .rst-current-version {
    background-color: var(--header-bg) !important;
    color: var(--text-color) !important;
}

/* Scrollbars for webkit browsers */
::-webkit-scrollbar {
    width: 8px !important;
    height: 8px !important;
}

::-webkit-scrollbar-track {
    background: var(--bg-color) !important;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color) !important;
    border-radius: 4px !important;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted) !important;
}

/* Copy button styling */
.copybtn {
    background-color: var(--header-bg) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-color) !important;
}

.copybtn:hover {
    background-color: var(--accent-color) !important;
    color: #ffffff !important;
}

/* API documentation specific styling */
.rst-content dl dt {
    background-color: var(--header-bg) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-color) !important;
}

.rst-content dl dd {
    background-color: var(--content-bg) !important;
    border: 1px solid var(--border-color) !important;
    border-top: none !important;
}

/* Method signatures */
.rst-content .sig {
    background-color: var(--code-bg) !important;
    border: 1px solid var(--code-border) !important;
}

.rst-content .sig-name {
    color: var(--accent-color) !important;
}

.rst-content .sig-param {
    color: var(--text-color) !important;
}

/* Field lists (parameters, returns, etc.) */
.rst-content .field-list th {
    background-color: var(--header-bg) !important;
    color: var(--text-color) !important;
    border: 1px solid var(--border-color) !important;
}

.rst-content .field-list td {
    background-color: var(--content-bg) !important;
    color: var(--text-color) !important;
    border: 1px solid var(--border-color) !important;
}

/* Ensure text elements are properly colored */
p, span, div, li {
    color: var(--text-color) !important;
}

/* Force dark background on any remaining light elements */
.wy-nav-top {
    background: var(--header-bg) !important;
    color: var(--text-color) !important;
}

/* Content wrapper improvements */
.wy-grid-for-nav {
    background-color: var(--bg-color) !important;
}

/* Ensure proper spacing and layout */
.rst-content .toctree-wrapper p.caption {
    color: var(--text-color) !important;
}

/* Fix any remaining width constraints */
.rst-content .line-block,
.rst-content .docutils,
.rst-content .body {
    width: 100% !important;
    max-width: none !important;
}
