/* Shared layout variables */
:root {
    --app-header-height: 104px;
    --pane-header-height: 42px;
    --source-font-size: 15px;
    --workspace-min-height: 520px;
}

html, body {
    min-height: 100%;
}

body {
    overflow-x: hidden;
}

.app-shell {
    background: var(--bs-body-bg);
}

.app-header {
    z-index: 1020;
}

.brand-icon {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: var(--bs-primary);
    background: color-mix(in srgb, var(--bs-primary) 12%, transparent);
}

.tool-row {
    scrollbar-width: thin;
}

.tool-row .btn {
    white-space: nowrap;
}

.btn-xs {
    --bs-btn-padding-y: .15rem;
    --bs-btn-padding-x: .38rem;
    --bs-btn-font-size: .72rem;
    --bs-btn-border-radius: .3rem;
}

.document-bar {
    min-height: 30px;
}

.min-w-0 {
    min-width: 0;
}

/* Main source and visual editor workspace */
.workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 8px minmax(0, 1fr);
    min-height: var(--workspace-min-height);
    height: calc(100vh - 238px);
    max-height: 1000px;
}

.editor-pane {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--bs-border-color);
    border-radius: .65rem;
    overflow: hidden;
    background: var(--bs-body-bg);
}

.pane-header {
    min-height: var(--pane-header-height);
    flex: 0 0 var(--pane-header-height);
    padding: .45rem .65rem;
    border-bottom: 1px solid var(--bs-border-color);
    background: var(--bs-tertiary-bg);
}

.pane-divider {
    position: relative;
    cursor: col-resize;
    touch-action: none;
}

.pane-divider::before {
    content: "";
    position: absolute;
    inset: 15% 3px;
    width: 2px;
    border-radius: 1px;
    background: var(--bs-border-color);
}

.markdown-source {
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    border: 0;
    outline: 0;
    resize: none;
    padding: 1rem;
    tab-size: 4;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: var(--source-font-size);
    line-height: 1.6;
    color: var(--bs-body-color);
    background: var(--bs-body-bg);
    caret-color: var(--bs-primary);
}

.markdown-source:focus {
    box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--bs-primary) 28%, transparent);
}

.markdown-source.no-wrap {
    white-space: pre;
    overflow-wrap: normal;
    overflow-x: auto;
}

.visual-editor {
    flex: 1 1 auto;
    min-height: 0;
}

.visual-editor .toastui-editor-defaultUI {
    height: 100% !important;
    border: 0;
    border-radius: 0;
}

.visual-editor .toastui-editor-toolbar {
    border-radius: 0;
}

.visual-editor .toastui-editor-main {
    min-height: 0;
}

[data-bs-theme="dark"] .visual-editor .toastui-editor-defaultUI,
[data-bs-theme="dark"] .visual-editor .toastui-editor-main,
[data-bs-theme="dark"] .visual-editor .toastui-editor-ww-container,
[data-bs-theme="dark"] .visual-editor .toastui-editor-md-container,
[data-bs-theme="dark"] .visual-editor .toastui-editor-contents,
[data-bs-theme="dark"] .visual-editor .ProseMirror {
    color: #dee2e6;
    background: #212529;
}

[data-bs-theme="dark"] .visual-editor .toastui-editor-toolbar,
[data-bs-theme="dark"] .visual-editor .toastui-editor-mode-switch {
    background: #2b3035;
    border-color: #495057;
}

[data-bs-theme="dark"] .visual-editor .toastui-editor-toolbar-icons {
    filter: invert(.86);
}

[data-bs-theme="dark"] .visual-editor .toastui-editor-contents code {
    color: #f1f3f5;
    background: #343a40;
}

[data-bs-theme="dark"] .visual-editor .toastui-editor-contents pre {
    background: #1b1f22;
}

.workspace.layout-source {
    grid-template-columns: minmax(0, 1fr);
}

.workspace.layout-source #visualPane,
.workspace.layout-source #paneDivider {
    display: none;
}

.workspace.layout-visual {
    grid-template-columns: minmax(0, 1fr);
}

.workspace.layout-visual #sourcePane,
.workspace.layout-visual #paneDivider {
    display: none;
}

.status-bar {
    column-gap: 1rem;
}

/* Full screen file drop feedback */
.drop-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(10, 20, 35, .72);
    backdrop-filter: blur(5px);
}

.drop-card {
    width: min(480px, 92vw);
    padding: 2.25rem 1.5rem;
    text-align: center;
    color: #fff;
    border: 2px dashed rgba(255,255,255,.7);
    border-radius: 1rem;
    background: rgba(255,255,255,.09);
}

/* Functional cookie information panel */
.cookie-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1080;
    border-top: 1px solid var(--bs-border-color);
    background: color-mix(in srgb, var(--bs-body-bg) 96%, transparent);
    box-shadow: 0 -.4rem 1.2rem rgba(0,0,0,.12);
    backdrop-filter: blur(8px);
}

.help-code {
    padding: 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .5rem;
    overflow: auto;
    background: var(--bs-tertiary-bg);
}

.footer-chevron {
    transition: transform .2s ease;
}

#footerToggle[aria-expanded="true"] .footer-chevron {
    transform: rotate(180deg);
}

.gap-x-3 {
    column-gap: 1rem;
}

.gap-y-1 {
    row-gap: .25rem;
}

/* Tablet and phone workspace layout */
@media (max-width: 991.98px) {
    :root {
        --workspace-min-height: 560px;
    }

    .workspace.layout-split {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(300px, 1fr) 8px minmax(340px, 1fr);
        height: auto;
        max-height: none;
    }

    .workspace.layout-split .pane-divider {
        cursor: row-resize;
    }

    .workspace.layout-split .pane-divider::before {
        inset: 3px 20%;
        width: auto;
        height: 2px;
    }

    .workspace.layout-source,
    .workspace.layout-visual {
        min-height: 620px;
        height: calc(100vh - 235px);
        max-height: 900px;
    }
}

@media (max-width: 575.98px) {
    .navbar-brand {
        max-width: 54vw;
        font-size: .95rem;
    }

    .navbar-brand > span[data-i18n="appName"] {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .workspace.layout-split {
        grid-template-rows: minmax(330px, 48vh) 8px minmax(390px, 54vh);
    }

    .workspace.layout-source,
    .workspace.layout-visual {
        min-height: 70vh;
        height: 70vh;
    }

    .status-bar .ms-auto {
        width: 100%;
        margin-left: 0 !important;
    }

    .pane-header {
        padding-left: .5rem;
        padding-right: .5rem;
    }

    .visual-editor .toastui-editor-toolbar-group {
        margin-right: 2px;
    }
}
