/* Dashboard / Split-Stream Interface */
.app-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: var(--bg-white);
    position: relative;
}

/* Right Pane: The Notepad */
.notepad {
    width: 35%;
    min-width: 0;
    border-left: 1px solid var(--bg-notepad-header);
    background: var(--bg-notepad);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
    transition: width 0.3s ease-in-out;
    box-shadow: -8px 0 16px var(--shadow-color);
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 20;
}

.notepad.collapsed {
    width: 0;
    border-left: none;
}

@keyframes bench-bounce {
    0%, 100% { transform: translateX(0); }
    15% { transform: translateX(-8px); }
    30% { transform: translateX(6px); }
    45% { transform: translateX(-4px); }
    60% { transform: translateX(3px); }
    75% { transform: translateX(-1px); }
}
.notepad.bench-bounce {
    animation: bench-bounce 0.6s ease-out;
}

.notepad-inner {
    width: max(100%, 450px); /* Fills pane at wide viewports; stays 450px during collapse animation */
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    position: relative;
}
/* Beaker watermark removed — image kept at static/images/beaker_mask.png */

.bench-app-links {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 6px;
    padding: 10px 12px 10px 10px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}
.bench-app-label {
    width: 100%;
    font-size: 0.75em;
    color: var(--bg-notepad-header);
    opacity: 0.7;
    text-transform: uppercase;
    font-weight: 700;
}
.bench-store-badge {
    display: block;
    height: 40px;
    opacity: 0.7;
    transition: opacity 0.15s;
}
.bench-store-badge:hover {
    opacity: 1;
}
.bench-store-badge svg {
    height: 100%;
    width: auto;
}
.bench-store-badge-play {
    padding-right: 4px;
}

.notepad-header {
    padding: 6px 16px 6px 6px;
    background: var(--bg-notepad-header);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 6px var(--shadow-color);
    flex-shrink: 0;
}


.notepad-title {
    font-size: 0.8em;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #fff;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notepad-header .toolbar-icon-btn {
    color: rgba(255, 255, 255, 0.85);
    width: 28px;
    height: 28px;
}

.notepad-header .toolbar-icon-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.35);
}
.notepad-stream {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: grid;
    position: relative;
    z-index: 1;
    grid-template-columns: repeat(auto-fill, var(--card-min-width));
    gap: 12px;
    align-content: start;
    grid-auto-rows: max-content;
    align-items: start;
    background-image: radial-gradient(circle, var(--bench-dot-color, rgba(160,100,140,0.15)) 1px, transparent 1px);
    background-size: 20px 20px;
    background-attachment: local;
}

/* Right Pane: The Notebook */
.notebook {
    flex: 1;
    display: flex;
    background: var(--bg-color);
    position: relative;
    z-index: 1; /* Prioritize notebook content in the stacking order */
    min-width: 0;
}

.sliding-index {
    position: relative;
    width: 250px;
    background: var(--bg-color);
    transition: width 0.3s ease-in-out;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
}

.sliding-index.collapsed {
    width: 0;
}

.sidebar-heading {
    width: 250px;
    padding: 7px 6px 5px 20px;
    font-size: 0.8em;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted, #888);
    flex-shrink: 0;
    background: var(--border-color);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.heading-collapse-btn {
    background: none;
    width: min-content;
    border: none;
    cursor: pointer;
    padding: 3px 4px 4px;
    font-size: 1.2rem;
    line-height: 1;
    color: inherit;
    opacity: 0.6;
    border-radius: 4px;
    transition: opacity 0.15s, background 0.15s;
    flex-shrink: 0;
}

.heading-collapse-btn:hover {
    opacity: 1;
    background: rgba(128,128,128,0.12);
}
#bench-pin-btn.pinned {
    opacity: 1;
    background: rgba(255,255,255,0.2);
}
#bench-pin-btn.pinned svg {
    fill: currentColor;
    transform: rotate(45deg);
}

