/*
   DomEditorPanel layout.

   Mirrors the column structure used by .indi-hierarchy: a flex column that
   fills the right dock with a fixed-height header, a flex-grow body that
   hosts the Monaco container, and a fixed-height footer for reload/save.

   Sizing of the right dock itself lives in indi-body.css (.indi-dock-right).
 */

:root {
    --dom-editor-background-colour: var(--indi-light-transparent);
    --dom-editor-foreground-colour: var(--indi-light-text-colour);

    --dom-editor-header-background: var(--indi-primary-colour);
    --dom-editor-header-foreground: var(--indi-primary-text-colour);

    --dom-editor-border-colour: var(--indi-border-color, #ced4da);
}

.indi-dom-editor {
    display: flex;
    flex-flow: column nowrap;
    position: relative;
    flex-grow: 1;
    min-width: 0;
    background-color: var(--dom-editor-background-colour);
    color: var(--dom-editor-foreground-colour);
    height: 0; /* must force a concrete height (acts like min-height; flex-grow expands it) so the Monaco container can size itself */
}

.dom-editor-header {
    display: flex;
    flex-flow: row nowrap;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    height: 36px;
    padding: 6px 6px 6px 10px;
    background-color: var(--dom-editor-header-background);
    color: var(--dom-editor-header-foreground);
    flex: 0 0 auto;
}

.dom-editor-title {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.dom-editor-readonly,
.dom-editor-status {
    flex: 0 0 auto;
    font-size: 0.75em;
    font-weight: 500;
    max-width: 50%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dom-editor-close {
    flex: 0 0 auto;
    color: var(--dom-editor-header-foreground);
    padding: 0 4px;
    text-decoration: none;
}

.dom-editor-close:hover,
.dom-editor-close:focus {
    color: var(--dom-editor-header-foreground);
    opacity: 0.85;
    text-decoration: none;
}

.dom-editor-body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-flow: column nowrap;
    border-top: 1px solid var(--dom-editor-border-colour);
    border-bottom: 1px solid var(--dom-editor-border-colour);
    overflow: hidden;
}

.dom-editor-body .monaco-editor-container {
    width: 100%;
    height: 100%;
}

.dom-editor-empty,
.dom-editor-loading {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    font-style: italic;
    text-align: center;
}

.dom-editor-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.25rem;
    padding: 6px;
    flex: 0 0 auto;
}
