/* Math rendering for notebooks */
.arithmatex {
    overflow-x: auto;
    overflow-y: hidden;
}

.arithmatex .MathJax {
    padding: 0.25em 0;
}

/* Ensure math is properly displayed in notebooks */
.jp-RenderedHTMLCommon .arithmatex {
    margin: 0.5em 0;
}

/* Fix for inline math in notebooks */
.highlight .arithmatex {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
}

/* Notebook math display */
mjx-container {
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
}

/* Dark mode math */
[data-md-color-scheme="slate"] mjx-container {
    color: #fff;
}

/* Hide import cells in notebooks */
.jp-InputArea .jp-InputPrompt + .jp-CodeMirrorEditor .CodeMirror-line:first-child:contains("import") {
    display: none;
}

/* Hide cells with matplotlib setup */
.jp-Cell:has(.jp-CodeMirrorEditor:contains("%matplotlib inline")) {
    display: none;
}

/* Alternative: Hide specific code patterns */
.highlight:has(code:contains("import matplotlib")) {
    display: none;
}

/* Hide notebook cells with specific comments */
.highlight:has(code:contains("# Setup matplotlib")) {
    display: none;
}

/* Show/hide toggle for code cells */
.notebook-toggle {
    background: #f0f0f0;
    border: 1px solid #ddd;
    padding: 5px 10px;
    cursor: pointer;
    margin-bottom: 10px;
}

.notebook-toggle:hover {
    background: #e0e0e0;
}

/* Initially hide import cells */
.imports-hidden .highlight:has(code:contains("import")) {
    display: none;
}