.bench-collapse-btn {
    color: rgba(255,255,255,0.8);
}

.bench-collapse-btn:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

.index-content {
    position: relative;
    width: 250px; /* Fixed width to prevent content jumping during slide */
    padding: 12px;
    box-sizing: border-box;
    white-space: nowrap;
    flex: 1;
    overflow-y: auto;
}

.add-project-link {
    display: block;
    margin-top: 5px;
    margin-bottom: 12px;
    font-size: 0.85em;
    color: var(--link-color);
    text-decoration: underline;
    text-align: center;
    cursor: pointer;
}

.sidebar-experiment-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.85em;
}

/* Project sidebar items */
.project-item {
    margin-bottom: 4px;
}

.project-header {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
    background: var(--primary-color);
    color: #fff;
}

[data-theme="dark"] .project-header {
    background: transparent;
    border: 2px solid var(--primary-color);
}
.project-header:hover {
    opacity: 0.9;
}

.project-chevron {
    flex-shrink: 0;
    transition: transform 0.15s ease;
    transform: rotate(0deg);
    color: rgba(255, 255, 255, 0.8);
    margin-right: 4px;
}

.project-chevron.open {
    transform: rotate(90deg);
}

.project-title-text {
    flex: 1;
    font-size: 0.85em;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    border-radius: 4px;
    padding: 1px 2px;
    min-width: 0;
}

.project-title-text[contenteditable="true"] {
    outline: none;
    background: var(--bg-white);
    color: var(--text-color);
    box-shadow: none;
    cursor: text;
    white-space: nowrap;
    overflow: visible;
}

.project-delete-btn {
    flex-shrink: 0;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1em;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
    display: none;
    width: auto;
}

.project-header:hover .project-delete-btn {
    display: block;
}

.project-delete-btn:hover {
    color: #fff;
}

/* Animated expand/collapse wrapper */
.project-exps-wrap {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.2s ease;
}
.project-exps-wrap.open {
    grid-template-rows: 1fr;
}

/* Tree-view experiments list */
.project-experiments-list {
    list-style: none;
    padding: 0;
    margin: 0 0 0 12px;
    overflow: hidden;
    min-height: 0;
    position: relative;
}

.sidebar-exp-item {
    position: relative;
    padding: 4px 6px 4px 16px;
    border-radius: 0 6px 6px 0;
    margin-bottom: 0;
    cursor: grab;
    display: flex;
    align-items: flex-start;
}

/* Tree trunk: vertical line segment per item */
.sidebar-exp-item::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--primary-color);
}

/* Tree connector: horizontal branch line */
.sidebar-exp-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 13px;
    width: 12px;
    border-top: 1px solid var(--primary-color);
}

.sidebar-exp-item:hover {
    background: rgba(128,128,128,0.08);
}

.sidebar-exp-link {
    flex: 1;
    min-width: 0;
    text-decoration: none;
    display: block;
}

.exp-action-btns {
    flex-shrink: 0;
    display: none;
    flex-direction: column;
    gap: 2px;
    max-width: 20px;
}

.sidebar-exp-item:hover .exp-action-btns {
    display: flex;
}

.exp-delete-btn,
.exp-lock-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    line-height: 1;
    display: flex;
    align-items: center;
}

.active-exp-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--link-color);
    margin-right: 5px;
    vertical-align: 1px;
    flex-shrink: 0;
}

.exp-delete-btn:hover {
    color: var(--danger-color);
}

.exp-lock-btn:hover {
    color: var(--primary-color);
}

.sidebar-exp-item.active-experiment {
    background: none;
}

/* Tree connector for + Add Experiment link */
.add-experiment-link {
    position: relative;
    padding: 1px 6px 4px 16px;
    color: var(--link-color);
}

.add-experiment-link::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--primary-color);
}

.add-experiment-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 12px;
    width: 12px;
    border-top: 1px solid var(--primary-color);
}

