/* CSS Variables for theming and consistency */
:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary-color: #1e3a8a;
  --text-color: #1f2937;
  --text-light: #4b5563;
  --background-color: #ffffff;
  --background-alt: #f9fafb;
  --border-color: #e5e7eb;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --gallery-card-bg: #ffffff;
  --gallery-card-border: #e5e7eb;
  --gallery-hover-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  --code-bg: #0e1624;
  --code-color: #e6f1ff;
  --inline-code-bg: rgba(0, 0, 0, 0.05);
  --inline-code-color: #b91c1c;
  --download-btn-color: #4a5568; /* Dark gray for download buttons */
  --download-btn-hover: #2d3748; /* Darker gray for hover state */
  --hyperlink-color: #3b82f6; /* New variable for hyperlinks */
  --hyperlink-hover: #1d4ed8; /* New variable for hyperlink hover */
  --hyperlink-visited: #7c3aed; /* New variable for visited hyperlinks */
  --binder-btn-color: #f8fafc; /* Light background for binder button */
  --binder-btn-border: #e2e8f0; /* Light border for binder button */
  --backreference-bg: #f0f9ff; /* New: Background for backreferences section */
  --backreference-border: #bae6fd; /* New: Border color for backreferences section */
  --backreference-heading: #0284c7; /* New: Color for backreferences heading */

  /* Inheritance diagram colors */
  --inheritance-bg: rgba(237, 247, 255, 0.8);
  --inheritance-border: #c2d7ff;
  --inheritance-node-bg: #e8f0ff;
  --inheritance-node-border: #3366cc;
  --inheritance-node-text: #1a365d;
  --inheritance-edge: #2f6eb6;
  --inheritance-highlight: #4dabf5;
}

/* Add direct favicon link to ensure it loads properly */
head::after {
  content: url("_static/favicon.ico");
  display: none;
}

