/* SeqShare Interactive Notebook Styles */

/* Toolbar */
.nb-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    border-radius: 8px 8px 0 0;
    gap: 8px;
    flex-wrap: wrap;
}

.nb-toolbar-left,
.nb-toolbar-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nb-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    color: var(--text);
    transition: background 0.15s;
}

.nb-btn:hover {
    background: var(--bg-secondary);
}

.nb-btn-secondary {
    border-style: dashed;
    color: var(--text-secondary);
}

/* Kernel status indicator */
.nb-kernel-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    padding: 4px 0;
    border-radius: 0;
    background: transparent;
    border: none;
    font-family: var(--font-mono);
}

.nb-kernel-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.nb-kernel-idle { background: var(--status-complete); }
.nb-kernel-busy { background: var(--status-queued); animation: breathe 2s ease-in-out infinite; }
.nb-kernel-starting { background: var(--status-active); animation: breathe 2s ease-in-out infinite; }
.nb-kernel-dead { background: var(--status-failed); }
.nb-kernel-stopped { background: var(--text-tertiary); }

/* Cells container */
.nb-cells {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 8px 0;
}

/* Individual cell */
.nb-cell {
    display: flex;
    /* Finding #5 (08.17.26-notebook-ux-polish): .nb-cell-actions used to sit
       directly against .nb-cell-content with only a 1px flex boundary
       between them -- fine while the per-cell scrollbar was invisible
       (finding #4's 'hidden' mode), but findings #3/#4's fix gives cells a
       real, grabbable Monaco scrollbar on that same right edge, which would
       otherwise land in the same few px you have to hover for the
       move-up/down/delete/insert buttons to respond. This gap is real
       breathing room, not decoration. */
    gap: 10px;
    border: none;
    border-left: 2px solid transparent;
    transition: border-color 0.15s;
    position: relative;
}

.nb-cell:hover {
    border-color: transparent;
}

.nb-cell:focus-within {
    border-left-color: var(--accent);
}

.nb-cell-running {
    border-left: 2px solid var(--status-queued);
}

.nb-cell-running .nb-run-btn {
    animation: breathe 2s ease-in-out infinite;
}

/* Cell gutter (run button + execution count) */
.nb-cell-gutter {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 48px;
    min-width: 48px;
    padding: 8px 4px;
    gap: 4px;
    background: transparent;
    border-right: none;
}

.nb-run-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.nb-run-btn:hover {
    background: var(--accent);
    color: white;
}

.nb-exec-count {
    font-size: 11px;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
}

.nb-cell-type-label {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Cell content area */
.nb-cell-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.nb-cell-editor {
    min-height: 100px;
    border-bottom: none;
    padding-left: 4px;
}

.nb-cell-textarea {
    width: 100%;
    border: none;
    background: var(--bg-inset);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 13px;
    padding: 8px 12px;
    resize: vertical;
    outline: none;
}

/* Cell output area */
.nb-cell-output {
    padding: 0;
    overflow-x: auto;
}

.nb-cell-output:empty {
    display: none;
}

.nb-output-item {
    padding: 8px 12px;
    font-size: 13px;
}

.nb-output-item pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: var(--font-mono);
    font-size: 13px;
}

.nb-output-stream pre {
    color: var(--text);
}

.nb-stderr {
    color: var(--status-failed);
}

.nb-output-error {
    background: rgba(220, 38, 38, 0.04);
    border-left: 2px solid var(--status-failed);
}

.nb-output-error pre {
    color: var(--status-failed);
}

.nb-output-image {
    max-width: 100%;
    height: auto;
}

/* Cell action buttons (right side) */
.nb-cell-actions {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px 2px;
    opacity: 0;
    transition: opacity 0.15s;
}

.nb-cell:hover .nb-cell-actions {
    opacity: 1;
}

.nb-cell-action-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s;
}

.nb-cell-action-btn:hover {
    background: var(--bg-secondary);
    color: var(--text);
}

.nb-cell-delete:hover {
    background: rgba(220, 38, 38, 0.1);
    color: var(--status-failed);
}

/* Finding #7: same accent-tint-on-hover convention as .nb-cell-delete's
   danger tint above -- a distinct "constructive" hover so Insert doesn't
   read as identical-weight to Move/Toggle. */
.nb-cell-insert:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent);
}

/* Markdown cell styling */
.nb-cell-markdown .nb-cell-gutter {
    background: transparent;
}

/* ==================== Toggle Panel ==================== */

.nb-toggle-panel {
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.nb-toggle-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    cursor: pointer;
    user-select: none;
}

.nb-toggle-header:hover {
    background: var(--bg);
}

.nb-toggle-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}

.nb-toggle-summary {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: 8px;
}

.nb-toggle-collapse-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.15s;
}

.nb-toggle-collapse-btn:hover {
    background: var(--bg);
}

.nb-toggle-body {
    padding: 0 12px 10px 12px;
}

.nb-toggle-body.collapsed {
    display: none;
}

.nb-toggle-group {
    margin-bottom: 8px;
}

.nb-toggle-group-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-family: var(--font-mono);
}

.nb-toggle-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.nb-toggle-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}

.nb-toggle-item:hover {
    border-color: var(--accent);
}

.nb-toggle-item input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.nb-toggle-item.nb-toggle-off {
    opacity: 0.5;
    text-decoration: line-through;
    background: transparent;
}

/* Docstring tooltip (from #' lines in R source) */
.nb-toggle-item[data-tooltip] {
    position: relative;
}

.nb-toggle-item[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 0;
    top: calc(100% + 6px);
    z-index: 100;
    width: max-content;
    max-width: 360px;
    padding: 8px 10px;
    border-radius: 6px;
    background: var(--text);
    color: var(--bg);
    font-size: 12px;
    line-height: 1.4;
    white-space: normal;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.nb-toggle-item[data-tooltip]:hover::after {
    opacity: 1;
}

/* ==================== Skipped Cells ==================== */

.nb-cell-skipped {
    opacity: 0.3;
    border-left: 2px dashed var(--border);
}

.nb-cell-skipped .nb-cell-editor {
    pointer-events: none;
}

.nb-cell-skipped .nb-run-btn {
    pointer-events: none;
    opacity: 0.3;
}