/* Last tree item: trunk stops at the connector */
.project-experiments-list > .sidebar-exp-item:last-child::after {
    bottom: auto;
    height: 13px;
}
.project-experiments-list > .add-experiment-link:last-child::after {
    bottom: auto;
    height: 12px;
}

.add-experiment-link a {
    font-size: 0.8em;
    color: var(--link-color);
    text-decoration: none;
}

.add-experiment-link a:hover {
    text-decoration: underline;
}

.project-drag-over {
    background: rgba(69, 184, 133, 0.1);
    border-radius: 8px;
    outline: 2px dashed var(--primary-color);
}

/* Todo List sidebar button */
.todo-sidebar-btn {
  position: relative;
  z-index: 1;
  width: 250px;
  height: 55px;
  border-radius: 0;
  background: none;
  color: var(--text-light);
  font-size: 0.85em;
  font-weight: 600;
  padding: 0;
  margin-top: 0;
  flex-shrink: 0;
  border: none;
  border-top: 1px solid transparent;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-top-color 0.15s;
}
.todo-sidebar-btn.has-scroll-border {
  border-top-color: var(--border-color);
}
.todo-sidebar-btn:hover { opacity: 0.9; }

/* Todo modal */
.modal-content.todo-modal-content {
    width: 840px;
    max-width: 95vw;
    border: 2px solid var(--todo-border);
    text-align: left;
    display: flex;
    flex-direction: column;
    max-height: 80vh;
}
.todo-input-row {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}
.todo-input-row input {
    flex: 1;
    margin: 0;
    padding: 6px 10px;
    font-size: 0.9em;
    border-radius: 6px;
}
.todo-input-row button {
    width: auto;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.9em;
    background: var(--todo-border);
    color: #fff;
}
.todo-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    flex: 1;
    min-height: 60px;
}
.todo-heading {
    font-size: 0.72em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    padding: 12px 4px 5px;
    cursor: default;
    user-select: none;
}
.todo-heading-collapsible {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}
.todo-heading-collapsible:hover { color: var(--text-color); }
.todo-section-chevron {
    flex-shrink: 0;
    transition: transform 0.15s ease;
    transform: rotate(0deg);
}
.todo-section-chevron.open { transform: rotate(90deg); }
.todo-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 4px;
    border-radius: 5px;
    cursor: grab;
    user-select: none;
    border-top: 2px solid transparent;
}
.todo-item:hover { background: rgba(0,0,0,0.03); }
.todo-item.dragging { opacity: 0.35; }
.todo-item.todo-drag-over { border-top: 2px solid var(--primary-color); }
.todo-item.todo-drag-over-bottom { border-bottom: 2px solid var(--primary-color); }
.todo-drag-handle {
    color: var(--text-light);
    cursor: grab;
    font-size: 1em;
    flex-shrink: 0;
    line-height: 1;
}
.todo-cb-wrap {
    position: relative;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.todo-item input[type="checkbox"] {
    width: 15px;
    height: 15px;
    margin: 0;
    padding: 0;
    flex-shrink: 0;
    accent-color: var(--primary-color);
    cursor: pointer;
}
.todo-cb-wrap::after {
    content: '✕';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: var(--text-muted);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s;
}
.todo-item:not(.done):hover .todo-cb-wrap::after { opacity: 1; }
.todo-label {
    flex: 1;
    font-size: 0.9em;
    word-break: break-word;
    white-space: normal;
    text-align: left;
}
.todo-item.done .todo-label {
    text-decoration: line-through;
    color: var(--text-light);
}
.todo-delete-btn {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    width: auto;
    padding: 2px 4px;
    font-size: 1.1em;
    line-height: 1;
    flex-shrink: 0;
    opacity: 0;
    font-weight: normal;
}
.todo-item:hover .todo-delete-btn { opacity: 1; }
.todo-delete-btn:hover { color: var(--danger-color); }

#canvas-arrow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

#canvas-placeholder {
    position: absolute;
    top: calc(36% - 80px);
    left: 400px;  /* Half of canvas max-width (800px) — stays fixed regardless of scroll space */
    transform: translateX(-50%);
    background: var(--bg-white);
    border: 2px solid var(--bg-notepad-header);
    border-radius: 14px;
    padding: 14px 22px;
    color: var(--text-muted);
    font-size: 0.9em;
    white-space: nowrap;
    margin: 0;
    box-shadow: 0 4px 12px var(--shadow-color);
    z-index: 1;
}


