/*
    CR-15: the shared right-hand fly-in panel.

    Only tokens already defined in rw-design-system.css are used. The panel holds a real page, so
    its contents bring their own styles - the rules here cover the panel frame and a few resets so
    a page built for a full-width column does not fight a 44rem panel.
*/

.rw-flyin {
    width: 80vw;
    max-width: 100%;
    border-left: 1px solid var(--rw-border);
}

.rw-flyin__header {
    gap: .75rem;
    align-items: center;
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--rw-border);
    background: var(--rw-surface);
}

.rw-flyin__title {
    margin: 0;
    font-size: var(--rw-text-h3);
    font-weight: 600;
    /* A long page title must not push the close button off the header. */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rw-flyin__actions {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-left: auto;
    flex: 0 0 auto;
}

.rw-flyin__full {
    color: var(--rw-primary);
    font-size: var(--rw-text-sm);
    text-decoration: none;
    /* Comfortably past the 24px AA target, and it sits beside the close button. */
    min-height: 1.75rem;
    display: inline-flex;
    align-items: center;
}

.rw-flyin__full:hover,
.rw-flyin__full:focus-visible {
    text-decoration: underline;
}

.rw-flyin__body {
    padding: 1rem;
    background: var(--rw-canvas);
}

.rw-flyin__message {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .75rem;
    padding: 1.5rem .25rem;
    color: var(--rw-muted);
}

.rw-flyin__message p {
    margin: 0;
}

/*
    The page inside the panel was written for a full-width column. These soften the worst of that
    without restyling the page itself: drop its outer page padding and width cap, and let wide
    tables scroll inside the panel rather than forcing the whole panel to scroll sideways.
*/
.rw-flyin__body .rw-page,
.rw-flyin__body .rw-content-container,
.rw-flyin__body .rw-content-container--wide,
.rw-flyin__body .container,
.rw-flyin__body .container-fluid {
    max-width: 100%;
    margin: 0;
    padding-left: 0;
    padding-right: 0;
}

.rw-flyin__body .table-responsive,
.rw-flyin__body .rw-table-scroll {
    overflow-x: auto;
}

/* A page's own sticky header would stick to the panel, not the window, and sit in the way. */
.rw-flyin__body .sticky-top,
.rw-flyin__body [style*="position: sticky"] {
    position: static !important;
}

/*
    2026-10-26: the page in the panel was designed for the full viewport, and the browser still
    reports the full viewport width, so every desktop media query stays on while the content sits in
    a 54rem box. The rules below make the panel behave like a tablet-width screen without touching
    the pages themselves. All of them are scoped to the panel body (the "body ." prefix is only for
    specificity over role shells such as body.program-team-d3 .offcanvas).
*/

/* 1. Text must break between words, never inside them. Several shells set
      overflow-wrap:anywhere on headings, cells and offcanvases; in a flex row or table that lets a
      column shrink to one character wide ("E v e n t s"). break-word wraps long words only when
      nothing else fits and does not change how wide a column wants to be. */
body .rw-flyin.offcanvas,
body .rw-flyin__body,
body .rw-flyin__body :is(h1, h2, h3, h4, h5, h6, p, li, dt, dd, td, th, label, legend, a, button, .btn, .offcanvas, .card, .pt-card, span, strong, small) {
    overflow-wrap: break-word;
    word-break: normal;
}

/* 2. A page header is a row of "title | actions" on a wide screen. In the panel the actions go
      under the title and wrap, so the title keeps its full width. */
body .rw-flyin__body .rw-page-header,
body .rw-flyin__body .pt-page-header,
body .rw-flyin__body .pt-section-heading,
body .rw-flyin__body .pt-prototype-heading,
body .rw-flyin__body .vol-provider__header,
body .rw-flyin__body .volunteering-admin__header {
    flex-direction: column;
    align-items: stretch;
}

body .rw-flyin__body .rw-page-header > *,
body .rw-flyin__body .pt-page-header > * {
    min-width: 0;
    max-width: 100%;
}

body .rw-flyin__body .rw-page-actions,
body .rw-flyin__body .pt-page-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
    max-width: 100%;
}

body .rw-flyin__body .rw-page-actions > *,
body .rw-flyin__body .pt-page-actions > * {
    white-space: normal;
    flex: 0 1 auto;
}

body .rw-flyin__body .rw-page-header__aside {
    max-width: none;
    text-align: left;
}

/* Program Team pages that build the header as a Bootstrap row ("col" + "col-auto" actions). */
body .rw-flyin__body .row.pt-page-heading > .col,
body .rw-flyin__body .row.pt-page-heading > .col-auto,
body .rw-flyin__body .row.pt-page-heading > [class*="col-"] {
    flex: 0 0 100%;
    width: 100%;
    max-width: 100%;
}

