/* Jupyter Book browser code editing controls.
   Pair with jb-browser-code-editing-controls.js or a project-specific runner
   that uses the same cscs-* class names. */

.cscs-execution-controls {
    display: grid;
    grid-template-columns: max-content max-content max-content;
    gap: 6px;
    align-items: flex-start;
    margin-top: 4px;
}

.cscs-execution-controls button {
    appearance: none;
    background: #ffffff;
    border: 1px solid #b7c0c8;
    border-radius: 4px;
    color: #27313a;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 400;
    height: 24px;
    line-height: 1;
    padding: 2px 8px;
    transition: background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.cscs-execution-controls button:hover:not(:disabled) {
    background: #f1f5f7;
    border-color: #7d8b96;
}

.cscs-execution-controls button:focus-visible {
    border-color: #277da1;
    box-shadow: 0 0 0 2px rgba(39, 125, 161, 0.2);
    outline: none;
}

.cscs-code-editor {
    background: #f7f7f7;
    border: 1px solid #ddd;
    border-left: 1px solid #1b5e20;
    border-radius: 6px 6px 6px 0;
    box-sizing: border-box;
    color: #222;
    display: block;
    font-family: var(--pst-font-family-monospace);
    font-size: 0.8rem;
    line-height: 1.45;
    padding: 8px;
    resize: vertical;
    width: 100%;
}

.cscs-student-copy .cscs-code-editor:not([hidden]),
div.cell.cscs-is-editing[data-cscs-edit-mode="edit"] .cscs-code-editor:not([hidden]) {
    border-color: #5b9be8;
    border-left-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.14), 0 6px 18px rgba(37, 99, 235, 0.08);
}

.cscs-code-editor:focus {
    border-color: #4f8edc;
    border-left-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18), 0 8px 22px rgba(37, 99, 235, 0.10);
    outline: none;
}

.cscs-code-editor[hidden],
.cscs-execution-controls [hidden],
.cscs-execution-controls button[hidden] {
    display: none !important;
}

.cscs-student-copy {
    border-left: 3px solid #8aa0ad;
    margin: 8px 0 10px;
    padding-left: 10px;
}

.cscs-student-copy-label {
    color: #52616b;
    font-size: 0.8rem;
    line-height: 1.2;
    margin-bottom: 4px;
}

div.cell_input pre.cscs-inline-editing {
    border-color: #5b9be8 !important;
    border-left-color: #2563eb !important;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.14), 0 6px 18px rgba(37, 99, 235, 0.08) !important;
    cursor: text;
}

div.cell_input pre.cscs-inline-editing:focus {
    border-color: #4f8edc !important;
    border-left-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18), 0 8px 22px rgba(37, 99, 235, 0.10) !important;
    outline: none;
}

div.cell.cscs-is-editing[data-cscs-edit-mode="inline"] div.cell_input {
    position: relative;
}

div.cell.cscs-is-editing[data-cscs-edit-mode="inline"] div.cell_input::after {
    background: rgba(239, 246, 255, 0.95);
    border: 1px solid rgba(37, 99, 235, 0.28);
    border-radius: 999px;
    color: #2563eb;
    content: "Editing";
    font-size: 0.8rem;
    font-weight: 400;
    letter-spacing: 0;
    line-height: 1;
    padding: 2px 6px;
    position: absolute;
    right: 10px;
    text-transform: none;
    top: 9px;
}

div.cell_input pre .cscs-code-line {
    display: block;
    min-height: 1.45em;
}

div.cell_input pre .cscs-code-line .linenos {
    pointer-events: none;
}

div.cell_input pre .cscs-code-line-content {
    display: inline-block;
    min-width: calc(100% - 3rem);
    outline: none;
    white-space: pre;
}

div.cell_input pre.cscs-inline-editing .cscs-code-line-content:focus {
    outline: none;
}

/* One output per cell (see code-editing-controls.js): the saved output is hidden
   once the run output replaces it. */
div.cell div.cell_output[hidden],
.cscs-execution-output[hidden] {
    display: none !important;
}