html {
    height: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.7;
    background-color: #ffffff;
    color: #333;
    margin: 0;
    padding: 0;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

/* More compact reference styling */
.rst-content a.reference {
    font-size: 0.95em;
    border-bottom: 1px dotted rgba(59, 130, 246, 0.3);
    padding-bottom: 1px;
}

.rst-content a.reference:hover {
    border-bottom: 1px solid var(--hyperlink-hover);
    text-decoration: none;
}

.rst-content a.reference.internal {
    font-weight: 500;
}

.rst-content a.reference.external {
    color: #0369a1;
}

.rst-content a.reference.external:hover {
    color: #0284c7;
}

/* Specific styling for examples links */
.rst-content a.reference.internal[href^="../auto_examples/"],
.rst-content a.reference.internal[href^="auto_examples/"],
.rst-content a.reference.internal[href*="sphx_glr_"] {
    display: inline-block;
    padding: 0.2em 0.5em;
    background-color: rgba(59, 130, 246, 0.1);
    border-radius: 4px;
    border-bottom: none;
    margin: 0 1px;
    font-size: 0.9em;
    transition: all 0.2s ease;
}

.rst-content a.reference.internal[href^="../auto_examples/"]:hover,
.rst-content a.reference.internal[href^="auto_examples/"]:hover,
.rst-content a.reference.internal[href*="sphx_glr_"]:hover {
    background-color: rgba(59, 130, 246, 0.2);
    text-decoration: none;
    transform: translateY(-1px);
}

/* Improved gallery download buttons */
.sphx-glr-download {
    margin: 0 !important;
    text-align: center !important;
    display: flex !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
    gap: 1rem !important;
    padding: 0.5rem !important;
}

.sphx-glr-download a {
    background-color: var(--download-btn-color) !important;
    background-image: none !important; /* Remove any gradient */
    color: white !important;
    padding: 0.7rem 1.4rem !important;
    border-radius: 6px !important;
    font-weight: 500 !important;
    font-size: 0.95rem !important;
    text-decoration: none !important;
    display: inline-block !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    border: none !important;
    margin: 0 !important;
    position: relative !important;
    overflow: hidden !important;
}

.sphx-glr-download a:hover {
    background-color: var(--download-btn-hover) !important;
    background-image: none !important; /* Remove any gradient on hover */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important;
    transform: translateY(-2px) !important;
}

/* More compact download section */
div.sphx-glr-download-link-note {
    font-size: 0.9rem !important;
    padding: 1rem !important;
    background-color: #f8fafc !important;
    border-radius: 6px !important;
    margin: 0 auto 1.5rem auto !important;
    border: 1px solid #e5e7eb !important;
    max-width: 800px !important;
    text-align: center !important;
    display: none !important;
}

/* Fix large and inconsistent spacing in gallery links */
p.sphx-glr-signature {
    margin-top: 1rem !important;
    margin-bottom: 1rem !important;
}

p.sphx-glr-signature a.reference.external {
    font-size: 0.9rem;
}

/* Style for gallery thumbnail links */
.sphx-glr-thumbcontainer a.reference.internal {
    text-decoration: none !important;
    border-bottom: none !important;
    color: inherit !important;
}

.sphx-glr-thumbcontainer:hover a.reference.internal {
    color: var(--primary-color) !important;
}

/* Style the mini-gallery list items */
.sphx-glr-mini {
    margin-bottom: 1.5rem;
}

.sphx-glr-mini a.reference.internal {
    display: inline-block;
    font-size: 0.9rem;
    padding: 0.4rem 0.7rem;
    margin: 0.25rem 0;
    background-color: #f3f4f6;
    border-radius: 4px;
    border-bottom: none;
    transition: all 0.2s ease;
}

.sphx-glr-mini a.reference.internal:hover {
    background-color: #e5e7eb;
    transform: translateY(-1px);
}

.sphx-glr-script-out .highlight pre {
    color: #1a2a3a;
}
.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

h1, h2, h3, h4, h5, h6 {
    color: #1a2a3a;
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
    line-height: 1.3;
}

h1 {
    font-size: 2.25rem;
    border-bottom: 1px solid #eaecef;
    padding-bottom: 0.5rem;
}

h2 {
    font-size: 1.75rem;
    margin-top: 2.5rem;
}

h3 {
    font-size: 1.4rem;
}

a {
    text-decoration: none;
    transition: all 0.2s ease;
}

a:hover {
    text-decoration: underline;
}

a:focus {
    outline: 3px solid rgba(37, 99, 235, 0.3);
    outline-offset: 2px;
    text-decoration: none;
}

/* Sticky navigation bar */
.navbar {
    background-color: #1e3a8a;
    position: sticky;
    top: 0;
    width: 100%;
    z-index: 1000;
    padding: 0.75rem 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.navbar .logo {
    margin-left: 1.5rem;
}
.navbar .logo img {
    height: 40px;
    transition: transform 0.2s ease;
}
.navbar .logo:hover img {
    transform: scale(1.05);
}
.nav-links {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
}
.nav-links li {
    margin: 0 0.75rem;
}

/* Navigation link improvements */
.nav-links a {
    color: #ffffff;
    text-decoration: none;
    transition: all 0.3s ease;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: 500;
    position: relative;
    border-bottom: 2px solid transparent;
}

.nav-links a:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    border-bottom: 2px solid #ffffff;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.nav-links a:active {
    transform: translateY(0);
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
}

.nav-links a:focus {
    outline: 2px solid rgba(255, 255, 255, 0.7);
    outline-offset: 2px;
}

/* Breadcrumb styling */
.breadcrumb {
    background: #f9fafb;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    color: #4b5563;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

.breadcrumb a {
    color: #2563eb;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* Main content layout using CSS Grid */
main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 2rem 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Code blocks styling */
div.highlight {
    margin: 1em 0;
}

div.highlight pre {
    background: var(--code-bg);
    color: var(--code-color);
    border-radius: 6px;
    padding: 1.25em;
    font-size: 0.95em;
    line-height: 1.4;
    overflow-x: auto;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    margin: 0;
}

/* Fix extra line spacing in code blocks */
.highlight pre span {
    display: inline;
    white-space: pre;
}

.code-line {
    display: block !important;
    line-height: 1.4 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.code-line:empty {
    display: none !important;
}

/* Inline code styling */
code {
    background-color: var(--inline-code-bg);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    color: var(--inline-code-color);
}

/* Sidebar styling */
aside {
    background: #f9fafb;
    padding: 1.5rem;
    border-left: 3px solid #2563eb;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 100px;
    align-self: start;
}

aside h3 {
    margin-top: 0;
    font-size: 1.2rem;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
}

aside ul {
    padding-left: 1.25rem;
    margin-bottom: 0;
}

aside li {
    margin-bottom: 0.5rem;
}

/* Footer styling */
footer {
    padding: 3rem 0;
    margin-top: 2rem;
    text-align: center;
    font-size: 0.9em;
    width: 100%;
    background-color: #f9fafb;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -2px 5px rgba(0,0,0,0.03);
    position: relative;
    z-index: 10;
    display: block;
    clear: both;
}

div.footer, footer, .site-footer {
    position: relative;
    margin-top: 2rem;
    padding: 2rem 0;
    text-align: center;
    font-size: 0.9em;
    width: 100%;
    background-color: #f9fafb;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -2px 5px rgba(0,0,0,0.03);
    z-index: 100;
    display: block;
    clear: both;
}

/* Override any Sphinx-specific negative margins */
.footer-wrapper {
    margin-top: 0;
    position: relative;
    z-index: 100;
}

/* Ensure proper footer stacking and layer order */
.bodywrapper {
    min-height: calc(100vh - 200px);
    position: relative;
    z-index: 1;
}

.documentwrapper {
    position: relative;
    z-index: 1;
}

.document {
    flex: 1;
}

/* Sphinx's default footer overrides */
div.footer {
    background-color: #f9fafb !important;
    color: #333 !important;
}

/* Custom site footer styling */
.site-footer {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    box-shadow: none;
}

/* Fix container styles in footer */
footer .container, .site-footer .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    position: relative;
    z-index: 20;
}

/* Improve footer links and spacing */
.footer-links {
    margin-top: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-links a {
    margin: 0.5rem 1rem;
    color: #2563eb;
}

.footer-logo {
    margin-bottom: 1.5rem;
}

.footer-logo img {
    height: 50px;
}

/* Layout tweaks */
.section, .document {
    margin: 2em auto;
    max-width: 850px;
    padding: 0 1em;
    line-height: 1.8;
}

/* Table styling */
table {
    border-collapse: collapse;
    width: 100%;
    margin: 0 0;
    font-size: 0.95rem;
}

th {
    background-color: #f3f4f6;
    font-weight: 600;
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid #e5e7eb;
}

td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
}

tbody tr:hover {
    background-color: #f9fafb;
}

/* Responsive design adjustments */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        padding: 1rem;
    }

    .navbar .logo {
        margin-bottom: 1rem;
        margin-left: 0;
    }

    .nav-links {
        flex-direction: column;
        width: 100%;
    }

    .nav-links li {
        margin: 0.5rem 0;
        width: 100%;
        text-align: center;
    }

    .nav-links a {
        display: block;
        padding: 0.75rem 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }
}

@media (min-width: 768px) {
    main {
        grid-template-columns: 3fr 1fr;
    }
}

/* Admonitions / Notes / Warnings */
.admonition {
    margin: 1.5rem 0;
    padding: 1rem;
    border-left: 4px solid #3b82f6;
    background-color: #eff6ff;
    border-radius: 4px;
}
.admonition.warning {
    border-left-color: #f59e0b;
    background-color: #fffbeb;
}
.admonition.danger {
    border-left-color: #ef4444;
    background-color: #fee2e2;
}
.admonition.tip {
    border-left-color: #10b981;
    background-color: #ecfdf5;
}
.admonition-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* Documentation version selector */
.version-selector {
    padding: 0.5rem;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
    font-size: 0.9rem;
    background-color: #ffffff;
    margin-bottom: 1rem;
}

/* Progress indicator for long pages */
.progress-container {
    position: fixed;
    top: 0;
    width: 100%;
    height: 4px;
    z-index: 1001;
}

.progress-bar {
    height: 4px;
    background-color: #3b82f6;
    width: 0%;
}

/* Table of contents styling */
.toc {
    background-color: #f9fafb;
    border-radius: 6px;
    padding: 1.25rem;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.toc-title {
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.toc ul {
    padding-left: 1.25rem;
    margin-bottom: 0;
}

.toc li {
    margin-bottom: 0.5rem;
}

/* Example: Adjust code block font size */
.rtd-content pre {
    font-size: 0.9em;
    line-height: 1.5;
}

.rubric {
    font-weight: bold;
    color: #e74c3c;
}

.list-table th {
    background-color: #ecf0f1;
    font-weight: bold;
}

.list-table td {
    border: 1px solid #bdc3c7;
    padding: 8px;
}

/* Additional improvements */
blockquote {
    border-left: 4px solid #ddd;
    padding: 0.5rem 1rem;
    color: #666;
    background-color: #f9f9f9;
    border-radius: 4px;
}

/* Gallery improvements */
.examples-gallery {
    margin: 2.5rem 0;
}

.gallery-intro {
    margin-bottom: 2.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.gallery-category {
    margin-bottom: 4rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    animation: fadeIn 0.6s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.gallery-category h2 {
    color: var(--secondary-color);
    position: relative;
    padding-bottom: 0.75rem;
}

.gallery-category h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 3px;
    background-color: var(--primary-color);
}

.examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 1.8rem;
}

.example-card {
    border: 1px solid var(--gallery-card-border);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    background-color: white;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.example-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
    border-color: var(--primary-color);
}

.example-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    color: inherit;
    text-decoration: none;
}

.example-thumb {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-bottom: 1px solid var(--gallery-card-border);
    background-color: #f8fafc;
}

.example-thumb-placeholder {
    width: 100%;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8fafc;
    color: var(--text-light);
    font-size: 3rem;
    border-bottom: 1px solid var(--gallery-card-border);
}

.example-info {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.example-title {
    margin: 0 0 1rem 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--secondary-color);
    line-height: 1.4;
}

.example-description {
    margin: 0;
    color: var(--text-light);
    font-size: 0.95rem;
    line-height: 1.6;
    flex-grow: 1;
}

/* Category Grid for Examples Gallery */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin: 2.5rem 0;
}

.category-card {
    border: 1px solid var(--gallery-card-border);
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    background-color: #ffffff;
    overflow: hidden;
    position: relative;
}

.category-card:hover {
    transform: translateY(-7px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
    border-color: var(--primary-color);
}

.category-card a {
    display: block;
    padding: 2rem;
    text-decoration: none;
    color: inherit;
    position: relative;
    z-index: 1;
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: var(--primary-color);
}

.category-card h3 {
    margin-top: 0;
    margin-bottom: 0.8rem;
    color: var(--secondary-color);
    font-size: 1.4rem;
    position: relative;
    padding-bottom: 0.5rem;
}

.category-card p {
    margin: 0;
    color: var(--text-light);
    line-height: 1.6;
}

/* Enhanced Sphinx-Gallery Styling */

/* Main gallery styling */
.kaira-gallery,
.sphx-glr-thumbcontainer {
    background-color: var(--gallery-card-bg) !important;
    border: 1px solid var(--gallery-card-border) !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.06) !important;
    margin: 0 !important;
    min-height: 320px !important;
    transition: all 0.3s ease !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    width: 100% !important;
    float: none !important;
}

.kaira-gallery:hover,
.sphx-glr-thumbcontainer:hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12) !important;
    border-color: var(--primary-color) !important;
}

