
/* CSS Reset for notebook-wrapper isolation */
.notebook-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-color);
    box-sizing: border-box;
    /* Reset common inherited styles */
    text-align: left;
    text-decoration: none;
    text-transform: none;
    letter-spacing: normal;
    word-spacing: normal;
    white-space: normal;
    vertical-align: baseline;
}

.notebook-wrapper *, 
.notebook-wrapper *::before, 
.notebook-wrapper *::after {
    box-sizing: border-box;
}

/* Minimal reset - only override problematic WordPress styles */
.notebook-wrapper button,
.notebook-wrapper input,
.notebook-wrapper select,
.notebook-wrapper textarea {
    font-family: inherit;
    font-size: inherit;
}

:root {
    --primary-color: #4285f4;
    --border-color: #dadce0;
    --bg-color: #fafafa;
    --hover-bg: #f8f9fa;
    --text-color: #212121;
    --cell-bg: #fafafa;
    --cell-shadow: 0 1px 2px 0 rgba(60,64,67,.30), 0 1px 3px 1px rgba(60,64,67,.15);

    /* New Variables */
    --secondary-text-color: #5f6368;
    --toolbar-bg: #f8f9fa;
    --run-btn-bg: #ffffff;
    --run-btn-hover-bg: #f1f3f4;
    --editor-bg: #fafafa;
    --editor-text-color: #212121;
    --line-numbers-bg: #f8f9fa;
    --line-numbers-color: #9aa0a6;
    --line-numbers-border: #e8eaed;
    --cell-header-bg: rgba(255, 255, 255, 0.95);
    --code-bg: #f6f8fa;
    --pre-bg: #f6f8fa;
    --menu-bg: #ffffff;
    --preview-bg: #ffffff;
    --comment-bg: #f1f3f4;
    
    /* Google Colab Light Syntax Highlighting */
    --token-comment: #188038;
    --token-string: #c5221f;
    --token-keyword: #1967d2;
    --token-number: #188038;
    --token-function: #9334e6;
    --token-operator: #212121;
    --token-builtin: #1967d2;
    --token-class: #9334e6;
    --token-constant: #188038;
    --token-variable: #212121;
    --token-punctuation: #212121;
    --token-decorator: #e37400;
    --token-boolean: #1967d2;
}

/* Widget styles */
.notebook-wrapper .widget-display{
    padding: 8px 0;
    min-height: 40px;
}

.notebook-wrapper .widget-loading{
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--secondary-text-color);
    font-size: 13px;
    padding: 8px 12px;
    background: var(--hover-bg);
    border-radius: 4px;
}

.notebook-wrapper .widget-loading::before{
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ipywidgets styles */
.notebook-wrapper .jupyter-widget{
    padding: 4px 0;
}

.notebook-wrapper .widget-container-row{
    display: flex;
    align-items: center;
    gap: 12px;
}

.notebook-wrapper .widget-label{
    min-width: 100px;
    font-size: 14px;
    color: var(--text-color);
}

.notebook-wrapper .widget-slider-input{
    flex: 1;
    height: 6px;
    accent-color: var(--primary-color);
}

.notebook-wrapper .widget-value{
    min-width: 50px;
    text-align: right;
    font-family: 'Fira Code', monospace;
    font-size: 13px;
    color: var(--secondary-text-color);
}

.notebook-wrapper .widget-button-el{
    padding: 6px 16px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--hover-bg);
    color: var(--text-color);
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.notebook-wrapper .widget-button-el:hover{
    background: var(--primary-color);
    color: white;
}

.notebook-wrapper .widget-text-input{
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--editor-bg);
    color: var(--text-color);
    font-size: 14px;
}

.notebook-wrapper .widget-dropdown-select{
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--editor-bg);
    color: var(--text-color);
    font-size: 14px;
}

.notebook-wrapper .widget-checkbox-input{
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
}

