/**
 * Shared Report chrome — consistency + responsive layout across Reports.
 *
 * Desktop slot order (left → right), right-aligned group — omit empty
 * slots, never reorder by report:
 *
 *   [Other Options]  [Date Range]  [Buttons]
 *
 * Frequency of an option determines its location:
 *   1. Other options  (.filter-order-1 … .filter-order-4)
 *      Report-specific toggles, entity selects, Hours/Events/Find, etc.
 *      Relative order among these may vary; all stay left of Date Range.
 *   2. Date range     (.date-range-wrapper) — present on all reports
 *   3. Buttons        (.print-icon-wrapper) — PDF / Print / Excel; always
 *      at the right end so they do not move when other options appear/hide
 *
 * Breakpoints:
 *   ≥992px  title left, filters right on one row
 *   768–991 title on first row; filters wrap full-width below
 *   <768px  stacked full-width controls; mobile chrome only
 */

:root {
    --report-chrome-gap: 8px;
    --report-chrome-gap-lg: 12px;
    --report-chrome-pad-y: 10px;
    --report-chrome-pad-x: 15px;
    --report-chrome-title-size: 18px;
    --report-chrome-title-size-sm: 15px;
    --report-chrome-title-weight: 600;
    --report-chrome-bg: #ffffff;
    --report-chrome-border: #e8e8e8;
    --report-chrome-muted: #555555;
    --report-chrome-date-width: 201px;
    --report-chrome-control-height: 34px;
    --report-chrome-radius: 3px;
}

/* ---------- Base ---------- */

.report-chrome,
.breadcrumb-wrapper.report-chrome {
    display: flex !important;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--report-chrome-gap);
    background: var(--report-chrome-bg);
    border-bottom: 1px solid var(--report-chrome-border);
    padding: var(--report-chrome-pad-y) var(--report-chrome-pad-x) !important;
    min-height: 52px !important;
    height: auto !important;
    box-sizing: border-box;
    width: 100%;
}

.report-chrome__title,
.report-chrome .mainTitle-v1,
.report-chrome .mainTitle,
.report-chrome .breadcrumb-mobile-title {
    flex: 0 1 auto;
    float: none !important;
    margin: 0 !important;
    font-size: var(--report-chrome-title-size) !important;
    font-weight: var(--report-chrome-title-weight);
    line-height: 1.3;
    color: #333;
    min-width: 0;
}

.report-chrome__filters,
.report-chrome .print-pdf-btns-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: var(--report-chrome-gap);
    flex: 1 1 auto;
    margin-left: auto;
    float: none !important;
    min-width: 0;
}

.report-chrome .print-pdf-btns,
.report-chrome .print-pdf-btns-pull-right,
.report-chrome ul.breadcrumb,
.report-chrome ul.pull-right.breadcrumb {
    float: none !important;
    display: flex;
    flex-wrap: wrap;
    flex: 1 1 auto;
    align-items: center;
    justify-content: flex-end;
    gap: var(--report-chrome-gap);
    margin: 0 !important;
    padding: 0 !important;
    list-style: none;
    min-width: 0;
    background: transparent;
    border: 0;
}

/* Neutralize legacy float soup inside chrome */
.report-chrome .print-pdf-btns .pull-right,
.report-chrome .print-pdf-btns .pull-left,
.report-chrome .print-pdf-btns-pull-right .pull-right,
.report-chrome .print-pdf-btns-pull-right .pull-left,
.report-chrome .m-right10 {
    float: none !important;
    margin-right: 0 !important;
}

/* Other options — left of date/buttons; relative order among themselves */
.report-chrome .filter-order-1 { order: 1; }
.report-chrome .filter-order-2 { order: 2; }
.report-chrome .filter-order-3 { order: 3; }
.report-chrome .filter-order-4 { order: 4; }

.report-chrome .date-range-wrapper,
.report-chrome .breadcrumb-mobile-daterange {
    position: relative !important;
    display: flex !important;
    align-items: center;
    margin-bottom: 0 !important;
    /* Always immediately left of buttons, after all other options */
    order: 90;
    flex: 0 1 auto;
}

.report-chrome .date-range-wrapper input,
.report-chrome .daterange-input,
.report-chrome .breadcrumb-mobile-daterange input {
    width: var(--report-chrome-date-width);
    max-width: 100%;
    height: var(--report-chrome-control-height);
    padding-left: 28px !important;
    padding-right: 22px !important;
    border-radius: var(--report-chrome-radius);
}

.report-chrome .date-range-wrapper .daterange-input-left,
.report-chrome .breadcrumb-mobile-daterange .bm-cal-icon,
.report-chrome i.daterange-input-left,
.report-chrome i.fa-calendar.daterange-input-left {
    position: absolute !important;
    left: 8px;
    z-index: 2;
    pointer-events: none;
    color: var(--report-chrome-muted);
}