/* Gallery thumbnail image improvements */
.sphx-glr-thumbnail-img {
    max-width: 100% !important;
    height: 200px !important;
    object-fit: contain !important;
    background-color: #f8fafc !important;
    padding: 10px !important;
    margin: 0 auto !important;
    display: block !important;
    border-bottom: 1px solid var(--gallery-card-border) !important;
}

/* Gallery title improvements */
.sphx-glr-thumbnail-title {
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    color: var(--secondary-color) !important;
    padding: 1.2rem !important;
    text-align: center !important;
    line-height: 1.4 !important;
    height: auto !important;
    min-height: 80px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-grow: 1 !important;
}

/* Gallery section headings */
.sphx-glr-section-title {
    font-size: 1.75rem !important;
    margin-top: 3rem !important;
    margin-bottom: 1.5rem !important;
    color: var(--secondary-color) !important;
    border-bottom: 2px solid var(--border-color) !important;
    padding-bottom: 0.75rem !important;
    position: relative !important;
}

.sphx-glr-section-title::after {
    content: '' !important;
    position: absolute !important;
    bottom: -2px !important;
    left: 0 !important;
    width: 60px !important;
    height: 3px !important;
    background-color: var(--primary-color) !important;
}

/* Responsive design for gallery */
@media (max-width: 768px) {
    .category-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }

    .examples-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }

    .sphx-glr-thumbnails {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)) !important;
    }
}