.notebook-wrapper .widget-vbox{
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.notebook-wrapper .widget-hbox{
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: center;
}

.notebook-wrapper .widget-output{
    padding: 8px;
    background: var(--pre-bg);
    border-radius: 4px;
}

.notebook-wrapper .widget-output pre{
    margin: 0;
    font-family: 'Fira Code', monospace;
    font-size: 13px;
}

.notebook-wrapper .widget-html{
    padding: 4px;
}

.notebook-wrapper .widget-placeholder{
    padding: 8px;
    color: var(--secondary-text-color);
    font-size: 13px;
}

.notebook-wrapper .widget-placeholder details{
    margin-top: 4px;
}

.notebook-wrapper .widget-placeholder pre{
    font-size: 11px;
    max-height: 150px;
    overflow: auto;
    background: var(--pre-bg);
    padding: 8px;
    border-radius: 4px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Pip install animation styles */
.notebook-wrapper .pip-install-container{
    background: var(--pre-bg);
    border-radius: 8px;
    padding: 16px;
    margin: 8px 0;
    border: 1px solid var(--border-color);
}

.notebook-wrapper .pip-header{
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-color);
}

.notebook-wrapper .pip-spinner{
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.notebook-wrapper .pip-title{
    flex: 1;
}

.notebook-wrapper .pip-packages{
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.notebook-wrapper .pip-package{
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--hover-bg);
    border-radius: 16px;
    font-size: 12px;
    color: var(--secondary-text-color);
    font-family: 'Fira Code', monospace;
}

.notebook-wrapper .pip-package i{
    font-size: 10px;
}

.notebook-wrapper .pip-package.installed{
    background: rgba(52, 168, 83, 0.15);
    color: #34a853;
}

.notebook-wrapper .pip-package.installed i{
    color: #34a853;
}

.notebook-wrapper .pip-status{
    font-size: 13px;
    color: var(--secondary-text-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.notebook-wrapper .pip-status i{
    color: var(--primary-color);
}

[data-site-scheme="dark"] {
    --primary-color: #8ab4f8;
    --border-color: #3c4043;
    --bg-color: #1a1a1a;
    --hover-bg: #303134;
    --text-color: #e8eaed;
    --cell-bg: #1a1a1a;
    --cell-shadow: 0 1px 2px 0 rgba(0,0,0,.30), 0 1px 3px 1px rgba(0,0,0,.15);

    --secondary-text-color: #9aa0a6;
    --toolbar-bg: #202124;
    --run-btn-bg: #202124;
    --run-btn-hover-bg: #303134;
    --editor-bg: #1a1a1a;
    --editor-text-color: #e8eaed;
    --line-numbers-bg: #202124;
    --line-numbers-color: #5f6368;
    --line-numbers-border: #3c4043;
    --cell-header-bg: rgba(32, 33, 36, 0.9);
    --code-bg: #3c4043;
    --pre-bg: #202124;
    --menu-bg: #202124;
    --preview-bg: #1a1a1a;
    --comment-bg: #303134;

    /* Dark Mode Syntax Highlighting */
    --token-comment: #6a9955;
    --token-string: #ce9178;
    --token-keyword: #569cd6;
    --token-number: #b5cea8;
    --token-function: #dcdcaa;
    --token-operator: #d4d4d4;
    --token-builtin: #569cd6;
}

.notebook-wrapper{
    font-family: 'Roboto', Arial, sans-serif;
    margin: 0;
    padding: 0;
    color: var(--text-color);
}

/* Custom Scrollbar */
.notebook-wrapper ::-webkit-scrollbar{
    width: 8px;
    height: 8px;
}

.notebook-wrapper ::-webkit-scrollbar-track{
    background: transparent;
}

.notebook-wrapper ::-webkit-scrollbar-thumb{
    background: #dadce0;
    border-radius: 4px;
}

.notebook-wrapper ::-webkit-scrollbar-thumb:hover{
    background: #bdc1c6;
}

[data-site-scheme="dark"] ::-webkit-scrollbar-thumb {
    background: #5f6368;
}

[data-site-scheme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #80868b;
}

.notebook-wrapper .header{
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    border-bottom: 1px solid var(--border-color);
}

.notebook-wrapper .header-left{
    display: flex;
    align-items: center;
}

.notebook-wrapper .logo{
    width: 32px;
    height: 32px;
    margin-right: 12px;
}

.notebook-wrapper .header-right{
    display: flex;
    align-items: center;
    gap: 16px;
}

.notebook-wrapper .toolbar{
    display: flex;
    align-items: center;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border-color);
    gap: 8px;
}

.notebook-wrapper .lab-label{
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 20px;
    color: var(--text-color);
    white-space: nowrap;
}

.notebook-wrapper .toolbar-right{
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.notebook-wrapper .btn-tool{
    background: none;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--text-color);
}

.notebook-wrapper .btn-tool:hover{
    background-color: var(--hover-bg);
    color: var(--primary-color);
}

.notebook-wrapper .toolbar-divider{
    width: 1px;
    height: 24px;
    background-color: var(--border-color);
    margin: 0 8px;
}

/* Wide layout for notebook */
#notebook-container,
.notebook-wrapper .notebook-container{
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: transparent;
    padding: 20px;
    border: none;
    width: 90vw !important;
    max-width: 98vw !important;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    margin: 0 auto;
}

.notebook-wrapper .header{
    width: 90vw !important;
    max-width: 98vw !important;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    margin: 0 auto;
}

.notebook-wrapper .toolbar{
    width: 90vw !important;
    max-width: 98vw !important;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    margin: 0 auto;
}

/* Toast container - fixed in bottom right corner */
#toast-container,
.toast-container{
    position: fixed !important;
    bottom: 24px !important;
    right: 24px !important;
    left: auto !important;
    top: auto !important;
    width: auto !important;
    max-width: 400px !important;
    transform: none !important;
    margin: 0 !important;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.notebook-wrapper #confirm-modal{
    width: 90vw !important;
    max-width: 98vw !important;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    margin: 0 auto;
}

@media (max-width: 992px) {
    .notebook-wrapper #notebook-container,
    .notebook-wrapper .notebook-container,
    .notebook-wrapper .header,
    .notebook-wrapper .toolbar,
    .notebook-wrapper #confirm-modal {
        width: 99vw !important;
        max-width: 99vw !important;
        left: 50%;
        transform: translateX(-50%);
    }
    
    /* Tablet: Adjust editor width */
    .notebook-wrapper .cell-wrapper {
        border-radius: 6px !important;
    }
    
    .notebook-wrapper .run-button-container {
        width: 36px;
        min-width: 36px;
    }
}

@media (max-width: 768px) {
    .notebook-wrapper #notebook-container,
    .notebook-wrapper .notebook-container,
    .notebook-wrapper .header,
    .notebook-wrapper .toolbar,
    .notebook-wrapper #confirm-modal {
        width: 100vw !important;
        max-width: 100vw !important;
        left: 0;
        transform: none;
        padding: 8px;
    }
    
    #toast-container,
    .toast-container {
        right: 12px !important;
        bottom: 12px !important;
        max-width: calc(100vw - 24px) !important;
    }
    
    /* Mobile: Toolbar */
    .notebook-wrapper .toolbar {
        flex-wrap: wrap;
        gap: 6px;
        padding: 8px 12px;
        justify-content: flex-start;
    }
    
    .notebook-wrapper .btn-tool {
        padding: 8px 12px;
        font-size: 13px;
        flex: 0 0 auto;
    }
    
    .notebook-wrapper .btn-tool i {
        font-size: 14px;
    }
    
    /* Hide text on smaller screens, show only icons */
    .notebook-wrapper .toolbar-divider {
        display: none;
    }
    
    .notebook-wrapper .toolbar-right {
        width: 100%;
        justify-content: flex-end;
        margin-top: 4px;
        padding-top: 8px;
        border-top: 1px solid var(--border-color);
    }
    
    /* Mobile: Cells */
    .notebook-wrapper .cell {
        margin-bottom: 12px;
        gap: 6px;
    }
    
    .notebook-wrapper .cell-gutter {
        width: 32px;
        padding-top: 8px;
    }
    
    .notebook-wrapper .execution-count {
        font-size: 10px;
    }
    
    .notebook-wrapper .cell-wrapper {
        border-radius: 6px !important;
    }
    
    .notebook-wrapper .run-button-container {
        width: 36px;
        min-width: 36px;
        padding-top: 6px;
    }
    
    .notebook-wrapper .run-btn {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .notebook-wrapper .execution-time {
        font-size: 9px;
    }
    
    /* Mobile: Editor */
    .notebook-wrapper .editor-container {
        min-height: 80px;
    }
    
    .notebook-wrapper .editor {
        font-size: 14px !important;
        padding: 12px !important;
        line-height: 1.5 !important;
    }
    
    .notebook-wrapper .line-numbers {
        width: 32px;
        font-size: 11px;
        padding: 12px 4px;
    }
    
    /* Mobile: Cell actions */
    .notebook-wrapper .cell-actions {
        top: 4px;
        right: 4px;
        gap: 2px;
    }
    
    .notebook-wrapper .cell-actions button {
        width: 26px;
        height: 26px;
        font-size: 11px;
    }
    
    /* Mobile: Output */
    .notebook-wrapper .cell-output {
        padding: 10px 12px;
        font-size: 12px;
        max-height: 300px;
    }
    
    /* Mobile: Text cell */
    .notebook-wrapper .text-cell .cell-input {
        font-size: 15px;
        padding: 14px;
    }
    
    .notebook-wrapper .cell-preview {
        font-size: 15px;
        padding: 14px;
    }
    
    .notebook-wrapper .text-editor-container {
        flex-direction: column;
    }
    
    .notebook-wrapper .text-cell .cell-input {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        min-height: 100px;
    }
    
    /* Mobile: Text toolbar */
    .notebook-wrapper .text-toolbar {
        flex-wrap: wrap;
        padding: 6px 8px;
        gap: 4px;
    }
    
    .notebook-wrapper .text-tool-btn {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }
    
    /* Mobile: Floating actions */
    .notebook-wrapper .floating-actions {
        transform: scale(0.9);
    }
    
    .notebook-wrapper .btn-floating {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    /* Mobile: Cell rendered */
    .notebook-wrapper .cell-rendered {
        font-size: 15px;
        padding: 12px;
    }
    
    .notebook-wrapper .cell-rendered h1 { font-size: 1.6em; }
    .notebook-wrapper .cell-rendered h2 { font-size: 1.4em; }
    .notebook-wrapper .cell-rendered h3 { font-size: 1.2em; }
    
    /* Mobile: Section folding */
    .notebook-wrapper .section-collapse-toggle {
        width: 28px;
        height: 28px;
        left: -28px;
    }
    
    .notebook-wrapper .section-collapsed-info {
        font-size: 12px;
        padding: 6px 10px;
    }
    
    .notebook-wrapper .section-run-btn {
        width: 28px;
        height: 28px;
    }
}

@media (max-width: 480px) {
    /* Small mobile: Even more compact */
    .notebook-wrapper .toolbar {
        padding: 6px 8px;
        gap: 4px;
    }
    
    .notebook-wrapper .btn-tool {
        padding: 6px 8px;
        font-size: 11px;
    }
    
    /* Hide button text, show only icons */
    .notebook-wrapper .btn-tool span,
    .notebook-wrapper .btn-tool:not(.toggle-all-btn)::after {
        display: none;
    }
    
    .notebook-wrapper .btn-tool i {
        margin-right: 0;
    }
    
    .notebook-wrapper .cell-gutter {
        width: 28px;
    }
    
    .notebook-wrapper .run-button-container {
        width: 32px;
        min-width: 32px;
    }
    
    .notebook-wrapper .run-btn {
        width: 24px;
        height: 24px;
        font-size: 10px;
    }
    
    .notebook-wrapper .editor {
        font-size: 13px !important;
        padding: 10px !important;
    }
    
    .notebook-wrapper .line-numbers {
        width: 28px;
        font-size: 10px;
    }
    
    .notebook-wrapper .cell-actions {
        opacity: 1 !important;
    }
    
    .notebook-wrapper .cell-actions button {
        width: 24px;
        height: 24px;
        font-size: 10px;
    }
    
    .notebook-wrapper .text-cell .cell-input,
    .notebook-wrapper .cell-preview {
        font-size: 14px;
        padding: 12px;
    }
    
    .notebook-wrapper .cell-rendered {
        font-size: 14px;
        padding: 10px;
    }
    
    /* Small mobile: Floating actions */
    .notebook-wrapper .floating-actions {
        flex-direction: column;
        gap: 4px;
    }
    
    .notebook-wrapper .btn-floating {
        padding: 8px;
        font-size: 11px;
        width: 100%;
        justify-content: center;
    }
    
    /* Small mobile: Toast */
    .toast {
        min-width: 200px !important;
        font-size: 13px !important;
        padding: 10px 12px !important;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    /* Always show cell actions on touch devices */
    .notebook-wrapper .cell-actions {
        opacity: 1 !important;
    }
    
    /* Larger touch targets */
    .notebook-wrapper .btn-tool,
    .notebook-wrapper .run-btn,
    .notebook-wrapper .cell-actions button,
    .notebook-wrapper .text-tool-btn,
    .notebook-wrapper .btn-floating {
        min-height: 44px;
        min-width: 44px;
    }
    
    .notebook-wrapper .section-collapse-toggle {
        min-width: 44px;
        min-height: 44px;
    }
    
    /* Always show floating actions on touch */
    .notebook-wrapper .cell-separator {
        opacity: 1;
    }
}

.notebook-wrapper .cell{
    margin-bottom: 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    transition: border-color 0.2s;
    position: relative;
    display: flex;
    gap: 10px;
    /* Reset potential WordPress theme styles */
    background: transparent !important;
    box-shadow: none !important;
    outline: none !important;
    padding: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.notebook-wrapper .text-cell {
    /* Reset potential WordPress theme styles */
    background: transparent !important;
    box-shadow: none !important;
    outline: none !important;
    border: none !important;
}

.notebook-wrapper .cell-gutter{
    width: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 12px;
    flex-shrink: 0;
}

.notebook-wrapper .execution-count{
    font-family: monospace;
    font-size: 12px;
    color: var(--secondary-text-color);
    margin-bottom: 4px;
}

.notebook-wrapper .execution-status{
    font-size: 14px;
}

.notebook-wrapper .execution-status.success{ color: #34a853; }
.notebook-wrapper .execution-status.error{ color: #ea4335; }

.notebook-wrapper .cell-main{
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Fix flex overflow */
}

.notebook-wrapper .cell-wrapper{
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    background: var(--cell-bg) !important;
    position: relative;
    box-shadow: none;
    outline: none;
    overflow: hidden;
}

.notebook-wrapper .cell-inner{
    display: flex;
    flex-direction: row;
    width: 100%;
    position: relative; /* For absolute positioning of actions */
}

.notebook-wrapper .cell.active .cell-wrapper{
    border-color: var(--primary-color);
    box-shadow: var(--cell-shadow);
}

.notebook-wrapper .run-button-container{
    width: 40px;
    min-width: 40px; /* Prevent shrinking */
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 8px;
    background: var(--run-btn-container-bg);
    border-right: 1px solid var(--border-color);
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
    flex-shrink: 0;
}

.notebook-wrapper .execution-time{
    font-size: 10px;
    color: var(--secondary-text-color);
    margin-top: 4px;
    text-align: center;
    font-family: monospace;
    transition: color 0.2s ease;
}

.notebook-wrapper .execution-time.running{
    color: var(--primary-color);
    animation: pulse-timer 1s ease-in-out infinite;
}

@keyframes pulse-timer {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.notebook-wrapper .cell-run-btn{
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-color);
    background: var(--run-btn-bg);
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-color);
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
    margin: 0;
    position: relative; /* Ensure pseudo-elements are positioned relative to button */
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.notebook-wrapper .cell-run-btn.running{
    border-color: transparent;
}

.notebook-wrapper .cell-run-btn.running::after{
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: var(--primary-color);
    border-right-color: var(--primary-color);
    animation: spin 1s linear infinite;
    box-sizing: border-box;
}

.notebook-wrapper .cell-run-btn:hover{
    background-color: var(--run-btn-hover-bg);
    box-shadow: 0 1px 2px rgba(60,64,67,0.3);
}

.notebook-wrapper .editor-container{
    flex-grow: 1;
    display: flex;
    position: relative;
    background: var(--editor-bg);
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
    min-width: 0; /* Allow container to shrink for scrolling */
}

.notebook-wrapper .line-numbers{
    padding: 10px 4px;
    background: var(--line-numbers-bg);
    color: var(--line-numbers-color);
    font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
    font-size: 12.8px;
    text-align: right;
    user-select: none;
    min-width: 40px;
    border-right: 1px solid var(--line-numbers-border);
    line-height: 21px;
}

.notebook-wrapper .editor{
    flex-grow: 1;
    padding: 10px;
    font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
    font-size: 14px;
    line-height: 21px; /* 1.5 * 14px */
    outline: none;
    white-space: pre !important; /* Force no wrapping */
    overflow-x: auto;
    color: var(--editor-text-color); /* Darker text for better contrast */
    min-width: 0; /* Allow shrinking for scroll */
}

/* Syntax Highlighting Colors (Google Colab-like) */
.notebook-wrapper .token.comment{ color: var(--token-comment); font-style: italic; }
.notebook-wrapper .token.string{ color: var(--token-string); }
.notebook-wrapper .token.keyword{ color: var(--token-keyword); font-weight: 600; }
.notebook-wrapper .token.number{ color: var(--token-number); }
.notebook-wrapper .token.function{ color: var(--token-function); }
.notebook-wrapper .token.operator{ color: var(--token-operator); }
.notebook-wrapper .token.builtin{ color: var(--token-builtin); font-weight: 600; }
.notebook-wrapper .token.boolean{ color: var(--token-boolean); font-weight: 600; }
.notebook-wrapper .token.class-name{ color: var(--token-class); }
.notebook-wrapper .token.decorator{ color: var(--token-decorator); }
.notebook-wrapper .token.constant{ color: var(--token-constant); }
.notebook-wrapper .token.punctuation{ color: var(--token-punctuation); }

/* Python specific */
.notebook-wrapper .token.triple-quoted-string{ color: var(--token-string); }
.token.keyword.def,
.notebook-wrapper .token.keyword.class{ color: var(--token-keyword); font-weight: 600; }

/* Markdown Specific Highlighting */
.language-markdown .token.title,
.notebook-wrapper .language-markdown .token.header{
    color: #1967d2; /* Colab Blue for headers */
    font-weight: bold;
}

.notebook-wrapper .language-markdown .token.list.punctuation{
    color: #1155cc; /* Blue bullets/numbers */
}

.notebook-wrapper .language-markdown .token.bold{
    font-weight: bold;
    color: #000;
}

.notebook-wrapper .language-markdown .token.italic{
    font-style: italic;
    color: #000;
}

.notebook-wrapper .language-markdown .token.code-snippet{
    color: #a31515; /* Reddish for code */
    font-family: monospace;
}

.notebook-wrapper .language-markdown .token.url{
    color: #a31515;
    text-decoration: underline;
}

.notebook-wrapper .language-markdown .token.hr{
    color: #1155cc;
}

.notebook-wrapper .cell-header{
    position: absolute;
    right: 4px;
    top: 4px;
    display: none; /* Show only on hover */
    background: var(--cell-header-bg);
    border-radius: 4px;
    padding: 2px;
    z-index: 10;
}

.notebook-wrapper .cell:hover .cell-header{
    display: flex;
}

.notebook-wrapper .cell-output{
    padding: 12px 16px;
    font-size: 13px;
    font-family: 'Roboto Mono', 'Consolas', 'Monaco', monospace;
    color: var(--text-color);
    border-top: 1px solid var(--border-color);
    margin-top: 4px;
    max-height: 650px;
    overflow-y: auto;
    overflow-x: auto;
    background: transparent;
    border-radius: 0 0 8px 8px;
}

.notebook-wrapper .cell-output pre{
    margin: 0;
    padding: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    font-size: inherit;
    line-height: 1.5;
    background: transparent;
}

.notebook-wrapper .cell-output .output-stream{
    margin-bottom: 2px;
}

.notebook-wrapper .cell-output .output-stream pre{
    display: inline;
}

.notebook-wrapper .cell-output .output-stderr pre{
    color: #e53935;
}

.notebook-wrapper .cell-output .output-result{
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border-color);
}

.notebook-wrapper .cell-output .output-result .output-text{
    color: var(--token-string);
}

.notebook-wrapper .cell-output .output-display{
    margin: 8px 0;
}

.notebook-wrapper .cell-output .output-image{
    max-width: 100%;
    border-radius: 4px;
}

/* Plotly interactive graphs */
.notebook-wrapper .cell-output .plotly-graph{
    min-height: 400px;
    width: 100%;
    margin: 8px 0;
    /* Performance optimization */
    will-change: transform;
    contain: layout style paint;
}

.cell-output .output-result .plotly-graph,
.notebook-wrapper .cell-output .output-display .plotly-graph{
    border-radius: 4px;
    overflow: hidden;
}

/* Optimize Plotly canvas rendering */
.notebook-wrapper .cell-output .plotly-graph canvas{
    /* Hint browser for frequent readback operations */
    image-rendering: optimizeSpeed;
}

/* Smooth scrolling for Plotly containers */
.notebook-wrapper .cell-output .plotly-graph .scrollbox{
    scroll-behavior: smooth;
}

/* ipywidgets support */
.notebook-wrapper .cell-output .widget-container{
    margin: 8px 0;
    min-height: 40px;
}

.notebook-wrapper .cell-output .widget-text-repr{
    background: var(--hover-bg);
    border-left: 3px solid var(--primary-color);
    padding: 10px;
    border-radius: 4px;
}

.notebook-wrapper .cell-output .widget-text-repr pre{
    margin: 0 0 8px 0;
    color: var(--text-color);
}

.notebook-wrapper .cell-output .widget-hint{
    font-size: 13px;
    color: var(--secondary-text-color);
    margin-top: 8px;
}

.notebook-wrapper .cell-output .widget-placeholder{
    background: var(--hover-bg);
    border: 1px dashed var(--border-color);
    padding: 15px;
    text-align: center;
    border-radius: 4px;
    color: var(--secondary-text-color);
    font-size: 14px;
}

.notebook-wrapper .cell-output .widget-loading{
    color: var(--secondary-text-color);
    padding: 10px;
    font-size: 14px;
}

.notebook-wrapper .cell-output .widget-error{
    color: #ff9800;
    padding: 10px;
    font-size: 14px;
    background: rgba(255, 152, 0, 0.1);
    border-left: 3px solid #ff9800;
    border-radius: 4px;
}

.notebook-wrapper .cell-output .widget-container .widget-subarea{
    /* ipywidgets render area */
    margin: 0;
}

/* Error styling like Google Colab */
.notebook-wrapper .cell-output .output-error{
    background: linear-gradient(to right, #ffebee 0%, transparent 100%);
    border-left: 3px solid #e53935;
    padding: 12px;
    margin: 8px 0;
    border-radius: 0 4px 4px 0;
}

[data-site-scheme="dark"] .cell-output .output-error {
    background: linear-gradient(to right, rgba(229, 57, 53, 0.15) 0%, transparent 100%);
}

.notebook-wrapper .cell-output .error-header{
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-weight: 500;
}

.notebook-wrapper .cell-output .error-header i{
    color: #e53935;
    font-size: 16px;
}

.notebook-wrapper .cell-output .error-name{
    color: #e53935;
    font-family: 'Roboto Mono', monospace;
    font-weight: 600;
}

.notebook-wrapper .cell-output .error-value{
    color: #c62828;
    font-family: 'Roboto Mono', monospace;
}

[data-site-scheme="dark"] .cell-output .error-value {
    color: #ef9a9a;
}

.notebook-wrapper .cell-output .error-traceback{
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-color);
    background: transparent;
    padding: 8px 0;
    margin: 0;
    white-space: pre-wrap;
}

/* ANSI color classes for traceback */
.notebook-wrapper .ansi-red{ color: #e53935; }
.notebook-wrapper .ansi-green{ color: #43a047; }
.notebook-wrapper .ansi-yellow{ color: #fb8c00; }
.notebook-wrapper .ansi-blue{ color: #1e88e5; }
.notebook-wrapper .ansi-magenta{ color: #8e24aa; }
.notebook-wrapper .ansi-cyan{ color: #00acc1; }
.notebook-wrapper .ansi-bold{ font-weight: 600; }

[data-site-scheme="dark"] .ansi-red { color: #ef5350; }
[data-site-scheme="dark"] .ansi-green { color: #66bb6a; }
[data-site-scheme="dark"] .ansi-yellow { color: #ffa726; }
[data-site-scheme="dark"] .ansi-blue { color: #42a5f5; }
[data-site-scheme="dark"] .ansi-magenta { color: #ab47bc; }
[data-site-scheme="dark"] .ansi-cyan { color: #26c6da; }

/* tqdm progress bar styling */
.notebook-wrapper .cell-output .output-display{
    margin: 4px 0;
}

/* tqdm notebook HTML widget styling */
.notebook-wrapper .cell-output .output-display .progress{
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0;
}

.notebook-wrapper .cell-output .output-display .progress-bar-wrap{
    flex: 1;
    height: 22px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.notebook-wrapper .cell-output .output-display .progress-bar{
    height: 100%;
    background: linear-gradient(90deg, #4285f4, #34a853);
    border-radius: 4px;
    transition: width 0.1s ease;
}

.notebook-wrapper .cell-output .output-display progress{
    flex: 1;
    height: 22px;
    border-radius: 4px;
    appearance: none;
    -webkit-appearance: none;
}

.notebook-wrapper .cell-output .output-display progress::-webkit-progress-bar{
    background: var(--border-color);
    border-radius: 4px;
}

.notebook-wrapper .cell-output .output-display progress::-webkit-progress-value{
    background: linear-gradient(90deg, #4285f4, #34a853);
    border-radius: 4px;
}

.notebook-wrapper .cell-output .output-display progress::-moz-progress-bar{
    background: linear-gradient(90deg, #4285f4, #34a853);
    border-radius: 4px;
}

/* tqdm text formatting */
.notebook-wrapper .cell-output .output-display span{
    font-family: 'Roboto Mono', monospace;
    font-size: 12px;
    color: var(--secondary-text-color);
}

/* Scrollbar for output */
.notebook-wrapper .cell-output::-webkit-scrollbar{
    width: 6px;
    height: 6px;
}

.notebook-wrapper .cell-output::-webkit-scrollbar-track{
    background: transparent;
}

.notebook-wrapper .cell-output::-webkit-scrollbar-thumb{
    background: var(--border-color);
    border-radius: 3px;
}

.notebook-wrapper .cell-output::-webkit-scrollbar-thumb:hover{
    background: var(--secondary-text-color);
}

/* Text Toolbar */
.notebook-wrapper .text-toolbar{
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
    background: var(--toolbar-bg);
    border-bottom: 1px solid var(--border-color);
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.notebook-wrapper .text-tools-left, .notebook-wrapper .text-tools-right{
    display: flex;
    gap: 4px;
    align-items: center;
}

.notebook-wrapper .toolbar-divider-vertical{
    width: 1px;
    height: 20px;
    background-color: var(--border-color);
    margin: 0 8px;
}

.notebook-wrapper .text-tool-btn{
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    color: var(--secondary-text-color);
    font-size: 14px;
}

.notebook-wrapper .text-tool-btn.close-btn{
    color: var(--primary-color);
    font-weight: 500;
    font-size: 13px;
}

.notebook-wrapper .text-tool-btn.close-btn:hover{
    background-color: var(--hover-bg);
}

.notebook-wrapper .text-toolbar .btn-run{
    background: var(--run-btn-bg);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-color);
    transition: background 0.15s, transform 0.1s;
}

.notebook-wrapper .text-toolbar .btn-run:hover{
    background: var(--run-btn-hover-bg);
    transform: scale(1.05);
}

.notebook-wrapper .text-toolbar .btn-run i{
    font-size: 12px;
}

.notebook-wrapper .text-tool-btn:hover{
    background-color: var(--hover-bg);
    color: var(--text-color);
}

.notebook-wrapper .text-cell .cell-wrapper{
    border: none !important;
    flex-direction: column;
    background: transparent !important;
}

.notebook-wrapper .text-cell .cell-wrapper.rendered-mode{
    border: none !important;
    background: transparent !important;
}

/* Split Editor Styles */
.notebook-wrapper .text-editor-container{
    display: flex;
    border-top: none;
    min-height: 100px;
    background: var(--editor-bg);
    border-radius: 8px;
}

.notebook-wrapper .text-editor-container.hidden{
    display: none;
}

.notebook-wrapper .text-cell .cell-input{
    flex: 1;
    padding: 20px;
    min-height: 80px;
    outline: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.7;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    white-space: pre-wrap;
    color: var(--text-color);
    background: var(--editor-bg);
}

.notebook-wrapper .cell-preview{
    flex: 1;
    padding: 20px;
    background-color: var(--preview-bg);
    overflow-y: auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.7;
}

.notebook-wrapper .cell-preview img{
    max-width: 100%;
}

.notebook-wrapper .text-cell.active .cell-wrapper{
    border: none !important;
    box-shadow: none !important;
    background: var(--editor-bg) !important;
    border-radius: 8px !important;
}

.notebook-wrapper .text-cell.active .cell-wrapper.rendered-mode{
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

.notebook-wrapper .text-cell .run-button-container{
    display: none;
}

.notebook-wrapper .text-cell .line-numbers{
    display: none;
}

/* Dark mode for text cells */
[data-site-scheme="dark"] .text-cell .cell-wrapper,
[data-scheme="dark"] .notebook-wrapper .text-cell .cell-wrapper{
    background: transparent !important;
    border: none !important;
}

[data-site-scheme="dark"] .text-cell .cell-input,
[data-scheme="dark"] .notebook-wrapper .text-cell .cell-input{
    background: var(--editor-bg);
    color: var(--editor-text-color);
    border-color: var(--border-color);
}

[data-site-scheme="dark"] .cell-preview,
[data-scheme="dark"] .notebook-wrapper .cell-preview{
    background: var(--preview-bg);
    color: var(--text-color);
}

[data-site-scheme="dark"] .text-cell .cell-rendered,
[data-scheme="dark"] .notebook-wrapper .text-cell .cell-rendered{
    color: var(--text-color);
}

[data-site-scheme="dark"] .text-cell .text-toolbar,
[data-scheme="dark"] .notebook-wrapper .text-cell .text-toolbar{
    background: var(--toolbar-bg);
    border-color: var(--border-color);
}

[data-site-scheme="dark"] .text-cell .text-toolbar .btn-run,
[data-scheme="dark"] .notebook-wrapper .text-cell .text-toolbar .btn-run{
    background: var(--run-btn-bg);
    color: var(--text-color);
    border-color: var(--border-color);
}

[data-site-scheme="dark"] .text-cell .text-toolbar .btn-run:hover,
[data-scheme="dark"] .notebook-wrapper .text-cell .text-toolbar .btn-run:hover{
    background: var(--run-btn-hover-bg);
}

.notebook-wrapper .cell-actions{
    display: flex;
    gap: 8px;
}

.notebook-wrapper .action-btn{
    background: none;
    border: none;
    cursor: pointer;
    color: var(--secondary-text-color);
    padding: 5px;
    font-size: 14px;
}

.notebook-wrapper .action-btn:hover{
    color: var(--text-color);
}

/* Cell Menu Styles */
.notebook-wrapper .cell-menu-container{
    position: relative;
    display: inline-block;
}

.notebook-wrapper .cell-menu{
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background-color: var(--menu-bg);
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    border-radius: 4px;
    z-index: 100;
    min-width: 180px;
    padding: 8px 0;
}

.notebook-wrapper .cell-menu.show{
    display: block;
}

.notebook-wrapper .cell-menu-item{
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-color);
    white-space: nowrap;
}

.notebook-wrapper .cell-menu-item:hover{
    background-color: var(--hover-bg);
}

/* Markdown/LaTeX Styles */
.notebook-wrapper .cell-rendered{
    padding: 8px;
    min-height: 40px;
    font-size: 16px;
    line-height: 1.5;
}

.notebook-wrapper .cell-rendered p{
    margin: 0 0 10px 0;
}

.notebook-wrapper .cell-rendered p:last-child{
    margin-bottom: 0;
}

.notebook-wrapper .cell-rendered code{
    background-color: var(--code-bg);
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Courier New', Courier, monospace;
}

.notebook-wrapper .cell-rendered pre{
    background-color: var(--pre-bg);
    padding: 12px;
    border-radius: 4px;
    overflow-x: auto;
}

.notebook-wrapper .cell-rendered pre code{
    background-color: transparent;
    padding: 0;
}

.notebook-wrapper .hidden{
    display: none !important;
}

/* Kernel Status Styles */
.notebook-wrapper .kernel-status{
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
}

.notebook-wrapper .kernel-status:hover{
    background-color: var(--hover-bg);
}

.notebook-wrapper .status-dot{
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.notebook-wrapper .kernel-status.connected .status-dot{ background-color: #34a853; }
.notebook-wrapper .kernel-status.connecting .status-dot{ background-color: #fbbc05; }
.notebook-wrapper .kernel-status.disconnected .status-dot{ background-color: #ea4335; }

.notebook-wrapper .btn-icon{
    background: none;
    border: none;
    cursor: pointer;
    color: #5f6368;
    padding: 8px;
    font-size: 14px;
    transition: transform 0.3s;
}

.notebook-wrapper .btn-icon.collapsed{
    transform: rotate(180deg);
}

.notebook-wrapper .collapse-info{
    font-size: 12px;
    color: #5f6368;
    margin-left: 4px;
}

/* Floating Buttons Styles */
.notebook-wrapper .cell-separator{
    height: 20px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    margin: -8px 0;
    z-index: 10;
}

.notebook-wrapper .cell-separator:hover{
    opacity: 1;
}

.notebook-wrapper .floating-actions{
    display: flex;
    gap: 8px;
    background: white;
    padding: 4px;
    border-radius: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
}

.notebook-wrapper .btn-floating{
    background: none;
    border: none;
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 13px;
    cursor: pointer;
    color: #5f6368;
    display: flex;
    align-items: center;
    gap: 4px;
}

.notebook-wrapper .btn-floating:hover{
    background-color: var(--hover-bg);
    color: var(--primary-color);
}

/* Syntax Highlighting Overrides */
.notebook-wrapper .cell-input{
    white-space: pre-wrap;
    word-wrap: break-word;
}

.notebook-wrapper pre[class*="language-"]{
    margin: 0;
    padding: 0;
    background: transparent !important;
}

.notebook-wrapper .empty-text-placeholder{
    color: var(--secondary-text-color);
    font-style: italic;
    padding: 10px;
    user-select: none;
}

/* Comment Section */
.notebook-wrapper .comment-section{
    width: 100%;
    display: none;
}

.notebook-wrapper .comment-section.active{
    display: block;
}

.notebook-wrapper .comment-list {
    padding-top: 0 !important;
    border-top: none !important;
    margin: 0;
}

.notebook-wrapper .comment-form{
    padding: 12px 16px;
    background: var(--editor-bg);
    border-bottom: 1px solid var(--border-color);
}

/* Fix rounded corners for comment section */
.notebook-wrapper .comment-list .comment-display:first-child{
    border-top-left-radius: 7px;
    border-top-right-radius: 7px;
}

.notebook-wrapper .comment-list:empty + .comment-form{
    border-top-left-radius: 7px;
    border-top-right-radius: 7px;
}

.notebook-wrapper .comment-input{
    width: 100%;
    border: none;
    border-bottom: 2px solid var(--primary-color);
    outline: none;
    font-family: inherit;
    font-size: 14px;
    resize: none;
    padding-bottom: 4px;
    margin-bottom: 12px;
    background: transparent;
    color: var(--text-color);
}

.notebook-wrapper .comment-actions{
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.notebook-wrapper .comment-btn{
    background: none;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.notebook-wrapper .comment-btn.cancel{
    color: var(--secondary-text-color);
}

.notebook-wrapper .comment-btn.cancel:hover{
    background: var(--hover-bg);
}

.notebook-wrapper .comment-btn.ok{
    background: var(--comment-bg);
    color: var(--text-color);
}

.notebook-wrapper .comment-btn.ok:hover{
    background: var(--hover-bg);
}

.notebook-wrapper .comment-display{
    background: var(--comment-bg);
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
}

.notebook-wrapper .comment-close-btn{
    cursor: pointer;
    color: var(--secondary-text-color);
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

.notebook-wrapper .comment-close-btn:hover{
    background: var(--hover-bg);
    color: var(--text-color);
}

.notebook-wrapper .comment-text{
    flex-grow: 1;
}

/* Collapsed view - hide all cells and separators */
.notebook-wrapper .notebook-container.collapsed-view .cell,
.notebook-wrapper .notebook-container.collapsed-view .cell-separator,
.notebook-wrapper.collapsed-view .cell,
.notebook-wrapper.collapsed-view .cell-separator,
.notebook-container.collapsed-view .cell,
.notebook-container.collapsed-view .cell-separator,
.collapsed-view .cell,
.collapsed-view .cell-separator {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* AI Prompt Cell Styles */
.notebook-wrapper .ai-prompt-cell .editor-container{
    border-left: 3px solid #007aff;
}

.notebook-wrapper .ai-prompt-cell .editor:empty::before{
    content: "Сгенерируйте код с помощью искусственного интеллекта...";
    color: var(--secondary-text-color, #5f6368);
    font-style: italic;
    opacity: 0.7;
    pointer-events: none;
}

.notebook-wrapper .ai-prompt-cell .cell-gutter .execution-count{
    color: #007aff;
}

[data-site-scheme="dark"] .ai-prompt-cell .editor-container {
    border-left-color: #5ac8fa;
}

[data-site-scheme="dark"] .ai-prompt-cell .editor:empty::before {
    color: var(--secondary-text-color, #9aa0a6);
}

/* ============================================================================
   Prism.js Dark Theme Override - Remove background from tokens
   ============================================================================ */
[data-site-scheme="dark"] .token {
    background: none !important;
    text-shadow: none !important;
}

[data-site-scheme="dark"] code[class*="language-"],
[data-site-scheme="dark"] pre[class*="language-"] {
    background: transparent !important;
    text-shadow: none !important;
}

[data-site-scheme="dark"] .token.comment,
[data-site-scheme="dark"] .token.prolog,
[data-site-scheme="dark"] .token.doctype,
[data-site-scheme="dark"] .token.cdata {
    color: #6a9955 !important;
    background: none !important;
}

[data-site-scheme="dark"] .token.punctuation {
    color: #d4d4d4 !important;
    background: none !important;
}

[data-site-scheme="dark"] .token.property,
[data-site-scheme="dark"] .token.tag,
[data-site-scheme="dark"] .token.boolean,
[data-site-scheme="dark"] .token.number,
[data-site-scheme="dark"] .token.constant,
[data-site-scheme="dark"] .token.symbol {
    color: #b5cea8 !important;
    background: none !important;
}

[data-site-scheme="dark"] .token.selector,
[data-site-scheme="dark"] .token.attr-name,
[data-site-scheme="dark"] .token.string,
[data-site-scheme="dark"] .token.char,
[data-site-scheme="dark"] .token.builtin {
    color: #ce9178 !important;
    background: none !important;
}

[data-site-scheme="dark"] .token.operator,
[data-site-scheme="dark"] .token.entity,
[data-site-scheme="dark"] .token.url,
[data-site-scheme="dark"] .token.variable {
    color: #d4d4d4 !important;
    background: none !important;
}

[data-site-scheme="dark"] .token.atrule,
[data-site-scheme="dark"] .token.attr-value,
[data-site-scheme="dark"] .token.keyword {
    color: #569cd6 !important;
    background: none !important;
}

[data-site-scheme="dark"] .token.function,
[data-site-scheme="dark"] .token.class-name {
    color: #dcdcaa !important;
    background: none !important;
}

[data-site-scheme="dark"] .token.regex,
[data-site-scheme="dark"] .token.important {
    color: #d16969 !important;
    background: none !important;
}

[data-site-scheme="dark"] .token.decorator,
[data-site-scheme="dark"] .token.annotation {
    color: #dcdcaa !important;
    background: none !important;
}

/* ============================================================================
   DataFrame Table Styles - Styled like PySpark
   ============================================================================ */
.cell-output table.dataframe,
.notebook-wrapper .cell-output .dataframe{
    border-collapse: collapse;
    font-family: 'Roboto Mono', 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    margin: 8px 0;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    width: auto;
}

.notebook-wrapper .cell-output table.dataframe thead{
    background-color: var(--toolbar-bg);
    border-bottom: 2px solid var(--primary-color);
}

.notebook-wrapper .cell-output table.dataframe th{
    background-color: var(--toolbar-bg);
    color: var(--primary-color);
    font-weight: 600;
    text-align: center;
    padding: 10px 16px;
    border-right: 1px solid var(--border-color);
    white-space: nowrap;
}

.notebook-wrapper .cell-output table.dataframe th:last-child{
    border-right: none;
}

.notebook-wrapper .cell-output table.dataframe td{
    background-color: transparent;
    color: var(--text-color);
    text-align: right;
    padding: 8px 16px;
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.notebook-wrapper .cell-output table.dataframe td:last-child{
    border-right: none;
}

.notebook-wrapper .cell-output table.dataframe tbody tr:last-child td{
    border-bottom: none;
}

.cell-output table.dataframe th:first-child,
.notebook-wrapper .cell-output table.dataframe td:first-child{
    text-align: left;
    color: var(--secondary-text-color);
    font-weight: bold;
}

.notebook-wrapper .cell-output table.dataframe tbody tr:hover{
    background-color: var(--hover-bg);
}

.notebook-wrapper .cell-output table.dataframe tbody tr:nth-child(even){
    background-color: rgba(66, 133, 244, 0.03);
}

/* DataFrame index column styling */
.cell-output table.dataframe th.blank,
.notebook-wrapper .cell-output table.dataframe th.index_name{
    background-color: var(--toolbar-bg);
}

/* Remove default pandas styling overrides */
.cell-output table.dataframe,
.notebook-wrapper .cell-output table.dataframe *{
    box-sizing: border-box;
}

/* Scrollable large dataframes */
.notebook-wrapper .cell-output .dataframe-wrapper{
    overflow-x: auto;
    max-width: 100%;
}

/* Dark mode adjustments for pandas dataframe */
[data-site-scheme="dark"] .cell-output table.dataframe thead {
    background-color: #2d2d2d;
}

[data-site-scheme="dark"] .cell-output table.dataframe th {
    background-color: #2d2d2d;
    border-bottom-color: #3c4043;
    border-right-color: #3c4043;
}

[data-site-scheme="dark"] .cell-output table.dataframe td {
    border-bottom-color: #3c4043;
    border-right-color: #3c4043;
}

[data-site-scheme="dark"] .cell-output table.dataframe tbody tr:hover {
    background-color: #303134;
}

[data-site-scheme="dark"] .cell-output table.dataframe tbody tr:nth-child(even) {
    background-color: rgba(138, 180, 248, 0.05);
}

/* ============================================================================
   PySpark DataFrame ASCII Table Styles - Keep as +, -, | format
   ============================================================================ */
/* PySpark output uses pre-formatted ASCII tables - style them properly */
.notebook-wrapper .cell-output .output-stream pre{
    font-family: 'Roboto Mono', 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre;
    tab-size: 4;
}

/* PySpark ASCII table info text (row count, truncated notice) */
.notebook-wrapper .cell-output .pyspark-info{
    font-family: 'Roboto Mono', monospace;
    font-size: 11px;
    color: var(--secondary-text-color);
    margin-top: 4px;
    font-style: italic;
}

/* ============================================================================
   Stdin Input Styles - Inline input() handling
   ============================================================================ */
.notebook-wrapper .stdin-input-container{
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.notebook-wrapper .stdin-prompt{
    color: var(--text-color);
    font-family: 'Roboto Mono', monospace;
    font-size: 13px;
    white-space: pre;
}

.notebook-wrapper .stdin-input{
    flex: 1;
    padding: 6px 10px;
    font-family: 'Roboto Mono', monospace;
    font-size: 13px;
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    background-color: var(--bg-color);
    color: var(--text-color);
    outline: none;
}

.notebook-wrapper .stdin-input:focus{
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2);
}

[data-site-scheme="dark"] .stdin-input {
    background-color: #202124;
    border-color: #8ab4f8;
}

[data-site-scheme="dark"] .stdin-input:focus {
    box-shadow: 0 0 0 2px rgba(138, 180, 248, 0.2);
}

/* Live stdin input (from kernel input_request) */
.notebook-wrapper .stdin-live{
    animation: stdin-pulse 1.5s ease-in-out infinite;
}

@keyframes stdin-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.notebook-wrapper .stdin-response{
    color: #34a853;
    font-family: 'Roboto Mono', monospace;
    font-size: 13px;
    margin: 4px 0;
}

.notebook-wrapper .stdin-cancelled{
    color: #ea4335;
    font-family: 'Roboto Mono', monospace;
    font-size: 13px;
    font-style: italic;
    margin: 4px 0;
}

/* ============================================================================
   Toast Notifications
   ============================================================================ */
#toast-container,
.toast-container {
    position: fixed !important;
    bottom: 24px !important;
    right: 24px !important;
    left: auto !important;
    top: auto !important;
    z-index: 10000 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    width: auto !important;
    max-width: 400px !important;
    transform: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
}

.toast {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 12px 16px !important;
    background: #323232 !important;
    color: #fff !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
    font-size: 14px !important;
    min-width: 250px !important;
    max-width: 400px !important;
    animation: toast-in 0.3s ease-out !important;
    opacity: 1;
    transition: opacity 0.3s, transform 0.3s !important;
    margin: 0 !important;
    border: none !important;
}

.toast.toast-out {
    opacity: 0 !important;
    transform: translateX(100%) !important;
}

.toast-icon {
    font-size: 16px !important;
    background: transparent !important;
}

.toast-success .toast-icon { color: #4caf50 !important; }
.toast-error .toast-icon { color: #f44336 !important; }
.toast-warning .toast-icon { color: #ff9800 !important; }
.toast-info .toast-icon { color: #2196f3 !important; }

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============================================================================
   Confirm Modal
   ============================================================================ */
.notebook-wrapper .modal-overlay{
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    opacity: 1;
    transition: opacity 0.2s;
}

.notebook-wrapper .modal-overlay.hidden{
    display: none;
}

.notebook-wrapper .modal-box{
    background: var(--bg-color);
    border-radius: 12px;
    padding: 20px 24px;
    min-width: 280px;
    max-width: 360px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: modal-in 0.2s ease-out;
}

@keyframes modal-in {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.notebook-wrapper .modal-icon{
    display: none;
}

.notebook-wrapper .modal-title{
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 4px;
}

.notebook-wrapper .modal-text{
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.notebook-wrapper .modal-buttons{
    display: flex;
    gap: 12px;
    justify-content: center;
}

.notebook-wrapper .modal-btn{
    padding: 10px 24px;
    border-radius: 6px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.notebook-wrapper .modal-btn-cancel{
    background: var(--bg-secondary);
    color: var(--text-color);
}

.notebook-wrapper .modal-btn-cancel:hover{
    background: var(--border-color);
}

.notebook-wrapper .modal-btn-confirm{
    background: var(--primary-color);
    color: #fff;
}

.notebook-wrapper .modal-btn-confirm:hover{
    filter: brightness(1.1);
}

[data-site-scheme="dark"] .toast {
    background: #424242;
}

[data-site-scheme="dark"] .modal-box {
    background: #2d2d2d;
    border: 1px solid #404040;
}

/* ============================================================================
   TQDM Progress Bar Styles
   ============================================================================ */
.notebook-wrapper .output-display .progress{
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Roboto Mono', monospace;
    font-size: 13px;
    color: var(--text-color);
}

/* tqdm notebook style */
.notebook-wrapper .cell-output .progress{
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
}

.notebook-wrapper .cell-output .progress-bar{
    flex: 1;
    height: 20px;
    background-color: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.notebook-wrapper .cell-output .progress-bar > div{
    height: 100%;
    background-color: #007aff !important;
    transition: width 0.1s ease;
}

/* tqdm inline HTML output - don't override width! */
.notebook-wrapper .cell-output div[style*="display: flex"]{
    /* Let inline styles control layout */
}

/* TQDM Progress Bar Classes */
.notebook-wrapper .tqdm-container{
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}

.notebook-wrapper .tqdm-bar-bg{
    flex: 1 !important;
    min-width: 200px !important;
    height: 20px !important;
    background-color: var(--border-color, #e0e0e0) !important;
    border-radius: 4px !important;
    overflow: hidden !important;
}

.notebook-wrapper .tqdm-bar-fill{
    height: 100% !important;
    background-color: #007aff !important;
    border-radius: 4px 0 0 4px !important;
    transition: width 0.1s ease !important;
    /* CRITICAL: Do NOT set width here - let inline style work */
}

.notebook-wrapper .tqdm-percent, .notebook-wrapper .tqdm-stats{
    font-family: 'Roboto Mono', monospace;
    font-size: 13px;
    color: var(--text-color);
    white-space: nowrap;
}

/* Style the progress bar background */
.notebook-wrapper .cell-output div[style*="background-color: #e0e0e0"]{
    background-color: var(--border-color, #e0e0e0) !important;
    border-radius: 4px;
}

/* Style the progress bar fill - keep the width from inline style */
.notebook-wrapper .cell-output div[style*="background-color: #007aff"]{
    background-color: #007aff !important;
    /* Don't set width here - it comes from inline style */
}

/* CRITICAL: Ensure tqdm progress bar width is NOT overridden */
.notebook-wrapper .cell-output .output-display div div div{
    /* This targets the inner progress bar div */
    /* Allow inline width to work */
}

/* Force inline styles to take precedence for tqdm */
.notebook-wrapper .output-display > div > div > div[style*="width"]{
    /* Don't override width - let inline style work */
}


/* Queued cell state */
.notebook-wrapper .cell-run-btn.queued{
    background-color: #ff9800 !important;
    color: white;
}

.notebook-wrapper .cell-run-btn.queued:hover{
    background-color: #f57c00 !important;
}

/* ============================================================================
   Section Folding (Colab-like)
   ============================================================================ */

/* Section header style */
.notebook-wrapper .section-header{
    padding: 10px 15px;
    font-weight: 600;
    font-size: 14px;
    color: #555;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

[data-site-scheme="dark"] .section-header,
[data-scheme="dark"] .notebook-wrapper .section-header{
    color: var(--secondary-text-color);
}

/* Generic section header style */
.notebook-wrapper .section-header{
    padding: 10px 15px;
    font-weight: 600;
    font-size: 14px;
    color: #555;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

[data-site-scheme="dark"] .section-header,
[data-scheme="dark"] .notebook-wrapper .section-header{
    color: #9aa0a6;
}

/* Section header cell with collapse toggle */
.notebook-wrapper .text-cell.section-header{
    position: relative;
}

.notebook-wrapper .text-cell.section-header .cell-wrapper {
    overflow: visible !important;
}

.notebook-wrapper .text-cell.section-header .cell-rendered{
    padding-left: 28px;
}

/* Collapse toggle button */
.notebook-wrapper .section-collapse-toggle{
    position: absolute;
    left: -30px;
    top: 0;
    width: 24px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--secondary-text-color);
    font-size: 14px;
    padding: 0;
    z-index: 10;
    border-radius: 4px;
    transition: all 0.15s ease;
}

/* Position relative to rendered content */
.notebook-wrapper .text-cell.section-header .cell-rendered{
    position: relative;
    padding-left: 8px;
}

.notebook-wrapper .text-cell.section-header .cell-rendered h1,
.notebook-wrapper .text-cell.section-header .cell-rendered h2,
.notebook-wrapper .text-cell.section-header .cell-rendered h3,
.notebook-wrapper .text-cell.section-header .cell-rendered h4,
.notebook-wrapper .text-cell.section-header .cell-rendered h5,
.notebook-wrapper .text-cell.section-header .cell-rendered h6{
    position: relative;
    overflow: visible;
}

/* Place toggle inside the heading */
.notebook-wrapper .text-cell.section-header .section-collapse-toggle{
    position: absolute;
    left: -28px;
    top: 50%;
    transform: translateY(-50%);
}

.notebook-wrapper .section-collapse-toggle:hover{
    background: var(--hover-bg);
    color: var(--text-color);
}

.notebook-wrapper .section-collapse-toggle i{
    transition: transform 0.2s ease;
}

.notebook-wrapper .section-collapse-toggle.collapsed i{
    transform: rotate(-90deg);
}

/* Hidden cells counter badge */
.notebook-wrapper .section-hidden-count{
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
    padding: 2px 8px;
    background: var(--hover-bg);
    border-radius: 12px;
    font-size: 12px;
    color: var(--secondary-text-color);
    font-weight: 500;
}

.notebook-wrapper .section-hidden-count i{
    font-size: 10px;
}

/* Dark mode for section-hidden-count */
[data-site-scheme="dark"] .section-hidden-count,
[data-scheme="dark"] .notebook-wrapper .section-hidden-count{
    background: var(--hover-bg);
    color: var(--secondary-text-color);
}

/* Collapsed section indicator in rendered view */
.notebook-wrapper .section-collapsed-info{
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--hover-bg);
    border-radius: 8px;
    font-size: 13px;
    color: var(--secondary-text-color);
}

.notebook-wrapper .section-collapsed-info span{
    cursor: pointer;
}

.notebook-wrapper .section-collapsed-info span:hover{
    text-decoration: underline;
}

.notebook-wrapper .section-collapsed-info i{
    color: var(--primary-color);
}

/* Dark mode for section-collapsed-info */
[data-site-scheme="dark"] .section-collapsed-info,
[data-scheme="dark"] .notebook-wrapper .section-collapsed-info{
    background: var(--hover-bg);
    color: var(--secondary-text-color);
}

/* Cell hidden by section collapse */
.notebook-wrapper .cell.section-hidden,
.notebook-wrapper .cell-separator.section-hidden {
    display: none !important;
}

/* Section header when collapsed */
.notebook-wrapper .text-cell.section-collapsed .cell-rendered h1,
.notebook-wrapper .text-cell.section-collapsed .cell-rendered h2,
.notebook-wrapper .text-cell.section-collapsed .cell-rendered h3,
.notebook-wrapper .text-cell.section-collapsed .cell-rendered h4,
.notebook-wrapper .text-cell.section-collapsed .cell-rendered h5,
.notebook-wrapper .text-cell.section-collapsed .cell-rendered h6 {
    margin-bottom: 0;
}

/* Dark mode for section-header text cell */
[data-site-scheme="dark"] .text-cell.section-header .cell-wrapper,
[data-scheme="dark"] .text-cell.section-header .cell-wrapper,
[data-site-scheme="dark"] .text-cell.section-collapsed .cell-wrapper,
[data-scheme="dark"] .notebook-wrapper .text-cell.section-collapsed .cell-wrapper{
    background: var(--cell-bg);
    border-color: var(--border-color);
}

[data-site-scheme="dark"] .text-cell.section-header .cell-rendered,
[data-scheme="dark"] .text-cell.section-header .cell-rendered,
[data-site-scheme="dark"] .text-cell.section-collapsed .cell-rendered,
[data-scheme="dark"] .notebook-wrapper .text-cell.section-collapsed .cell-rendered{
    color: var(--text-color);
}

/* Run button for collapsed section - executes all hidden cells */
.notebook-wrapper .section-run-btn{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0 !important;
    background: var(--run-btn-bg);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--primary-color);
    font-size: 14px;
    margin-right: 8px;
    transition: all 0.15s ease;
    position: relative;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.notebook-wrapper .section-run-btn:hover{
    background: var(--hover-bg);
    transform: scale(1.05);
}

[data-site-scheme="dark"] .section-run-btn,
[data-scheme="dark"] .notebook-wrapper .section-run-btn{
    background: var(--run-btn-bg);
    color: var(--primary-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* Loading spinner animation around the button */
.notebook-wrapper .section-run-btn.loading{
    pointer-events: none;
}

.notebook-wrapper .section-run-btn.loading::before{
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: var(--primary-color);
    border-right-color: var(--primary-color);
    animation: spin-loader 0.6s linear infinite;
    z-index: 1;
}

.notebook-wrapper .section-run-btn.loading::after{
    display: none;
}

@keyframes spin-loader {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* ANSI color codes for imported notebooks */
.notebook-wrapper .ansi-red{ color: #e74c3c; }
.notebook-wrapper .ansi-green{ color: #27ae60; }
.notebook-wrapper .ansi-yellow{ color: #f39c12; }
.notebook-wrapper .ansi-blue{ color: #3498db; }
.notebook-wrapper .ansi-magenta{ color: #9b59b6; }
.notebook-wrapper .ansi-cyan{ color: #1abc9c; }
.notebook-wrapper .ansi-bold{ font-weight: bold; }

/* Error traceback styling */
.notebook-wrapper .error-traceback{
    margin-top: 8px;
    padding: 12px;
    background: var(--pre-bg);
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Output image styling */
.notebook-wrapper .output-image{
    max-width: 100%;
    height: auto;
    display: block;
    margin: 8px 0;
}

/* Import button hover effect */
.notebook-wrapper #import-notebook:hover{
    background: var(--hover-bg);
}

.notebook-wrapper #import-notebook i{
    color: var(--primary-color);
}

/* Inline restart confirmation */
#restart-kernel.confirming,
.notebook-wrapper .restart-kernel-btn.confirming{
    background: var(--hover-bg);
    padding: 4px 8px;
}

.notebook-wrapper .restart-confirm{
    color: var(--secondary-text-color);
    margin-right: 8px;
}

.restart-yes,
.notebook-wrapper .restart-no{
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.15s;
}

.notebook-wrapper .restart-yes{
    color: #fff;
    background: #007aff;
    margin-right: 4px;
}

.notebook-wrapper .restart-yes:hover{
    background: #0056b3;
}

.notebook-wrapper .restart-no{
    color: var(--text-color);
    background: var(--border-color);
}

.notebook-wrapper .restart-no:hover{
    background: #c5c9cc;
}

/* ============================================================================
   Autocomplete Popup
   ============================================================================ */
.autocomplete-popup {
    position: fixed;
    z-index: 10001;
    background: var(--cell-bg, #fff);
    border: 1px solid var(--border-color, #dadce0);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    max-height: 280px;
    min-width: 200px;
    max-width: 350px;
    overflow-y: auto;
    overflow-x: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 13px;
}

.autocomplete-popup .ac-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    cursor: pointer;
    transition: background 0.1s;
}

.autocomplete-popup .ac-item:hover,
.autocomplete-popup .ac-item.selected {
    background: var(--hover-bg, #f1f3f4);
}

.autocomplete-popup .ac-icon {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    border-radius: 3px;
    flex-shrink: 0;
}

.autocomplete-popup .ac-keyword {
    background: #e8f0fe;
    color: #1a73e8;
}

.autocomplete-popup .ac-method {
    background: #fce8e6;
    color: #d93025;
}

.autocomplete-popup .ac-library {
    background: #e6f4ea;
    color: #1e8e3e;
}

.autocomplete-popup .ac-param {
    background: #fff3e0;
    color: #e65100;
}

.autocomplete-popup .ac-ai {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.autocomplete-popup .ac-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-color, #212121);
}

.autocomplete-popup .ac-hint {
    font-size: 11px;
    color: var(--secondary-text-color, #5f6368);
    margin-left: auto;
    flex-shrink: 0;
}

/* Dark mode for autocomplete */
[data-site-scheme="dark"] .autocomplete-popup,
[data-scheme="dark"] .autocomplete-popup {
    background: var(--cell-bg, #2d2d2d);
    border-color: var(--border-color, #3d3d3d);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

[data-site-scheme="dark"] .autocomplete-popup .ac-item:hover,
[data-site-scheme="dark"] .autocomplete-popup .ac-item.selected,
[data-scheme="dark"] .autocomplete-popup .ac-item:hover,
[data-scheme="dark"] .autocomplete-popup .ac-item.selected {
    background: var(--hover-bg, #3d3d3d);
}

[data-site-scheme="dark"] .autocomplete-popup .ac-keyword,
[data-scheme="dark"] .autocomplete-popup .ac-keyword {
    background: #1a3a5c;
    color: #8ab4f8;
}

[data-site-scheme="dark"] .autocomplete-popup .ac-method,
[data-scheme="dark"] .autocomplete-popup .ac-method {
    background: #5c2626;
    color: #f28b82;
}

[data-site-scheme="dark"] .autocomplete-popup .ac-library,
[data-scheme="dark"] .autocomplete-popup .ac-library {
    background: #1e3a29;
    color: #81c995;
}

[data-site-scheme="dark"] .autocomplete-popup .ac-param,
[data-scheme="dark"] .autocomplete-popup .ac-param {
    background: #4a3520;
    color: #ffb74d;
}

/* ============================================================================
   Drag & Drop
   ============================================================================ */
.notebook-wrapper .cell-gutter.drag-handle {
    cursor: grab;
    transition: background 0.15s;
    position: relative;
}

.notebook-wrapper .cell-gutter.drag-handle:hover {
    background: rgba(0, 0, 0, 0.05);
}

.notebook-wrapper .cell-gutter.drag-handle:active {
    cursor: grabbing;
    background: rgba(0, 0, 0, 0.1);
}

.notebook-wrapper .cell.dragging {
    opacity: 0.4;
}

.notebook-wrapper .cell.drag-over-top {
    position: relative;
}

.notebook-wrapper .cell.drag-over-top::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-color, #4285f4);
    border-radius: 2px;
    z-index: 10;
}

.notebook-wrapper .cell.drag-over-bottom {
    position: relative;
}

.notebook-wrapper .cell.drag-over-bottom::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-color, #4285f4);
    border-radius: 2px;
    z-index: 10;
}

.cell-drag-placeholder {
    background: var(--hover-bg, #f1f3f4);
    border: 2px dashed var(--border-color, #dadce0);
    border-radius: 8px;
    margin-bottom: 16px;
    transition: height 0.2s;
}

/* Dark mode for drag & drop */
[data-site-scheme="dark"] .notebook-wrapper .cell-gutter.drag-handle:hover,
[data-scheme="dark"] .notebook-wrapper .cell-gutter.drag-handle:hover {
    background: rgba(255, 255, 255, 0.1);
}

[data-site-scheme="dark"] .notebook-wrapper .cell-gutter.drag-handle:active,
[data-scheme="dark"] .notebook-wrapper .cell-gutter.drag-handle:active {
    background: rgba(255, 255, 255, 0.15);
}

[data-site-scheme="dark"] .cell-drag-placeholder,
[data-scheme="dark"] .cell-drag-placeholder {
    background: var(--hover-bg, #3d3d3d);
    border-color: var(--border-color, #4d4d4d);
}
    background: var(--hover-bg, #f1f3f4);
    border: 2px dashed var(--border-color, #dadce0);
    border-radius: 8px;
    margin-bottom: 16px;
    transition: height 0.2s;
}

/* ============================================================================
   Author Comments (from Gutenberg)
   ============================================================================ */

/* Author comments have special styling in comment-list */
.notebook-wrapper .comment-display.author-comment {
    background: linear-gradient(135deg, #ffecb3 50%, #fff8e1 100%);
    border-bottom: 1px solid #ffe082;
}

.notebook-wrapper .comment-display.author-comment .comment-text {
    color: #5d4037;
}

.notebook-wrapper .comment-display.author-comment::before {
    content: '👨🏻‍💻 Автор: ';
    font-size: 11px;
    color: #ff9800;
    font-weight: 500;
    display: block;
    margin-bottom: 4px;
}

/* Dark mode for author comments */
[data-site-scheme="dark"] .notebook-wrapper .comment-display.author-comment,
[data-scheme="dark"] .notebook-wrapper .comment-display.author-comment {
    background: linear-gradient(135deg, #3e2723 0%, #4e342e 100%);
    border-bottom-color: #5d4037;
}

[data-site-scheme="dark"] .notebook-wrapper .comment-display.author-comment .comment-text,
[data-scheme="dark"] .notebook-wrapper .comment-display.author-comment .comment-text {
    color: #ffcc80;
}

[data-site-scheme="dark"] .notebook-wrapper .comment-display.author-comment::before,
[data-scheme="dark"] .notebook-wrapper .comment-display.author-comment::before {
    color: #ffb74d;
}
