/* Blog post modals — Majorsoft ModalDialog; one scroll in .manage-blogpost-modal-shell */

.bmodal-content.manage-blogpost-modal-dialog,
.bmodal-content:has(.manage-blogpost-modal-shell) {
    width: min(900px, calc(100vw - 1.5rem)) !important;
    max-width: calc(100vw - 1.5rem) !important;
    min-width: 0 !important;
    max-height: calc(100vh - 1.5rem) !important;
    box-sizing: border-box;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

.bmodal:has(.manage-blogpost-modal-shell) {
    overflow-x: hidden;
}

.bmodal-content:has(.manage-blogpost-modal-shell) .bmodal-header {
    flex: 0 0 auto;
    display: block;
    padding-right: 2.5rem;
}

.manage-blogpost-modal-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    width: 100%;
}

.manage-blogpost-modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.3;
}

.manage-blogpost-details-toggle {
    appearance: none;
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.3;
    color: #5e5e5e;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    flex-shrink: 0;
}

.manage-blogpost-details-toggle::before {
    display: inline-block;
    margin-right: 0.2rem;
    font-size: 0.6rem;
    vertical-align: 0.05em;
    content: "▲";
}

.manage-blogpost-details-toggle[aria-expanded="false"]::before {
    content: "▼";
}

.manage-blogpost-details-toggle:hover,
.manage-blogpost-details-toggle:focus {
    color: var(--ds-brand-orange, #e65c00);
    text-decoration: underline;
    outline: none;
}

.manage-blogpost-meta-summary {
    margin-top: 0.35rem;
    font-size: 0.8125rem;
    color: #6c757d;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.bmodal-content:has(.manage-blogpost-modal-shell) .bmodal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0.75rem 0.25rem;
    box-sizing: border-box;
}

.bmodal-content:has(.manage-blogpost-modal-shell) .bmodal-footer {
    flex: 0 0 auto;
    padding: 0.5rem 0.75rem 0.65rem;
    background: #fff;
    z-index: 20;
}

/* Single scroll — title, meta fields, and editor together */
.manage-blogpost-modal-shell {
    flex: 1 1 auto;
    min-height: 0;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.manage-blogpost-modal-body,
.manage-blogpost-modal-body form {
    display: block;
    overflow: visible;
}

.manage-blogpost-modal-meta {
    overflow: visible;
    max-height: none;
    padding-top: 0.65rem;
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
    border-top: 1px solid #dee2e6;
    border-bottom: 1px solid #dee2e6;
}

.manage-blogpost-modal-meta.is-collapsed {
    display: none;
    margin: 0;
    padding: 0;
    border: none;
}

.manage-blogpost-modal-shell:has(.manage-blogpost-modal-meta.is-collapsed) .manage-blogpost-modal-editor-scroll .rz-html-editor,
.manage-blogpost-modal-shell:has(.manage-blogpost-modal-meta.is-collapsed) .manage-blogpost-editor.rz-html-editor {
    min-height: min(70vh, 560px);
}

.manage-blogpost-modal-shell:has(.manage-blogpost-modal-meta.is-collapsed) .rz-html-editor-content {
    min-height: min(60vh, 480px);
}

.manage-blogpost-modal-editor-scroll {
    overflow: visible;
    max-height: none;
    min-height: 0;
    padding-top: 0;
}

.manage-blogpost-modal-editor-scroll .manage-blogpost-editor.rz-html-editor,
.manage-blogpost-modal-editor-scroll .rz-html-editor {
    width: 100% !important;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    min-height: 280px;
    height: auto !important;
    max-height: none;
}

.manage-blogpost-modal-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: 0;
    padding: 0;
    border-top: none;
}

/* Toolbar stays visible while scrolling the modal */
.manage-blogpost-modal-shell .rz-html-editor-toolbar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: #fff;
    border-bottom: 1px solid #dee2e6;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    overflow-x: auto;
    overflow-y: visible !important;
    flex-wrap: wrap !important;
    -webkit-overflow-scrolling: touch;
}

.manage-blogpost-modal-shell .rz-html-editor-toolbar .rz-html-editor-button,
.manage-blogpost-modal-shell .rz-html-editor-colorpicker,
.manage-blogpost-modal-shell .rz-html-editor-colorpicker .rz-colorpicker,
.manage-blogpost-modal-shell .rz-html-editor-color {
    overflow: visible !important;
}