.report-chrome .date-range-wrapper .daterange-input-right,
.report-chrome .breadcrumb-mobile-daterange .bm-caret-icon,
.report-chrome i.daterange-input-right {
    position: absolute !important;
    right: 8px;
    z-index: 2;
    cursor: pointer;
    color: var(--report-chrome-muted);
}

.report-chrome .print-icon-wrapper,
.report-chrome .breadcrumb-mobile-print,
.report-chrome .breadcrumb-print-mobile {
    display: flex;
    align-items: center;
    gap: 10px;
    /* Always rightmost — stable when other options appear/hide */
    order: 100;
    margin-left: 4px;
    flex-shrink: 0;
}

/* Legacy filter-order-5/6 on action wrappers only (not date-range) */
.report-chrome .filter-order-5.print-icon-wrapper,
.report-chrome .filter-order-6.print-icon-wrapper,
.report-chrome .filter-order-5.breadcrumb-print-mobile,
.report-chrome .filter-order-6.breadcrumb-print-mobile {
    order: 100;
}

.report-chrome .print-icon-wrapper a,
.report-chrome .print-icon-wrapper .getPdf_v1,
.report-chrome .breadcrumb-mobile-print,
.report-chrome .getPdf_v1 {
    display: inline-flex;
    align-items: center;
    color: inherit;
    text-decoration: none;
}

.report-chrome .header-checkbox-wrapper,
.report-chrome .school-checkbox-wrapper,
.report-chrome .stack-checkbox-wrapper {
    display: flex;
    align-items: center;
}

.report-chrome .header-checkbox-wrapper .checkbox,
.report-chrome .school-checkbox-wrapper .checkbox,
.report-chrome .uta-print-all-wrapper .checkbox,
.report-chrome .stack-checkbox-wrapper.checkbox,
.report-chrome .checkbox {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.report-chrome .form-group-select,
.report-chrome .form-group.pull-left,
.report-chrome .form-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--report-chrome-gap);
    margin-bottom: 0 !important;
}

.report-chrome .form-control,
.report-chrome .btn.btn-default {
    height: var(--report-chrome-control-height);
}

.report-chrome .btn.btn-default {
    padding-top: 6px;
    padding-bottom: 6px;
}

.report-chrome .clear {
    display: none !important;
}

/* ---------- Tablet ---------- */

@media screen and (max-width: 991px) {
    .report-chrome:not(.report-chrome--mobile) {
        align-items: flex-start;
        gap: var(--report-chrome-gap-lg);
    }

    .report-chrome:not(.report-chrome--mobile) .report-chrome__title,
    .report-chrome:not(.report-chrome--mobile) .mainTitle-v1,
    .report-chrome:not(.report-chrome--mobile) .mainTitle {
        flex: 1 1 100%;
        white-space: normal;
        max-width: 100%;
    }

    .report-chrome:not(.report-chrome--mobile) .print-pdf-btns,
    .report-chrome:not(.report-chrome--mobile) .print-pdf-btns-pull-right,
    .report-chrome:not(.report-chrome--mobile) .report-chrome__filters,
    .report-chrome:not(.report-chrome--mobile) .print-pdf-btns-container,
    .report-chrome:not(.report-chrome--mobile) ul.breadcrumb {
        flex: 1 1 100%;
        width: 100%;
        margin-left: 0;
        justify-content: flex-start;
    }

    .report-chrome:not(.report-chrome--mobile) .date-range-wrapper,
    .report-chrome:not(.report-chrome--mobile) .form-group {
        flex: 1 1 180px;
        max-width: 100%;
    }

    .report-chrome:not(.report-chrome--mobile) .date-range-wrapper input,
    .report-chrome:not(.report-chrome--mobile) .daterange-input {
        width: 100%;
    }

    .report-chrome:not(.report-chrome--mobile) .print-icon-wrapper {
        margin-left: auto;
    }
}

/* ---------- Phone ---------- */

