/* =============================================================================
   In-browser document editor page (/documents/edit/{id}) — #2040

   The editor must get every pixel the shell leaves over: the sidebar and the
   top bar stay, everything else is editor. Instead of guessing an offset
   (`calc(100vh - 220px)`), the page fills the shell's flex column:

     .rz-layout (grid, 100vh)  →  .rz-body (flex column, the scroll container)
       →  .adv-topbar  +  .adv-content (flex: 1)  →  .adv-doc-editor  →  host

   These rules are global on purpose — scoped CSS cannot reach MainLayout's
   .rz-body / .adv-content — and every one is keyed on the editor host being
   on the page, so no other page changes.

   Naming trap: the wrapper class must NOT contain "-page", or
   `.adv-content > [class*="-page"]` (_base.css) gives it a 100vh min-height
   and the page overflows.
   ========================================================================== */

/* MainLayout sets `height: 100vh` inline; on phones the dynamic viewport is
   the visible one (browser toolbars), so prefer it here. */
.rz-layout:has(#adv-document-editor-host) {
    height: 100dvh !important;
}

/* Radzen pads the body with --rz-layout-body-padding (1rem); the
   `--rz-body-padding: 0` in _base.css is not a variable Radzen reads. */
.rz-body:has(#adv-document-editor-host) {
    --rz-layout-body-padding: 0;
}

.adv-content:has(> .adv-doc-editor) {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0 0.75rem 0.5rem;
}

/* `div.` matches the specificity of `.adv-content > div:first-child`, which the
   ≤992px / ≤768px breakpoints pad and round; this file is imported after
   _responsive.css, so these values win. */
.adv-content > div.adv-doc-editor {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 0;
    border-radius: 0;
}

/* One row: breadcrumb, file name, mode badge. */
.adv-doc-editor__header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 2.25rem;
    padding: 0.25rem 0;
    min-width: 0;
}

.adv-doc-editor__header .adv-breadcrumb {
    margin: 0;
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.adv-doc-editor__title {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.adv-doc-editor__notice {
    margin: 0 0 0.5rem 0 !important;
}

/* The editor host: DocsAPI replaces a throwaway child with its iframe, so
   the iframe is a direct child. Absolutely filling the host avoids both the
   inline-iframe baseline gap and percentage heights inside a flex item. */
.adv-doc-editor__host {
    position: relative;
    flex: 1 1 0;
    min-height: 320px;
}

.adv-doc-editor__host > * {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.adv-doc-editor__host.is-hidden {
    display: none;
}

@media (max-width: 768px) {
    .adv-content:has(> .adv-doc-editor) {
        padding: 0;
    }

    .adv-doc-editor__header {
        padding: 0.25rem 0.5rem;
    }

    .adv-doc-editor__header .adv-breadcrumb {
        display: none;
    }
}
