/* Shared application dialog chrome. Loaded after module styles in _Layout.
   Local selectors retain layout, content, badges and behaviour; header dimensions,
   title typography and dismiss controls have one application-wide definition. */
:root {
    --ultra-modal-header-background: #D92D30;
    --ultra-modal-header-title-size: 16px;
    --ultra-modal-header-height: 52px;
    --ultra-modal-header-inset: 20px;
    --ultra-modal-close-size: 32px;
}

.modal.ultra-stacked-modal,
.modal-backdrop.ultra-stacked-modal {
    z-index: var(--ultra-dialog-layer) !important;
}

@media screen {
    .ultra-app-shell .modal {
        align-content: safe center;
    }

    /* Bootstrap already dims the page with the dialog's backdrop. */
    .ultra-modal-with-backdrop {
        background-color: transparent;
    }

    /* These image viewers reserve 100px for the close control. Split that space evenly. */
    .ultra-app-shell .image-zoom-modal:has(> img.image-zoom-content) {
        padding-block: 50px;
        align-content: safe center;
    }

    .ultra-app-shell .pd-supplier-search-overlay {
        align-items: safe center;
    }

    .ultra-dialog-open :is(#ultraPosAssistant, .site-back-to-top) {
        visibility: hidden;
    }
}

:is(.modal-header, .pd-modal > header, .bmu-collection-breakdown-header,
    .bmu-quote-date-modal-head) {
    position: relative !important;
    display: block !important;
    box-sizing: border-box;
    flex-shrink: 0;
    min-height: var(--ultra-modal-header-height) !important;
    height: auto !important;
    padding: 14px 64px 14px var(--ultra-modal-header-inset) !important;
    background: var(--ultra-modal-header-background) !important;
    background-image: none !important;
    color: #fff !important;
    border: 0 !important;
    text-align: left;
}

:is(.modal-header, .pd-modal > header, .bmu-collection-breakdown-header,
    .bmu-quote-date-modal-head)::before,
:is(.modal-header, .pd-modal > header, .bmu-collection-breakdown-header,
    .bmu-quote-date-modal-head)::after { display: none !important; }

:is(.modal-header, .pd-modal > header, .bmu-collection-breakdown-header,
    .bmu-quote-date-modal-head) :is(.modal-title, h2, h3, h4, h5),
.bmu-quote-date-modal-head > strong,
#pd-modal .pd-modal > header #pd-modal-title {
    margin: 0 !important;
    padding: 0 !important;
    color: #fff !important;
    font-family: inherit;
    font-size: var(--ultra-modal-header-title-size) !important;
    font-weight: 600 !important;
    line-height: 24px !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    overflow-wrap: anywhere;
}

:is(.modal-header .close, .pd-modal > header > button,
    .bmu-collection-breakdown-header > button, .bmu-quote-date-modal-head > button) {
    position: absolute !important;
    top: 10px !important;
    right: var(--ultra-modal-header-inset) !important;
    left: auto !important;
    bottom: auto !important;
    float: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box;
    width: var(--ultra-modal-close-size) !important;
    height: var(--ultra-modal-close-size) !important;
    min-width: var(--ultra-modal-close-size) !important;
    min-height: var(--ultra-modal-close-size) !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 1px solid #ffffff40 !important;
    border-radius: 50% !important;
    background: #ffffff1f !important;
    color: #fff !important;
    font: 400 22px/1 Arial, sans-serif !important;
    opacity: 1 !important;
    text-shadow: none !important;
    cursor: pointer;
    transform: none !important;
}
:is(.modal-header .close, .pd-modal > header > button,
    .bmu-collection-breakdown-header > button, .bmu-quote-date-modal-head > button):hover {
    background: #ffffff38 !important;
}
:is(.modal-header .close, .pd-modal > header > button,
    .bmu-collection-breakdown-header > button, .bmu-quote-date-modal-head > button):focus-visible {
    outline: 2px solid #fff !important;
    outline-offset: 3px !important;
}
:is(.modal-header .close, .pd-modal > header > button,
    .bmu-collection-breakdown-header > button, .bmu-quote-date-modal-head > button):disabled {
    opacity: .45 !important;
    cursor: not-allowed;
}

/* Keep existing secondary information readable and actions clear of the close. */
.modal-header :is(.products-modal-subtitle, .quota-details-modal-header-sub,
    .payroll-sales-report-modal-kicker) { color: #fff !important; opacity: .85; }
.payroll-sales-report-modal-actions { position: static !important; }
.payroll-sales-report-modal-header { padding-right: 164px !important; }
.payroll-sales-report-modal-actions > .btn-group { position: absolute; top: 10px; right: 64px; margin: 0; }
/* Team Check-in keeps Refresh beside the shared close control. The shared block
   header must not leave its tool wrapper in normal flow above the title. */
.bmu-team-checkin-modal .modal-header { padding-right: 108px !important; }
.bmu-team-checkin-modal .bmu-team-checkin-header-tools { display: contents; }
.bmu-team-checkin-modal .bmu-team-checkin-header-tools > [data-bmu-team-checkin-refresh] {
    position: absolute;
    top: 10px;
    right: calc(var(--ultra-modal-header-inset) + var(--ultra-modal-close-size) + 8px);
    width: var(--ultra-modal-close-size);
    height: var(--ultra-modal-close-size);
}
.bmu-team-checkin-modal .bmu-team-checkin-header-tools > [data-bmu-team-checkin-refresh]:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}
.modal-header :is(.pm-lucky-header-counts, .pm-invite-header-counts, .pm-lucky-header-badge) {
    position: static !important;
    margin-top: 6px;
    flex-wrap: wrap;
}
.pd-modal > header .pd-vehicle-header-status { display: inline-block; margin-top: 6px; }

@media (max-width: 767px) {
    :root { --ultra-modal-header-inset: 16px; }
}

/* Kendo owns window positioning; retain its titlebar offset and action icons. */
.k-window:not(.k-dialog) { padding-top: var(--ultra-modal-header-height) !important; }
.k-window-titlebar {
    box-sizing: border-box;
    min-height: var(--ultra-modal-header-height) !important;
    height: var(--ultra-modal-header-height) !important;
    padding: 14px var(--ultra-modal-header-inset) !important;
    margin-top: calc(-1 * var(--ultra-modal-header-height)) !important;
    border: 0 !important;
    background: var(--ultra-modal-header-background) !important;
    color: #fff !important;
}
.k-dialog .k-window-titlebar { margin-top: 0 !important; }
.k-window-titlebar .k-window-title {
    color: #fff !important;
    font-size: var(--ultra-modal-header-title-size) !important;
    font-weight: 600 !important;
    line-height: 24px !important;
    left: var(--ultra-modal-header-inset);
    right: 100px;
}
.k-window-titlebar .k-window-actions { top: 10px !important; right: var(--ultra-modal-header-inset) !important; }
.k-window-titlebar .k-window-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: var(--ultra-modal-close-size) !important;
    height: var(--ultra-modal-close-size) !important;
    padding: 0 !important;
    border: 1px solid #ffffff40 !important;
    border-radius: 50% !important;
    background: #ffffff1f !important;
    color: #fff !important;
}
.k-window-titlebar .k-window-action:hover { background: #ffffff38 !important; }
.k-window-titlebar .k-window-action:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
