/* ============================================================
   CEMR PAGE LAYOUT
   --cemr-page-padding is the one outer padding for every page, set
   by .page-wrapper .content in app.css and .ipd-page-container in
   ipd.css. Do not add outer padding on a page's root element.
   Pharmacy POS (.pos-root) is the only exception: it fills the screen.

   .cemr-page-header and .cemr-page-card are opt-in and match the
   Pharmacy pages: a bordered header bar, a 24px gap, then content
   with no inner padding.
   ============================================================ */

:root {
    --cemr-page-padding: 10px 14px;
}

@media (max-width: 991.98px) {
    :root {
        --cemr-page-padding: 8px 10px;
    }
}

/* Bootstrap's container padding would add to the page padding. */
html.cemr-theme :is(.page-wrapper .content, .ipd-maximized-body) > .container-fluid {
    padding-inline: 0;
}

html.cemr-theme .cemr-page-header {
    min-height: 72px;
    margin: 0 0 24px;
    padding: 10px 16px;
    background: var(--cemr-ui-surface);
    border: 1px solid var(--cemr-ui-border);
    border-radius: 8px;
}

html.cemr-theme .cemr-page-header > div:last-child {
    margin-bottom: 0 !important;
}

html.cemr-theme .cemr-page-header .page-title {
    margin: 0 !important;
    font-size: 1.15rem !important;
    font-weight: 700;
    line-height: 1.25;
}

html.cemr-theme .cemr-page-title {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

html.cemr-theme .cemr-page-title-icon {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--cemr-ui-hover);
    color: var(--cemr-primary-text);
    font-size: 18px;
}

/* Another rule colours icons directly, too dark to read in dark mode. */
html.cemr-theme .cemr-page-title-icon i {
    color: inherit !important;
}

html.cemr-theme-dark .cemr-page-title-icon {
    background: var(--md-sys-color-surface-container);
}

/* Form actions stay in view while a long form scrolls. Must be a direct
   child of the form, so that no card clips it or limits how far it sticks. */
html.cemr-theme .cemr-form-actions {
    position: sticky;
    bottom: 0;
    z-index: 10;
    margin-top: 16px;
    padding: 10px 16px;
    background: var(--cemr-ui-surface);
    border: 1px solid var(--cemr-ui-border);
    border-radius: 8px;
}

/* The grid or scheduler inside draws the only frame. */
html.cemr-theme .card.custom-card.cemr-page-card {
    margin: 0 !important;
    background: transparent;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

html.cemr-theme .card.custom-card.cemr-page-card > .card-body {
    padding: 0 !important;
}
