/* Custom styling to make methods more visible in the sidebar */
.toctree-l3,
.toctree-l2 {
    font-weight: bold;
}

.toctree-l4 {
    margin-left: 1em;
}

/* Import JetBrains Mono font */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&display=swap');

/* Set JetBrains Mono as the font for all code blocks and elements */
code,
pre,
.highlight,
div.highlight pre,
dl.cpp dt,
.method-list li a,
.sidebar-tree li.toctree-l3>a {
    font-family: 'JetBrains Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace !important;
}

/* Improve method links in sidebar - target the actual methods */
.sidebar-tree li.toctree-l1>a:contains("fusion_array") {
    font-weight: 600;
    font-size: 1.1em;
    color: var(--color-brand-primary);
    border-bottom: 1px solid var(--color-background-secondary);
    margin-bottom: 8px;
    padding-bottom: 5px;
}

/* Style sections in the fusion_array page */
.sidebar-tree li.toctree-l2>a:contains("Core Operations"),
.sidebar-tree li.toctree-l2>a:contains("Adjacency Operations"),
.sidebar-tree li.toctree-l2>a:contains("Reduction Operations"),
.sidebar-tree li.toctree-l2>a:contains("Structure Operations") {
    color: var(--color-link);
    font-weight: 600;
    margin-top: 10px;
    margin-bottom: 5px;
}

/* Style the actual method links */
.sidebar-tree li.toctree-l3>a {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.9em;
    padding-left: 10px;
    border-left: 2px solid var(--color-brand-primary);
    margin-left: 5px;
}

/* Highlight the current method */
.sidebar-tree li.toctree-l3.current>a {
    background-color: var(--color-sidebar-item-background--current);
    color: var(--color-brand-primary);
    border-left: 2px solid var(--color-brand-primary);
}

/* Make contents TOC stand out */
.contents.local ul {
    background-color: var(--color-background-secondary);
    padding: 10px 15px;
    border-left: 3px solid var(--color-brand-primary);
    border-radius: 0 4px 4px 0;
}

.contents.local li {
    margin-bottom: 5px;
}

.contents.local a {
    text-decoration: none;
}

/* Custom styles for parrot documentation */

/* Improve class member documentation */
dl.cpp.class {
    margin-bottom: 2em;
}

/* Style for parameter lists */
dl.field-list {
    margin-left: 1em;
}

/* Adjust code font */
code,
pre {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

/* Method summary table styling */
.method-summary-table {
    width: 100%;
    margin-bottom: 1.5em;
    border-collapse: collapse;
}

.method-summary-table th {
    background-color: var(--color-background-secondary);
    border-bottom: 2px solid var(--color-background-hover);
    padding: 8px 12px;
    text-align: left;
}

.method-summary-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--color-background-hover);
    vertical-align: top;
}

.method-summary-table tr:hover {
    background-color: var(--color-background-hover);
}

/* Improve brief description display */
dl.cpp dd p:first-child {
    font-weight: normal;
    margin-top: 0.3em;
    font-size: 1em;
    color: var(--color-foreground-secondary);
}