body .rw-flyin__body .row.pt-page-heading > .col-auto {
    margin-top: 8px;
}

/* DataTables sets an explicit pixel width on the table it manages; in the panel the table takes the
   panel's width and its wrapper scrolls if the columns still need more. */
body .rw-flyin__body .dataTables_wrapper {
    max-width: 100%;
    overflow-x: auto;
}

body .rw-flyin__body table[style*="width"] {
    width: 100% !important;
}

/* DataTables with scrollX clones the header into its own table after the page is injected; the
   whole scroll block takes the panel width and scrolls inside itself. */
body .rw-flyin__body .dataTables_scroll,
body .rw-flyin__body .dataTables_scrollHead,
body .rw-flyin__body .dataTables_scrollBody {
    max-width: 100%;
    overflow-x: auto;
}

body .rw-flyin__body .dataTables_scrollHeadInner,
body .rw-flyin__body .dataTables_scrollHeadInner table {
    width: 100% !important;
}

/* A card that still holds something wider than the panel scrolls rather than being cut off. */
body .rw-flyin__body .card {
    max-width: 100%;
    overflow-x: auto;
}

/* 3. Bootstrap columns sized for large screens (col-lg-*, col-xl-*) stack, as they would on a
      tablet. col-md-* keeps working: 54rem is close to the md range those were designed for.
      Halves and auto-width columns are left alone - two 26rem columns fit. */
body .rw-flyin__body [class*="col-lg-"]:not(.col-lg-6):not(.col-lg-auto),
body .rw-flyin__body [class*="col-xl-"]:not(.col-xl-6):not(.col-xl-auto),
body .rw-flyin__body [class*="col-xxl-"]:not(.col-xxl-6):not(.col-xxl-auto) {
    flex: 0 0 100%;
    width: 100%;
    max-width: 100%;
}

/* 3a. QA 41/49: ...and a column that also declares a col-md-* size takes that medium size, as the comment above
      intends. Without this each skill's four fields stacked (388px per skill); a col-md-12 still stacks. From the md
      breakpoint up only: these beat the phone rule further down on specificity, and on a phone everything stacks. */
@media (min-width: 768px) {
    body .rw-flyin__body [class*="col-lg-"]:not(.col-lg-6):not(.col-lg-auto).col-md-3,
    body .rw-flyin__body [class*="col-xl-"]:not(.col-xl-6):not(.col-xl-auto).col-md-3,
    body .rw-flyin__body [class*="col-xxl-"]:not(.col-xxl-6):not(.col-xxl-auto).col-md-3 { flex: 0 0 25%; width: 25%; max-width: 25%; }
    body .rw-flyin__body [class*="col-lg-"]:not(.col-lg-6):not(.col-lg-auto).col-md-4,
    body .rw-flyin__body [class*="col-xl-"]:not(.col-xl-6):not(.col-xl-auto).col-md-4,
    body .rw-flyin__body [class*="col-xxl-"]:not(.col-xxl-6):not(.col-xxl-auto).col-md-4 { flex: 0 0 33.3333%; width: 33.3333%; max-width: 33.3333%; }
    body .rw-flyin__body [class*="col-lg-"]:not(.col-lg-6):not(.col-lg-auto).col-md-6,
    body .rw-flyin__body [class*="col-xl-"]:not(.col-xl-6):not(.col-xl-auto).col-md-6,
    body .rw-flyin__body [class*="col-xxl-"]:not(.col-xxl-6):not(.col-xxl-auto).col-md-6 { flex: 0 0 50%; width: 50%; max-width: 50%; }
    body .rw-flyin__body [class*="col-lg-"]:not(.col-lg-6):not(.col-lg-auto).col-md-8,
    body .rw-flyin__body [class*="col-xl-"]:not(.col-xl-6):not(.col-xl-auto).col-md-8,
    body .rw-flyin__body [class*="col-xxl-"]:not(.col-xxl-6):not(.col-xxl-auto).col-md-8 { flex: 0 0 66.6667%; width: 66.6667%; max-width: 66.6667%; }
    body .rw-flyin__body [class*="col-lg-"]:not(.col-lg-6):not(.col-lg-auto).col-md-9,
    body .rw-flyin__body [class*="col-xl-"]:not(.col-xl-6):not(.col-xl-auto).col-md-9,
    body .rw-flyin__body [class*="col-xxl-"]:not(.col-xxl-6):not(.col-xxl-auto).col-md-9 { flex: 0 0 75%; width: 75%; max-width: 75%; }
}

/* 3b. Resume layout picker: three small pictures side by side. Stacked full-width they were 1,500 px tall,
      and the two-page picture (template 3) collapsed to a thin strip. */