@media (max-width: 576px) {
    .category-grid {
        grid-template-columns: 1fr;
    }

    .examples-grid {
        grid-template-columns: 1fr;
    }

    .sphx-glr-thumbnails {
        grid-template-columns: 1fr !important;
    }
}

/* Add copy button styling */
button.copybtn {
    opacity: 0.3;
    transition: opacity 0.3s ease-in-out;
    border-radius: 4px;
    padding: 0.3em 0.6em;
    background-color: rgba(255, 255, 255, 0.1);
}

div:hover > button.copybtn, button.copybtn:hover {
    opacity: 1;
}

/* Gallery grid container */
.sphx-glr-thumbnails {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) !important;
    gap: 1.5rem !important;
    margin: 1.5rem 0 !important;
    width: 100% !important;
    float: none !important;
    clear: both !important;
}

/* Fix for clearing floats in default gallery layout */
.sphx-glr-clear {
    clear: both !important;
    display: none !important;
}

/* Binder button styling */
div.binder-badge {
    margin: 0.5rem 0 1.5rem 0 !important;
    display: flex !important;
    justify-content: center !important;
}

div.binder-badge a {
    display: inline-flex !important;
    align-items: center !important;
    padding: 0.7rem 1.2rem !important;
    background-color: var(--binder-btn-color) !important;
    border: 1px solid var(--binder-btn-border) !important;
    border-radius: 6px !important;
    font-size: 0.95rem !important;
    font-weight: 500 !important;
    color: #333 !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

div.binder-badge a:hover {
    background-color: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08) !important;
}