.manage-blogpost-modal-shell .rz-html-editor-colorpicker .rz-colorpicker-trigger {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    flex-shrink: 0;
}

.manage-blogpost-modal-shell .rz-html-editor-colorpicker .rz-colorpicker-trigger .rzi {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

body > .rz-colorpicker-popup.rz-popup,
body > .rz-popup.rz-colorpicker-popup {
    z-index: 2100 !important;
}

.manage-blogpost-modal-shell .rz-html-editor-content {
    flex: 1 1 auto;
    min-height: 240px;
    overflow-y: auto !important;
    overflow-x: hidden;
    height: auto !important;
}

/* reset.css sets ul/ul li { list-style: none } site-wide — restore editor list markers */
.manage-blogpost-modal-shell .rz-html-editor-content ul {
    list-style: disc outside;
    padding-left: 1.75em;
    margin: 0.35em 0 0.65em;
}

.manage-blogpost-modal-shell .rz-html-editor-content ol {
    list-style: decimal outside;
    padding-left: 1.75em;
    margin: 0.35em 0 0.65em;
}

.manage-blogpost-modal-shell .rz-html-editor-content ul > li,
.manage-blogpost-modal-shell .rz-html-editor-content ol > li {
    display: list-item;
    list-style: inherit;
    margin: 0.15em 0;
    padding-left: 0.15em;
}

.manage-blogpost-modal-shell .rz-html-editor-content figure.ds-blog-diagram,
.manage-blogpost-modal-shell .rz-html-editor-content pre.mermaid {
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    border: 1px solid var(--ds-outline-variant, #d8dce3);
    border-radius: 8px;
    background: #f8f9fb;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
    overflow-x: auto;
}

/* Keep toolbar clicks reachable (Radzen buttons use overflow:hidden by default) */
.manage-blogpost-modal-shell .rz-html-editor-toolbar .rz-html-editor-button {
    pointer-events: auto;
}

.manage-blogpost-cover-preview {
    max-height: 120px;
    width: auto;
    max-width: 100%;
}

@media (max-width: 767.98px) {
    .bmodal-content.manage-blogpost-modal-dialog,
    .bmodal-content:has(.manage-blogpost-modal-shell) {
        width: calc(100vw - 0.5rem) !important;
        max-width: calc(100vw - 0.5rem) !important;
        height: calc(100dvh - 0.5rem) !important;
        max-height: calc(100dvh - 0.5rem) !important;
        top: 0.25rem !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        margin: 0 !important;
    }

    .manage-blogpost-modal-title {
        font-size: 1.05rem;
    }

    .manage-blogpost-details-toggle {
        font-size: 0.75rem;
    }

    .bmodal-content:has(.manage-blogpost-modal-shell) .bmodal-footer {
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.06);
    }

    .manage-blogpost-modal-editor-scroll .manage-blogpost-editor.rz-html-editor,
    .manage-blogpost-modal-editor-scroll .rz-html-editor {
        min-height: 220px;
    }

    .manage-blogpost-modal-shell:has(.manage-blogpost-modal-meta.is-collapsed) .manage-blogpost-modal-editor-scroll .rz-html-editor,
    .manage-blogpost-modal-shell:has(.manage-blogpost-modal-meta.is-collapsed) .manage-blogpost-editor.rz-html-editor {
        min-height: min(72dvh, 520px);
    }

    .manage-blogpost-modal-shell .rz-html-editor-content {
        min-height: 180px;
    }

    .manage-blogpost-modal-shell:has(.manage-blogpost-modal-meta.is-collapsed) .rz-html-editor-content {
        min-height: min(62dvh, 440px);
    }

    .manage-blogpost-modal-shell .rz-html-editor-toolbar {
        flex-wrap: nowrap !important;
    }

    .manage-blogpost-modal-footer {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.35rem;
    }

    .manage-blogpost-modal-footer .btn {
        flex: 1 1 calc(50% - 0.2rem);
        min-width: 0;
        margin: 0;
        padding: 0.5rem 0.4rem;
        font-size: 0.8125rem;
    }

    .manage-blogpost-modal-footer .btn.btn-primary {
        flex: 1 1 100%;
        order: -1;
    }
}

