/* Notebook MVP styles */

.notebook-container {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    background: var(--bg-primary);
}

.notebook-container.visible {
    display: flex;
}

.notebook-toolbar {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    background: var(--bg-primary);
}

.notebook-left-controls,
.notebook-right-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.notebook-select {
    min-width: 180px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--text-primary);
    font-family: inherit;
}

.notebook-btn {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}

.notebook-btn:hover {
    border-color: var(--accent);
}

.notebook-btn.save-flash {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
    transition: background 0.2s, color 0.2s;
}

.notebook-run-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.notebook-ghost-toggle.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.notebook-main {
    flex: 1;
    min-height: 0;
    display: flex;
}

.notebook-cells {
    flex: 1;
    overflow: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.notebook-cell {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
}

.notebook-cell-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.notebook-cell-label {
    font-weight: 600;
    font-size: 0.9rem;
}

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

.notebook-cell-editor {
    width: 100%;
    min-height: 120px;
    border: none;
    outline: none;
    resize: vertical;
    padding: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
}

textarea.notebook-cell-editor {
    display: none;
}

.notebook-cell .CodeMirror {
    min-height: 140px;
    height: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

.notebook-cell .CodeMirror-scroll {
    min-height: 140px;
}

.notebook-ghost {
    display: none;
    border-top: 1px dashed var(--border);
    padding: 8px 12px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-family: 'JetBrains Mono', monospace;
    white-space: pre-wrap;
    word-break: break-word;
}

.notebook-ghost.visible {
    display: block;
}

.notebook-output {
    border-top: 1px solid var(--border);
    padding: 12px;
    background: #fff;
    display: none;
}

.notebook-output.visible {
    display: block;
}

.notebook-output pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.85rem;
    font-family: 'JetBrains Mono', monospace;
}

.notebook-output .stderr,
.notebook-output .error {
    color: var(--error);
}

.notebook-output .result-text {
    margin-top: 8px;
    color: var(--text-primary);
}

.notebook-output .dataframe-wrap {
    overflow: auto;
    max-width: 100%;
}

.notebook-output table {
    border-collapse: collapse;
    font-size: 0.85rem;
}

.notebook-output table th,
.notebook-output table td {
    border: 1px solid var(--border);
    padding: 4px 8px;
}

.notebook-output img {
    max-width: 100%;
    height: auto;
    margin-top: 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.notebook-copilot {
    width: 340px;
    max-width: 45%;
    border-left: 1px solid var(--border);
    background: var(--bg-primary);
    display: none;
    flex-direction: column;
    padding: 12px;
    gap: 10px;
}

.notebook-copilot.visible {
    display: flex;
}

.notebook-copilot-title {
    font-weight: 700;
    font-size: 1rem;
}

#notebookCopilotInput {
    min-height: 90px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    resize: vertical;
    font-family: inherit;
}

.notebook-copilot-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.notebook-copilot-response {
    flex: 1;
    min-height: 0;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    background: #fff;
    font-size: 0.9rem;
}

.notebook-copilot-response .muted {
    color: var(--text-secondary);
}

@media (max-width: 960px) {
    .notebook-main {
        flex-direction: column;
    }

    .notebook-copilot {
        width: 100%;
        max-width: 100%;
        border-left: none;
        border-top: 1px solid var(--border);
        min-height: 240px;
    }
}