/* Make method signatures clearer */
dl.cpp dt {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

/* Method descriptions */
dl.cpp dd {
    margin-left: 1.5em;
    margin-bottom: 1.5em;
    padding-bottom: 0.5em;
    border-bottom: 1px dashed var(--color-background-hover);
}

/* Parameter styling */
dl.field-list dt {
    font-weight: bold;
    color: var(--color-foreground-primary);
}

/* Return value styling */
dl.field-list dt:has(+ dd .sig-return-typehint) {
    color: var(--color-brand-primary);
    font-weight: 500;
}

/* Section headers for methods */
h2:contains("Methods Reference"),
h3:contains("Core Operations"),
h3:contains("Adjacency Operations"),
h3:contains("Reduction Operations"),
h3:contains("Structure Operations") {
    background-color: var(--color-background-secondary);
    padding: 8px 12px;
    border-left: 4px solid var(--color-brand-primary);
    margin-top: 25px;
}

/* Custom method sidebar styling for flat list */
.sidebar-brand-text+nav h2 {
    color: var(--color-brand-primary);
    font-size: 1.2em;
    margin: 1em 0 0.5em 0;
    padding-bottom: 0.0em;
    border-bottom: 1px solid var(--color-background-secondary);
}

.method-list {
    margin-left: 0 !important;
    padding-left: 0 !important;
    list-style-type: none !important;
}

.method-list li {
    margin-bottom: 0.2em !important;
    padding-left: 0.8em !important;
    border-left: 2px solid var(--color-brand-primary) !important;
}

.method-list li a {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace !important;
    font-size: 0.9em !important;
    color: var(--color-foreground-primary) !important;
    text-decoration: none !important;
    display: block !important;
    padding: 3px 5px !important;
}

.method-list li a:hover {
    color: var(--color-link--hover) !important;
    background-color: var(--color-background-hover) !important;
    text-decoration: none !important;
}

/* Custom sidebar styling */
.sidebar-wrapper {
    padding: 1rem 0.5rem;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Logo and brand */
.sidebar-brand {
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    text-align: center;
}

.logo {
    height: 125px;
    margin-bottom: 0.0rem;
}

.sidebar-brand-text {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--color-brand-primary);
    text-align: center;
}

/* Improve scroll area */
.sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 0 0.5rem;
}

/* Method list styling */
.method-list {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

.method-list li {
    margin-bottom: 0.4rem;
    padding-left: 0.8rem;
    border-left: 2px solid var(--color-brand-primary);
    transition: all 0.2s;
}

.method-list li a {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.9rem;
    color: var(--color-foreground-primary);
    text-decoration: none;
    display: block;
    padding: 5px 8px;
    border-radius: 3px;
    transition: all 0.2s;
}

.method-list li:hover {
    border-left-color: var(--color-brand-primary);
}

.method-list li a:hover {
    color: var(--color-link--hover);
    background-color: var(--color-background-hover);
    text-decoration: none;
}

/* Removal of redundant contents TOC when using our sidebar */
.contents.local {
    display: none;
}

/* Methods section in sidebar */
.sidebar-methods {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-background-secondary);
    padding: 0;
}

.sidebar-methods h2 {
    font-size: 1.2rem;
    color: var(--color-brand-primary);
    margin-top: 0.8rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--color-background-secondary);
    padding-bottom: 0.5rem;
}

/* Search box styling */
.sidebar-search-container {
    margin-bottom: 0rem;
    padding: 0 0.0rem;
    background-color: inherit;
    border: 0;
    transition: none !important;
}

.sidebar-search {
    width: 100%;
    position: relative;
    display: block;
    background-color: transparent;
    border: 0;
    box-shadow: none;
    margin-top: 0;
    transition: none !important;
}