body .rw-flyin__body .rw-resume-builder-page__templates > [class*="col-lg-"]:not(.col-lg-6):not(.col-lg-auto) {
    flex: 0 0 33.3333%;
    width: 33.3333%;
    max-width: 33.3333%;
}
/* QA 40: every layout picture gets the same box. The rule used to match only the third (.image-box), so it was smaller than the first two. */
body .rw-flyin__body .rw-resume-builder-page .rw-resume-template .template-img-container {
    flex: 1 1 0;
    min-width: 0;
    height: auto;
    aspect-ratio: 2 / 3;
}

/* 4. Rows of buttons, tabs and filters wrap rather than run off the edge. */
body .rw-flyin__body .d-flex:not(.flex-nowrap):not(.flex-column),
body .rw-flyin__body .nav-tabs,
body .rw-flyin__body .nav-pills,
body .rw-flyin__body [role="tablist"],
body .rw-flyin__body .btn-group:not(.btn-group-vertical),
body .rw-flyin__body .rw-volunteering__pagination .rw-volunteering__page-buttons,
body .rw-flyin__body .pt-interview-summary {
    flex-wrap: wrap;
}

body .rw-flyin__body .rw-volunteering__pagination {
    flex-wrap: wrap;
}

body .rw-flyin__body .rw-volunteering__pagination .rw-volunteering__page-buttons {
    width: 100%;
    margin-left: 0;
    justify-content: center;
}

/* 5. Card grids drop to two columns (one when the panel is the whole screen). */
body .rw-flyin__body .rw-volunteering__grid,
body .rw-flyin__body .rw-learning-page__grid,
body .rw-flyin__body .pt-command-action-grid,
body .rw-flyin__body .pt-dashboard-metric-grid,
body .rw-flyin__body .pt-dashboard-alert-grid,
body .rw-flyin__body .pt-dashboard-future-grid,
body .rw-flyin__body .rw-volunteering__advanced-grid,
body .rw-flyin__body .rw-dashboard__grid,
body .rw-flyin__body .nwa-help-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

body .rw-flyin__body .pt-command-work-grid,
body .rw-flyin__body .pt-interview-coach-page,
body .rw-flyin__body .rw-volunteer-hub__workspace {
    grid-template-columns: minmax(0, 1fr);
}

/* 6. Tables. Headers stay on one line so a column is never narrower than its name, and any table
      rw-flyin.js wrapped in .rw-flyin__table-scroll scrolls sideways inside the panel instead of
      stretching the whole panel. */
body .rw-flyin__body th {
    white-space: nowrap;
}

body .rw-flyin__body .rw-flyin__table-scroll {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

body .rw-flyin__body .rw-flyin__table-scroll > table {
    width: 100%;
    min-width: 44rem;
    margin-bottom: 0;
}

/* A page's own .table-responsive keeps scrolling inside the panel even where a shell stylesheet
   relaxed it to overflow: visible for the full-width layout. */
body .rw-flyin__body .table-responsive {
    overflow-x: auto !important;
    max-width: 100%;
}

/* 7. Nothing inside the panel may be wider than the panel. */
body .rw-flyin__body img,
body .rw-flyin__body svg,
body .rw-flyin__body video,
body .rw-flyin__body iframe {
    max-width: 100%;
}

body .rw-flyin__body .row {
    margin-left: 0;
    margin-right: 0;
}

body .rw-flyin__body .row > * {
    min-width: 0;
}

body .rw-flyin__body form,
body .rw-flyin__body fieldset,
body .rw-flyin__body .form-control,
body .rw-flyin__body .form-select,
body .rw-flyin__body .input-group {
    max-width: 100%;
}

/* The panel body itself never scrolls sideways; anything that still overflows is clipped at the
   edge rather than giving the whole panel a horizontal scrollbar. */
body .rw-flyin__body {
    overflow-x: hidden;
}

@media (max-width: 48rem) {
    .rw-flyin { width: 100%; }
    .rw-flyin__body { padding: .75rem; }
    .rw-flyin__title { font-size: var(--rw-text-body); }

    body .rw-flyin__body .rw-volunteering__grid,
    body .rw-flyin__body .rw-learning-page__grid,
    body .rw-flyin__body .pt-command-action-grid,
    body .rw-flyin__body .pt-dashboard-metric-grid,
    body .rw-flyin__body .pt-dashboard-alert-grid,
    body .rw-flyin__body .pt-dashboard-future-grid,
    body .rw-flyin__body .rw-volunteering__advanced-grid,
    body .rw-flyin__body .rw-dashboard__grid,
    body .rw-flyin__body .nwa-help-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    body .rw-flyin__body [class*="col-md-"]:not(.col-md-auto) {
        flex: 0 0 100%;
        width: 100%;
        max-width: 100%;
    }
}

/* Profile Review step inside the panel: the page is laid out for the full window, so at a wide screen
   its xl columns squeeze Back / Save & Finish / Generate Resume into a narrow slice and the split
   button's caret wraps onto a second blue bar. Stack the three actions and keep the split button on one line. */
body .rw-flyin__body .row:has(#btnSaveAndFinish) > [class*="col-xl-4"] {
    flex: 0 0 100%;
    width: 100%;
    max-width: 100%;
    text-align: start !important;
}

body .rw-flyin__body #btnSaveAndFinish {
    width: 100% !important;
}