/* Improved download links in RTD theme */
.rst-content .sphx-glr-download a {
    padding: 0.7rem 1.4rem !important;
    line-height: 1.4 !important;
    height: auto !important;
    font-size: 0.95rem !important;
    font-weight: 500 !important;
    background-color: var(--download-btn-color) !important;
    background-image: none !important; /* Remove any gradient */
    border-radius: 6px !important;
    color: white !important;
    border: none !important;
}

.rst-content .sphx-glr-download a:visited {
    background-color: var(--download-btn-color) !important;
    background-image: none !important; /* Remove any gradient */
    color: white !important;
}

.rst-content .sphx-glr-download a:hover {
    background-color: var(--download-btn-hover) !important;
    background-image: none !important; /* Remove any gradient on hover */
    color: white !important;
    text-decoration: none !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important;
    transform: translateY(-2px) !important;
}

/* Custom loader for gallery execution */
.sphx-glr-script-out:before {
    content: "Output";
    display: block;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #64748b;
    font-size: 0.9rem;
}

/* Gallery and download section layout improvements */
.sphx-glr-footer.docutils.container {
    margin-top: 2rem !important;
    padding: 2rem !important;
    background-color: #f8fafc !important;
    border-radius: 8px !important;
    border: 1px solid #e5e7eb !important;
}