/* Remove any theme-provided square background around the search icon */
.sidebar-search::before,
.sidebar-search::after {
    background-color: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

.sidebar-search button,
.sidebar-search .search-icon {
    background-color: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

/* Disable hover animations/effects for the rectangular bounding box */
.sidebar-search-container:hover,
.sidebar-search:hover {
    box-shadow: none !important;
    background-color: inherit !important;
    border-color: inherit !important;
    transition: none !important;
    animation: none !important;
}

/* Also disable any focus-within driven container effects */
.sidebar-search:focus-within,
.sidebar-search-container:focus-within,
.sidebar-search:focus-within:hover,
.sidebar-search-container:focus-within:hover {
    box-shadow: none !important;
    background-color: inherit !important;
    border-color: inherit !important;
    transition: none !important;
    animation: none !important;
}

.search-input {
    width: 85%;
    padding: 8px 12px;
    border: 1px solid var(--color-brand-primary);
    border-radius: 4px;
    font-size: 0.9rem;
    color: var(--color-foreground-primary);
    background-color: transparent;
    outline: none;
    transition: none !important;
}

.search-input:focus {
    border-color: var(--color-brand-primary);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* Prevent hover effects on the input, even while focused */
.search-input:hover,
.sidebar-search:hover .search-input,
.sidebar-search-container:hover .search-input,
.search-input:focus:hover {
    box-shadow: none !important;
    background-color: transparent !important;
    border-color: var(--color-brand-primary) !important;
    transition: none !important;
}

/* Method categories in sidebar */
.method-category {
    margin-bottom: 1rem;
}

.method-category h3 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #ff69b4;
    border-bottom: 1px solid var(--color-background-secondary);
    padding-bottom: 0.2rem;
}

/* Method subcategory styling */
.method-subcategory {
    margin-left: 0.5rem;
    margin-bottom: 0.8rem;
}

.method-subcategory h4 {
    margin-top: 0.5rem;
    margin-bottom: 0.3rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-foreground-tertiary);
    padding-left: 0.3rem;
    border-left: 2px solid var(--color-brand-secondary);
}

/* Color coding for different subcategories */
/* 1-index Maps */
.method-category:nth-child(1) .method-subcategory:nth-child(1) h4 {
    border-left-color: var(--color-brand-tertiary);
}

/* 2-index Maps */
.method-category:nth-child(1) .method-subcategory:nth-child(2) h4 {
    border-left-color: var(--color-brand-quaternary);
}

/* Joins */
.method-category:nth-child(1) .method-subcategory:nth-child(3) h4 {
    border-left-color: var(--color-brand-quinary);
}

/* Reductions */
.method-category:nth-child(2) .method-subcategory:nth-child(1) h4 {
    border-left-color: var(--color-brand-senary);
}

/* Compactions */
.method-category:nth-child(2) .method-subcategory:nth-child(2) h4 {
    border-left-color: var(--color-brand-septenary);
}

/* Permutations */
.method-category:nth-child(2) .method-subcategory:nth-child(3) h4 {
    border-left-color: var(--color-brand-octonary);
}

/* Other */
.method-category:nth-child(2) .method-subcategory:nth-child(4) h4 {
    border-left-color: var(--color-foreground-tertiary);
}

/* List items in subcategories should have less indent */
.method-subcategory .method-list li {
    margin-bottom: 0.1rem !important;
    padding-left: 0.6rem !important;
    border-left-width: 1px !important;
}

/* Style to differentiate fused vs materializing operations - removed color differentiation */
/* 
.method-category:nth-of-type(1) h3 {
    color: var(--color-brand-primary);
    border-left-color: var(--color-brand-primary);
}

.method-category:nth-of-type(3) h3 {
    color: var(--color-link);
    border-left-color: var(--color-link);
}
*/

/* Method list items with different colors for lazy vs eager - removed color differentiation */
/*
.method-category:nth-of-type(1) .method-list li {
    border-left-color: var(--color-brand-primary);
}

.method-category:nth-of-type(3) .method-list li {
    border-left-color: var(--color-link);
}

.method-category:nth-of-type(1) .method-list li a:hover {
    color: var(--color-brand-primary);
}

.method-category:nth-of-type(3) .method-list li a:hover {
    color: var(--color-link);
}
*/

/* Make sure toctree content has some spacing from methods */
.sidebar-scroll>ul.current {
    margin-top: 1rem;
}

/* Inline code styling */
html[data-theme="light"] code.literal {
    background-color: #f0f0f0;
    color: #1f377f;
    border: 1px solid #e8e8e8;
    padding: 2px 4px;
    border-radius: 3px;
}

html[data-theme="dark"] code.literal {
    background-color: #44475a;
    color: #f8f8f2;
    border: 1px solid #6272a4;
    padding: 2px 4px;
    border-radius: 3px;
}

/* Function signatures in VS Light theme */
html[data-theme="light"] dl.cpp dt {
    background-color: #f6f8fa;
    border-left: 3px solid #0066b8;
}

/* Function signatures in Dracula theme */
html[data-theme="dark"] dl.cpp dt {
    background-color: #282a36;
    border-left: 3px solid #bd93f9;
}