body .rw-flyin__body .download-resume-mobile > .d-flex {
    gap: .5rem;
    /* QA 56: the row wrapped, so the info icon sat on a line of its own above the Generate Resume bar. */
    flex-wrap: nowrap;
}

body .rw-flyin__body .download-resume-mobile .tooltip-btn {
    width: auto !important;
}

body .rw-flyin__body .download-resume-mobile .btn-group {
    display: flex;
    flex-wrap: nowrap;
    flex: 1 1 0;
    min-width: 0;
    width: auto !important;
}

body .rw-flyin__body .download-resume-mobile #downloadBtn {
    flex: 1 1 auto;
    width: auto !important;
    min-width: 0;
}

body .rw-flyin__body .download-resume-mobile #dropdownToggle {
    flex: 0 0 auto;
}

/* QA 56: the AI icon buttons are 44px circles on the full page; inside the panel they lost their height and drew as ovals. */
body .rw-flyin__body .ai-button {
    min-width: 44px;
    min-height: 44px;
}

/* QA 41/49: skill rows carry both col-xxl-* and col-md-*. Rule 3 stacks the xxl class, so each skill took 400px in the panel (190px on the full page) and a longer list meant a lot of scrolling. Keep the full page layout (name + level, then last used + years used) once there is room for it. */
@media (min-width: 768px) {
    body .rw-flyin__body .skill-item .row > .col-md-8.col-xxl-5 {
        flex: 0 0 66.6667%;
        width: 66.6667%;
        max-width: 66.6667%;
    }

    body .rw-flyin__body .skill-item .row > .col-md-4.col-xxl-2 {
        flex: 0 0 33.3333%;
        width: 33.3333%;
        max-width: 33.3333%;
    }
}

/* QA 33: on a desktop-width window the panel is about 950px wide, wide enough for the same footer the full page has: Back on the
   left, Save & Finish with the Generate Resume row under it on the right. Below that width the actions stay stacked. */
@media (min-width: 1200px) {
    body .rw-flyin__body .row:has(> [class*="col-xl-4"] #btnSaveAndFinish) {
        flex-wrap: nowrap;
        align-items: flex-start;
        justify-content: space-between;
    }

    body .rw-flyin__body .row:has(> [class*="col-xl-4"] #btnSaveAndFinish) > [class*="col-xl-4"]:first-child {
        flex: 0 0 33.3333%;
        width: 33.3333%;
        max-width: 33.3333%;
    }

    /* The empty spacer column the full page uses between the two groups (a utility class forces it to block). */
    body .rw-flyin__body .row:has(> [class*="col-xl-4"] #btnSaveAndFinish) > [class*="col-xl-4"]:nth-child(2) {
        display: none !important;
    }

    body .rw-flyin__body .row:has(> [class*="col-xl-4"] #btnSaveAndFinish) > [class*="col-xl-4"].text-end {
        flex: 1 1 0;
        width: auto;
        min-width: 0;
        max-width: none;
        display: flex;
        flex-direction: column;
        align-items: flex-end;
    }

    body .rw-flyin__body .row:has(> [class*="col-xl-4"] #btnSaveAndFinish) > [class*="col-xl-4"].text-end > * {
        width: 360px;
        max-width: 100%;
    }
}

@media (min-width: 1200px) {
    body .rw-flyin__body .row:has(> [class*="col-xl-4"] #btnSaveAndFinish) #btnSaveAndFinish {
        width: 360px !important;
        max-width: 100%;
    }
}

/* QA 40: at phone width three pictures side by side were 45px wide (the third 15px). Stack the layouts so each is readable. */
@media (max-width: 767.98px) {
    body .rw-flyin__body .rw-resume-builder-page__templates > [class*="col-lg-"]:not(.col-lg-6):not(.col-lg-auto) {
        flex: 0 0 100%;
        width: 100%;
        max-width: 100%;
    }
}

/* Jobs keeps its full-page script lifecycle inside the existing panel. */
body .rw-flyin__body--search { display: flex; flex-direction: column; min-height: 0; padding: 0; overflow: hidden; }
.rw-flyin__body--search .rw-flyin__message { flex: 0 0 auto; padding: 1rem; }
.rw-flyin__search-frame { display: block; flex: 1 1 0; width: 100%; height: 100%; min-width: 0; min-height: 0; border: 0; }
