/* Navbar Toggle Button */
.quicklink-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.quick-links-navbar {
    position: fixed;
    top: 8px;
    right: 15px;
    z-index: 9998;
    background: #fffef5;
    padding: 6px 12px;
    display: flex;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 12px;
    border: 2px solid #d4af37;
    overflow: hidden;
}

.quick-links-navbar a {
    color: #c0504d;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.2s;
    white-space: nowrap;
    background: transparent;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quick-links-navbar a:hover {
    background: #c0504d;
    color: white;
    text-decoration: none;
    border-color: #d4af37;
}

.quick-links-navbar a:hover .quicklink-icon {
    filter: brightness(0) invert(1);
}

.navbar-toggle-btn {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 9999;
    background: #c0504d;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: background 0.2s, left 0.3s;
}

.navbar-toggle-btn:hover {
    background: #a0403d;
}

/* When sidebar is visible, position button at edge of sidebar */
body:not(.nav-hidden) .navbar-toggle-btn {
    left: 310px;
}


@media (min-width: 769px) {
    body.nav-hidden .wy-nav-side {
        transform: translateX(-100%);
    }

    body.nav-hidden .wy-nav-content-wrap {
        margin-left: 0 !important;
    }

    body.nav-hidden .wy-nav-content {
        max-width: 100% !important;
        padding: 2rem 4rem !important;
    }

    body.nav-hidden .navbar-toggle-btn {
        left: 10px;
    }
}


.wy-nav-side {
    transition: transform 0.3s ease;
}

.wy-nav-content-wrap {
    transition: margin-left 0.3s ease;
}

/* Main body and content */
body, .wy-body-for-nav {
    background-color: #fffef5 !important; /* Light yellow */
    color: #404040 !important;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
}

.wy-nav-content-wrap {
    background-color: #fffef5 !important; /* Light yellow */
}

.wy-nav-content {
    background-color: #ffffff !important;
    max-width: 90% !important;
    transition: max-width 0.3s ease, padding 0.3s ease;
}

.rst-content {
    color: #404040 !important;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif !important;
    font-size: 16px !important;
    line-height: 1.7 !important;
}

/* Paragraphs */
p {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif !important;
    font-size: 16px !important;
    line-height: 1.7 !important;
}

/* Sidebar */
.wy-nav-side {
    background-color: #fffef0 !important;
    border-right: 1px solid #e0e0e0 !important;
}

.wy-side-nav-search {
    background-color: #c0504d !important; /* Brick red */
    border-bottom: 1px solid #a0403d !important;
}

.wy-side-nav-search > a {
    color: #ffffff !important;
    font-weight: bold !important;
}

.wy-side-nav-search input[type="text"] {
    border: 1px solid #d0d0d0 !important;
    background-color: #ffffff !important;
    color: #404040 !important;
}

/* Sidebar navigation */
.wy-menu-vertical a {
    color: #404040 !important;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif !important;
}

.wy-menu-vertical a:hover {
    background-color: #f0f0f0 !important;
    color: #d9534f !important;
}

.wy-menu-vertical li.current a {
    color: #c0504d !important; /* Brick red */
    background-color: #fff9e6 !important;
    border-right: 3px solid #c0504d !important;
}

.wy-menu-vertical li.current > a {
    background-color: #fff9e6 !important;
    border: none !important;
    border-right: 3px solid #c0504d !important;
}

.wy-menu-vertical li.on a, .wy-menu-vertical li.current > a {
    background-color: #fff9e6 !important;
}

.wy-menu-vertical p.caption {
    color: #808080 !important;
}

/* Links */
a {
    color: #c0504d !important;
}

a:hover {
    color: #CB9D06 !important;
}

.rst-content a:visited {
    color: #904040 !important;
}

/* Headings*/
h1, h2, h3, h4, h5, h6,
.rst-content h1, .rst-content h2, .rst-content h3, 
.rst-content h4, .rst-content h5, .rst-content h6 {
    color: #c0504d !important;
    background-color: #fff9e6 !important;
    padding: 8px 12px !important;
    border-left: 5px solid #c0504d !important;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif !important;
    font-weight: 600 !important;
    letter-spacing: -0.01em !important;
}

/* Code blocks */
pre, code, .rst-content code, .rst-content pre {
    background-color: #f8f8f8 !important;
    color: #333333 !important;
    border: 1px solid #e0e0e0 !important;
    font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace !important;
    font-size: 15px !important;
}

.highlight {
    background-color: #f8f8f8 !important;
}

/* Inline code */
code.literal {
    background-color: #f0f0f0 !important;
    color: #c9302c !important;
    padding: 2px 4px !important;
    border-radius: 3px !important;
}

/* Buttons */
.btn, .btn-neutral, .rst-content .btn, .rst-content .btn-neutral,
.wy-btn, .rst-content .wy-btn, a.btn, a.btn-neutral {
    background-color: #c0504d !important;
    color: #ffffff !important;
    border: none !important;
}

.btn:hover, .btn-neutral:hover, .rst-content .btn:hover, 
.rst-content .btn-neutral:hover, a.btn:hover, a.btn-neutral:hover {
    background-color: #a0403d !important;
    color: #ffffff !important;
}

.btn:visited, .btn-neutral:visited, a.btn:visited, a.btn-neutral:visited {
    color: #ffffff !important;
}

/* Admonitions/Notes - Light red theme with highlighting */
.admonition, .note, .attention, .caution, .danger, .error, .hint, 
.important, .tip, .warning {
    background-color: #ffe8e6 !important;
    border-left: 4px solid #c0504d !important;
    color: #404040 !important;
    padding: 12px 16px !important;
    border-radius: 4px !important;
    box-shadow: 0 1px 3px rgba(192, 80, 77, 0.1) !important;
}

.admonition-title, .note .admonition-title,
.attention > .admonition-title, .caution > .admonition-title,
.danger > .admonition-title, .error > .admonition-title,
.hint > .admonition-title, .important > .admonition-title,
.tip > .admonition-title, .warning > .admonition-title {
    background-color: #c0504d !important; /* Brick red */
    color: #ffffff !important;
    padding: 6px 12px !important;
    margin: -12px -16px 12px -16px !important;
    border-radius: 2px 2px 0 0 !important;
    font-weight: 600 !important;
}

/* Blockquotes - styled like highlighted note blocks */
blockquote, .rst-content blockquote {
    background-color: #ffe8e6 !important;
    border-left: 4px solid #c0504d !important;
    padding: 8px 12px !important;
    margin: 12px 0 !important;
    border-radius: 3px !important;
    box-shadow: 0 1px 2px rgba(192, 80, 77, 0.08) !important;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif !important;
    font-size: 15px !important;
    line-height: 1.6 !important;
}

blockquote p {
    margin: 0 !important;
    padding: 0 !important;
    font-family: inherit !important;
}

blockquote p strong:first-child {
    color: #c0504d !important;
    font-weight: 700 !important;
}

/* Tables */
.rst-content table.docutils {
    border: 1px solid #e0e0e0 !important;
}

.rst-content table.docutils thead {
    background-color: #fff9e6 !important; /* Light yellow */
}

.rst-content table.docutils th {
    background-color: #fff9e6 !important;
    color: #c0504d !important;
    border: 1px solid #e0e0e0 !important;
}

.rst-content table.docutils td {
    border: 1px solid #e0e0e0 !important;
    background-color: #ffffff !important;
}

/* Footer */
footer, .rst-footer-buttons {
    color: #808080 !important;
}

/* Top navigation breadcrumbs */
.wy-breadcrumbs li a {
    color: #c0504d !important;
}

.wy-breadcrumbs li {
    color: #808080 !important;
}

/* "View page source" link */
.wy-breadcrumbs-aside a {
    color: #c0504d !important;
}

/* Interactive Anvil Playground Widget */

.anvil-playground-widget {
    border: 2px solid #c0504d;
    border-radius: 8px;
    overflow: hidden;
    margin: 20px 0;
    background: #ffffff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace !important;
}

.anvil-editor-section {
    border-bottom: 2px solid #e0e0e0;
}

.anvil-toolbar {
    background: #f5f5f5;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    border-bottom: 1px solid #e0e0e0;
}

.anvil-run-btn,
.anvil-reset-btn,
.anvil-stop-btn,
.anvil-copy-btn {
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: background 0.2s, transform 0.1s;
    margin-right: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.anvil-run-btn {
    background: #c0504d;
}

.anvil-run-btn:hover:not(:disabled) {
    background: #a0403d;
    transform: translateY(-1px);
}

.anvil-stop-btn {
    background: #dc3545;

}

.anvil-stop-btn:hover {
    background: #c82333;
}

.anvil-reset-btn {
    background: #6c757d;
}

.anvil-reset-btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.anvil-copy-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.anvil-copy-btn:hover {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
    transform: translateY(-1px);
}

.anvil-copy-btn.copied {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.anvil-run-btn:disabled,
.anvil-stop-btn:disabled {
    background: #999;
    cursor: not-allowed;
}

.anvil-option {
    font-size: 13px;
    color: #404040;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 4px;
    padding: 6px 10px;
    background: #fff;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.anvil-option input[type="checkbox"] {
    cursor: pointer;
    margin: 0;
}

.anvil-opt-label {
    margin-right: 4px;
    font-weight: 500;
}

.anvil-option select {
    padding: 4px 10px;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: white;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
}

.anvil-code-editor {
    width: 100%;
    min-height: 250px;
    padding: 15px;
    border: none;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace !important;
    font-size: 14px;
    line-height: 1.5;
    background: #f8f8f8;
    color: #333;
    resize: vertical;
    outline: none;
    tab-size: 4;
}

.anvil-code-editor:focus {
    background: #fff;
}

/* CodeMirror overrides for Anvil Playground */
.anvil-editor-section .CodeMirror {
    height: auto;
    min-height: 250px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace !important;
    font-size: 14px;
    line-height: 1.5;
    border: none;
}

.anvil-editor-section .CodeMirror-scroll {
    min-height: 250px;
}


.anvil-editor-section .CodeMirror,
.anvil-editor-section .CodeMirror * {
    user-select: text !important;
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
}

.anvil-editor-section .CodeMirror-selected {
    background: #3390ff55 !important;
}

.anvil-editor-section .CodeMirror-focused .CodeMirror-selected {
    background: #3390ff77 !important;
}


.anvil-editor-section .CodeMirror-code::selection,
.anvil-editor-section .CodeMirror-code *::selection {
    background: #3390ff77 !important;
}

.anvil-editor-section .CodeMirror-code::-moz-selection,
.anvil-editor-section .CodeMirror-code *::-moz-selection {
    background: #3390ff77 !important;
}


.anvil-editor-section .CodeMirror-cursor {
    border-left: 2px solid #333 !important;
}

.anvil-editor-section .CodeMirror-gutters {
    background: #2d2d2d;
    border-right: 1px solid #3d3d3d;
}

.anvil-editor-section .CodeMirror-linenumber {
    color: #858585;
}

.cm-s-anvil-light.CodeMirror {
    background: #fffef5;
    color: #333333;
}

.cm-s-anvil-light .CodeMirror-gutters {
    background: #fff9e6;
    border-right: 1px solid #e0d8c0;
}

.cm-s-anvil-light .CodeMirror-linenumber {
    color: #999977;
}

.cm-s-anvil-light .CodeMirror-activeline-background {
    background: rgba(192, 80, 77, 0.05);
}

.cm-s-anvil-light .CodeMirror-activeline-gutter {
    background: #fff3cc;
}

.cm-s-anvil-light .cm-keyword {
    color: #c0504d !important;
    font-weight: bold;
}

.cm-s-anvil-light .cm-keyword.cm-definition {
    color: #c0504d !important;
    font-weight: bold;
}

.cm-s-anvil-light .cm-keyword.cm-control {
    color: #c0504d !important;
    font-weight: bold;
}

.cm-s-anvil-light .cm-keyword.cm-module {
    color: #c0504d !important;
    font-weight: bold;
}

.cm-s-anvil-light .cm-keyword.cm-modifier {
    color: #c0504d !important;
    font-weight: bold;
}

.cm-s-anvil-light .cm-atom {
    color: #8b4513 !important;
}

.cm-s-anvil-light .cm-number {
    color: #ae81ff !important;
}

.cm-s-anvil-light .cm-def {
    color: #006400 !important;
}

.cm-s-anvil-light .cm-variable {
    color: #333333 !important;
}

.cm-s-anvil-light .cm-variable-2 {
    color: #006666 !important;
}

.cm-s-anvil-light .cm-variable-3 {
    color: #0066aa !important;
}

.cm-s-anvil-light .cm-property {
    color: #333333 !important;
}

.cm-s-anvil-light .cm-operator {
    color: #c0504d !important;
}

.cm-s-anvil-light .cm-comment {
    color: #808080 !important;
    font-style: italic;
}

.cm-s-anvil-light .cm-string {
    color: #a31515 !important;
}

.cm-s-anvil-light .cm-string-2 {
    color: #c0504d !important;
}

.cm-s-anvil-light .cm-meta {
    color: #808080 !important;
}

.cm-s-anvil-light .cm-builtin {
    color: #0066aa !important;
}

.cm-s-anvil-light .cm-bracket {
    color: #333333 !important;
}

.cm-s-anvil-light .cm-tag {
    color: #c0504d !important;
}

.cm-s-anvil-light .cm-attribute {
    color: #006400 !important;
}

.cm-s-anvil-light .cm-punctuation {
    color: #333333 !important;
}

/* Selection highlighting */
.cm-s-anvil-light .CodeMirror-selected {
    background: #3390ff55 !important;
}

.cm-s-anvil-light.CodeMirror-focused .CodeMirror-selected {
    background: #3390ff77 !important;
}

.cm-s-anvil-light .CodeMirror-cursor {
    border-left: 2px solid #333 !important;
}

.anvil-output-section {
    background: #fafafa;
}

.anvil-output-header {
    display: flex;
    background: #e8e8e8;
    border-bottom: 1px solid #d0d0d0;
}

.anvil-tab {
    padding: 10px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    border-right: 1px solid #d0d0d0;
    transition: background 0.2s, color 0.2s;
}

.anvil-tab:hover {
    background: #f0f0f0;
}

.anvil-tab-active {
    background: #fafafa;
    color: #c0504d;
    font-weight: bold;
    border-bottom: 2px solid #c0504d;
}

.anvil-output-content {
    position: relative;
    min-height: 200px;
    max-height: 400px;
}

.anvil-output {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 15px;
    margin: 0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace !important;
    font-size: 13px;
    line-height: 1.4;
    background: #1e1e1e;
    color: #d4d4d4;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    display: none;
}

.anvil-output-active {
    display: block;
}

.anvil-output:empty::before {
    content: "Output will appear here...";
    color: #888;
    font-style: italic;
}


.anvil-code-editor::selection {
    background: #3390ff44;
}

/* Responsive design */
@media (max-width: 768px) {
    .anvil-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .anvil-run-btn,
    .anvil-reset-btn,
    .anvil-copy-btn {
        width: 100%;
        margin-right: 0;
        margin-bottom: 6px;
    }
    
    .anvil-output-content {
        max-height: 300px;
    }
}



@media (max-width: 768px) {

    /* Hide quick links navbar on mobile - too cramped */
    .quick-links-navbar {
        display: none !important;
    }

    .wy-nav-top {
        background-color: #c0504d !important;
        color: white !important;
        display: flex !important;
        align-items: center !important;
        padding: 0 10px !important;
        height: 50px !important;
        line-height: 50px !important;
    }
    

    .wy-nav-top i {
        color: white !important;
        font-size: 24px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 40px !important;
        height: 50px !important;
        line-height: 50px !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    

    .wy-nav-top a {
        color: white !important;
        display: inline-flex !important;
        align-items: center !important;
        height: 50px !important;
        line-height: 50px !important;
        padding-left: 5px !important;
        font-size: 16px !important;
    }
    

    .navbar-toggle-btn {
        display: none !important;
    }
    

    .wy-nav-side {
        background-color: #fffef0 !important;

    }
    

    body.nav-hidden .wy-nav-side {
        transform: none !important;
        -webkit-transform: none !important;
    }
    

    .wy-nav-side {
        background-color: #fffef0 !important;
        transition: left 0.3s ease !important;
        transform: none !important;
    }
    
    .wy-nav-content-wrap {
        transition: left 0.3s ease !important;
    }
    

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

    h1, h2, h3, h4, h5, h6,
    .rst-content h1, .rst-content h2, .rst-content h3 {
        padding: 6px 10px !important;
        font-size: 1.2em !important;
    }
    

    pre, code {
        font-size: 12px !important;
        word-break: break-word !important;
    }
    
    div.highlight {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    

    .anvil-playground-widget {
        margin: 10px 0;
    }
    
    .anvil-editor-section .CodeMirror {
        min-height: 150px;
        font-size: 12px !important;
    }
    

    .anvil-tab {
        padding: 12px 15px;
    }
    

    .custom-footer {
        margin: 10px;
        padding: 10px;
    }
}


@media (min-width: 769px) {
    @supports (-webkit-touch-callout: none) {
        .wy-nav-side {
            -webkit-transform: translateZ(0);
            transform: translateZ(0);
        }
        
        body.nav-hidden .wy-nav-side {
            -webkit-transform: translateX(-100%) translateZ(0);
            transform: translateX(-100%) translateZ(0);
        }
    }
}



.highlight {
    background-color: #fffef5 !important;
    border: 1px solid #e0d8c0 !important;
    border-radius: 4px !important;
    padding: 12px !important;
}

.highlight code {
    background: transparent !important;
    border: none !important;
    color: #333333 !important;
    font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace !important;
}


.highlight .c1,     /* Comment.Single */
.highlight .cm {    /* Comment.Multiline */
    color: #808080 !important;
    font-style: italic !important;
}

.highlight .k,
.highlight .kd,
.highlight .kn,
.highlight .kt,
.highlight .kc {
    color: #c0504d !important;
    font-weight: bold !important;
}

.highlight .n, 
.highlight .nv,
.highlight .nb {
    color: #333333 !important;
}

.highlight .s,
.highlight .s1,
.highlight .s2,
.highlight .sa {
    color: #a31515 !important;
}

.highlight .m, 
.highlight .mf,
.highlight .mh, 
.highlight .mi,     /* Number.Integer */
.highlight .mb,     /* Number.Bin */
.highlight .mo {    /* Number.Oct */
    color: #ae81ff !important;
}

.highlight .o,      /* Operator */
.highlight .ow {    /* Operator.Word */
    color: #c0504d !important;
}

.highlight .p {     /* Punctuation */
    color: #333333 !important;
}

.highlight .nx,     /* Name.Other */
.highlight .bp {    /* Name.Builtin.Pseudo */
    color: #333333 !important;
}

.highlight .se {    /* String.Escape */
    color: #8b4513 !important;
}

.highlight .err {   /* Error */
    color: #dc3545 !important;
    background-color: #ffe8e6 !important;
}

/* Copy Code Button */

.copy-code-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 10px;
    background: #404040;
    color: #fff;
    border: 1px solid #606060;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
}

div.highlight:hover .copy-code-btn,
pre.literal-block:hover .copy-code-btn {
    opacity: 1;
}

.copy-code-btn:hover {
    background: #505050;
}

.copy-code-btn.copied {
    background: #28a745;
}

.wy-breadcrumbs-aside,
a[href*="_sources"] {
    display: none !important;
}

/*   Custom Footer*/

.custom-footer {
    text-align: center;
    padding: 12px 15px;
    margin-top: 15px;
    border-top: 1px solid #e0e0e0;
    background: linear-gradient(135deg, #fff9e655 0%, #ffe8cc55 100%);
    border-radius: 8px;
}

.custom-footer a {
    color: #c0504d;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: color 0.2s;
}

.custom-footer a:hover {
    color: #a0403d;
    text-decoration: underline;
}