#bench-placeholder,
#no-projects-msg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-white);
    border: 2px solid var(--bg-notepad-header);
    border-radius: 14px;
    padding: 14px 22px;
    color: var(--text-muted);
    font-size: 1.1em;
    text-align: center;
    line-height: 1.8;
    pointer-events: none;
    margin: 0;
    box-shadow: 0 4px 12px var(--shadow-color);
    z-index: 1;
}

#bench-placeholder {
    top: calc(30% + 10px);
    transform: translateX(-50%);
    max-width: 66%;
    white-space: normal;
}

.tooltip-tag {
    display: inline-block;
    background: var(--bg-notepad-header);
    border-radius: 4px;
    padding: 1px 6px;
    font-weight: 600;
    color: #fff;
    box-shadow: 0 1px 3px var(--shadow-color);
}
.tooltip-tag-clickable {
    pointer-events: auto;
    cursor: pointer;
}
.tooltip-tag-clickable:hover {
    opacity: 0.85;
}

.bench-placeholder-or {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 6px 0;
    color: var(--text-muted);
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.bench-placeholder-or::before,
.bench-placeholder-or::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}
.bench-placeholder-or span {
    flex-shrink: 0;
}

#no-projects-msg {
    top: calc(50% - 20px);
    white-space: normal;
    max-width: 85%;
}




#notebook-content {
    position: relative;
    min-height: 800px;
    width: 100%;
    --grid-size: 20px;
    --grid-color: rgba(0, 0, 0, 0.12);
    --page-height: 1060px;
    --page-break-color: var(--border-color);
    background-image:
        linear-gradient(to right, var(--grid-color) 1px, transparent 1px),
        linear-gradient(to bottom, var(--grid-color) 1px, transparent 1px),
        linear-gradient(to bottom, transparent calc(var(--page-height) - 2px), var(--page-break-color) calc(var(--page-height) - 2px));
    background-size:
        20px 20px,
        20px 20px,
        100% var(--page-height);
}
[data-theme="dark"] #notebook-content {
    --grid-color: rgba(255, 255, 255, 0.12);
}

#page-labels-overlay {
    position: sticky;
    left: 0;
    height: 0;
    overflow: visible;
    pointer-events: none;
    z-index: 5;
}
.page-break-label {
    position: absolute;
    right: 12px;
    font-size: 0.65em;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-light);
    pointer-events: none;
    user-select: none;
}

.canvas.drag-over {}

#file-drop-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(69, 184, 133, 0.15);
    border: 3px dashed var(--primary-color);
    pointer-events: none;
    align-items: center;
    justify-content: center;
}
#file-drop-overlay.active {
    display: flex;
}
#file-drop-overlay span {
    background: var(--bg-white);
    color: var(--primary-color);
    font-size: 1.4em;
    font-weight: 600;
    padding: 24px 40px;
    border-radius: 12px;
    border: 2px solid var(--primary-color);
    pointer-events: none;
}

.experiment-title-input {
    font-size: 1.1em;
    font-weight: bold;
    border: 1px solid var(--border-color);
    background: transparent;
    margin: 0;
    padding: 4px;
    flex: 1;
    min-width: 0; /* Allows input to shrink, preventing it from pushing buttons out of bounds */
    text-overflow: ellipsis; /* Gracefully truncates long titles if squeezed */
    width: auto;
    color: var(--text-color);
    outline: none;
    transition: border-color 0.2s, background-color 0.2s;
}

.experiment-title-input:focus {
    border-color: var(--border-color);
    background: var(--bg-white);
}