.sphx-glr-footer-title {
    font-size: 1.2rem !important;
    font-weight: 600 !important;
    color: #1e293b !important;
    margin-bottom: 1rem !important;
    text-align: center !important;
}

.sphx-glr-download {
    display: flex !important;
    justify-content: center !important;
    gap: 1rem !important;
    margin: 1rem 0 !important;
}

.sphx-glr-download a {
    background-color: #3b82f6 !important;
    color: white !important;
    padding: 0.75rem 1.5rem !important;
    border-radius: 6px !important;
    text-decoration: none !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
}

.sphx-glr-download a:hover {
    background-color: #2563eb !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
}

div.binder-badge {
    margin: 1rem 0 !important;
    text-align: center !important;
}

div.binder-badge a {
    background-color: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    color: #1e293b !important;
    padding: 0.75rem 1.5rem !important;
    border-radius: 6px !important;
    text-decoration: none !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

div.binder-badge a:hover {
    border-color: #3b82f6 !important;
    color: #3b82f6 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
}

/* Fix spacing between elements in the gallery footer */
.sphx-glr-signature {
    margin: 1.5rem 0 0.5rem 0 !important;
    text-align: center !important;
}

/* Create a container for buttons */
.sphx-glr-download-container {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    width: 100% !important;
    max-width: 800px !important;
    margin: 0 auto !important;
}

/* Make sure no extra space between signature and binder */
.sphx-glr-signature + div.binder-badge {
    margin-top: 0.5rem !important;
}

/* Fix spacing between binder and download buttons */
.sphx-glr-signature + div.binder-badge {
    margin-top: -1rem !important;
    margin-bottom: 1rem !important;
}

/* Fix for sphinx_rtd_theme compatibility */
.rst-content .sphx-glr-thumbcontainer {
    background-color: var(--gallery-card-bg) !important;
    border: 1px solid var(--gallery-card-border) !important;
    border-radius: 8px !important;
}

/* RTD specific gallery adjustments */
.rst-content .sphx-glr-thumbnails::before,
.rst-content .sphx-glr-thumbnails::after {
    content: none !important;
}

/* Styling for inheritance diagrams */
div.inheritance-diagram {
    margin: 2em 0;
}

div.inheritance-diagram svg {
    background-color: var(--inheritance-bg) !important;
}

div.inheritance-diagram g.node rect {
    shape-rendering: crispEdges;
    fill: var(--inheritance-node-bg) !important;
    stroke: var(--inheritance-node-border) !important;
    stroke-width: 1px !important;
}

div.inheritance-diagram g.node text {
    fill: var(--inheritance-node-text) !important;
    font-family: 'Roboto', sans-serif !important;
    font-size: 0.9em !important;
}

div.inheritance-diagram g.edgePath path {
    stroke: var(--inheritance-edge) !important;
    stroke-width: 1.5px !important;
}

div.inheritance-diagram g.edgePath polygon {
    fill: var(--inheritance-edge) !important;
}

div.inheritance-diagram g.cluster rect {
    fill: transparent !important;
    stroke: var(--inheritance-node-border) !important;
    stroke-dasharray: 4,2 !important;
    stroke-width: 1px !important;
}