@media screen and (max-width: 767px) {
    .report-chrome--desktop-only,
    .report-chrome.hidden-xs {
        display: none !important;
    }

    .report-chrome:not(.report-chrome--desktop-only):not(.hidden-xs) {
        display: flex !important;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px 12px 14px !important;
    }

    .report-chrome:not(.report-chrome--desktop-only) .report-chrome__title,
    .report-chrome:not(.report-chrome--desktop-only) .mainTitle-v1,
    .report-chrome:not(.report-chrome--desktop-only) .mainTitle {
        font-size: var(--report-chrome-title-size-sm) !important;
        white-space: normal;
        width: 100%;
    }

    .report-chrome:not(.report-chrome--desktop-only) .print-pdf-btns,
    .report-chrome:not(.report-chrome--desktop-only) .report-chrome__filters,
    .report-chrome:not(.report-chrome--desktop-only) .print-pdf-btns-container,
    .report-chrome:not(.report-chrome--desktop-only) ul.breadcrumb {
        width: 100%;
        margin-left: 0;
        justify-content: flex-start;
    }

    .report-chrome:not(.report-chrome--desktop-only) .header-checkbox-wrapper,
    .report-chrome:not(.report-chrome--desktop-only) .form-group-select,
    .report-chrome:not(.report-chrome--desktop-only) .date-range-wrapper,
    .report-chrome:not(.report-chrome--desktop-only) .school-checkbox-wrapper,
    .report-chrome:not(.report-chrome--desktop-only) .form-group,
    .report-chrome:not(.report-chrome--desktop-only) .print-pdf-btns > .pull-right,
    .report-chrome:not(.report-chrome--desktop-only) .print-pdf-btns > .pull-left {
        flex: 1 1 100%;
        width: 100%;
        max-width: 100%;
    }

    .report-chrome:not(.report-chrome--desktop-only) .date-range-wrapper input,
    .report-chrome:not(.report-chrome--desktop-only) .daterange-input,
    .report-chrome:not(.report-chrome--desktop-only) .form-control,
    .report-chrome:not(.report-chrome--desktop-only) .btn.btn-default,
    .report-chrome:not(.report-chrome--desktop-only) select.form-control {
        width: 100% !important;
    }

    .report-chrome:not(.report-chrome--desktop-only) .print-icon-wrapper {
        width: 100%;
        justify-content: flex-end;
        margin-left: 0;
        padding-top: 4px;
    }

    /* Wide tables: allow horizontal scroll instead of crushing */
    .container-fullw .table-responsive,
    .frequency-report-table-wrap,
    .report-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ---------- Logs / shared mobile block ---------- */

/* Must beat `.report-chrome { display: flex !important }` or both
   desktop + mobile Find/filters render at once (e.g. Activity Log). */
.report-chrome--mobile.breadcrumb-mobile,
.report-chrome.report-chrome--mobile {
    display: none !important;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
    margin-bottom: 0;
    background: var(--report-chrome-bg);
    border-bottom: 1px solid var(--report-chrome-border);
}

@media screen and (max-width: 767px) {
    .report-chrome--mobile.breadcrumb-mobile,
    .report-chrome.report-chrome--mobile.visible-xs-block {
        display: flex !important;
    }
}

.report-chrome--mobile .breadcrumb-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--report-chrome-gap);
    margin-bottom: 0;
}

.report-chrome--mobile .breadcrumb-mobile-title {
    flex: 1 1 auto;
    font-size: var(--report-chrome-title-size-sm) !important;
    white-space: normal;
}

.report-chrome--mobile .breadcrumb-mobile-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--report-chrome-gap);
    width: 100%;
    margin-bottom: 0;
}

.report-chrome--mobile .breadcrumb-mobile-daterange {
    flex: 1 1 100%;
    width: 100%;
}

.report-chrome--mobile .breadcrumb-mobile-daterange input,
.report-chrome--mobile .breadcrumb-mobile-hours,
.report-chrome--mobile .breadcrumb-mobile-events,
.report-chrome--mobile .breadcrumb-mobile-pareto,
.report-chrome--mobile .breadcrumb-mobile-topic,
.report-chrome--mobile .breadcrumb-mobile-users,
.report-chrome--mobile .breadcrumb-mobile-district {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
}

.report-chrome--mobile .breadcrumb-mobile-hours select,
.report-chrome--mobile .breadcrumb-mobile-events select,
.report-chrome--mobile .breadcrumb-mobile-pareto select,
.report-chrome--mobile .breadcrumb-mobile-topic select,
.report-chrome--mobile .breadcrumb-mobile-topic .ui-select-container {
    width: 100% !important;
}

.report-chrome--mobile .breadcrumb-mobile-uta-print-all .uta-print-all-wrapper {
    width: 100%;
    flex-wrap: wrap;
}

.report-chrome--mobile .breadcrumb-mobile-district .btn-group,
.report-chrome--mobile .breadcrumb-mobile-district .btn {
    width: 100%;
    text-align: left;
}

.report-chrome--mobile .breadcrumb-mobile-print {
    flex-shrink: 0;
    padding-left: 8px;
}

@media screen and (min-width: 992px) {
    .breadcrumb-wrapper-v1.report-chrome {
        flex-wrap: nowrap !important;
    }
    .breadcrumb-wrapper-v1.report-chrome .mainTitle-v1,
    .breadcrumb-wrapper-v1.report-chrome .mainTitle {
        flex: 0 0 auto;
        white-space: nowrap;
    }
}
