/* Scrolling lists, on both interfaces: the way back to the top, the loading
 * spinner, the box at the foot of the screen and the fade on rows that have
 * just arrived. A rule only one interface needs belongs in that interface's
 * own stylesheet instead.
 *
 * Colour comes from the client's scheme, not from this file: --link-color and
 * --link-bg-color are declared in both interfaces' base stylesheets and
 * overridden by the site's theme. The literals are only the fallback for a
 * site whose stylesheet predates them. */

/* Hidden until the script shows it, by setting display on the element: the
 * interfaces do not share a .hidden class. The resting colour is stated for
 * :link and :visited as well, because the site stylesheets colour
 * a:link and a:visited, which outscores a bare class. */
.infinite-scroll-top {
    display: none;
    position: fixed;
    top: 62px;
    left: 10px;
    z-index: 100;
    box-sizing: border-box;
    width: 48px;
    height: 48px;
    padding: 0;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--link-color, #5cb85c);
    border-radius: 6px;
    background-color: var(--link-color, #5cb85c);
    color: #fff;
}
.infinite-scroll-arrow {
    display: block;
    width: 26px;
    height: 26px;
    fill: #fff;
}
.infinite-scroll-top:link,
.infinite-scroll-top:visited {
    color: #fff;
}
.infinite-scroll-top:hover,
.infinite-scroll-top:focus {
    border-color: var(--link-color-hover, #449d44);
    background-color: var(--link-color-hover, #449d44);
    color: #fff;
    text-decoration: none;
}
/* The strip below a list that can still grow. The spinner and Load more
 * take turns in the same place, each hidden without giving up its room, so
 * the strip is the height of the taller and the spinner is already on screen
 * when the reader reaches it. The sentinel at its foot needs a height of its
 * own: the browser watches for it coming into view, and cannot see a box with
 * no height. */
.infinite-scroll-more {
    display: grid;
    justify-items: center;
    align-items: start;
    padding: 12px 0;
    text-align: center;
}
.infinite-scroll-retry,
.infinite-scroll-spinner {
    grid-area: 1 / 1;
}
.infinite-scroll-retry {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.infinite-scroll-retry .lms-note {
    width: max-content;
    max-width: 100%;
    margin: 0;
}
.infinite-scroll-spinner,
.infinite-scroll-loading .infinite-scroll-retry {
    visibility: hidden;
}
.infinite-scroll-loading .infinite-scroll-spinner {
    visibility: visible;
}
/* The arrow is a font icon, drawn smaller than the letters beside it at the
 * same size, so it takes a larger size to match them. */
.infinite-scroll-load .mdi {
    margin-right: 4px;
    font-size: 1.3em;
    vertical-align: -0.1em;
}
/* The spinner's usual space above it would only make the strip taller. */
.infinite-scroll-spinner .spinner-container {
    margin-top: 0;
}
.infinite-scroll-sentinel {
    grid-area: 2 / 1;
    justify-self: stretch;
    height: 1px;
}

/* The box at the foot of the screen holds the page tools while the footer is
 * out of sight, and the list's actions on its ticked rows. A screen with
 * actions has its own .infinite-scroll-actions bar, which becomes the box, so
 * its controls stay in the form they post with; otherwise the script makes a
 * .lms-float-bar. It is solid, so the rows scrolling behind it do not show
 * through, and fixed rather than sticky, because the content area on the
 * admin interface scrolls sideways and a sticky child would pin inside it.
 *
 * It reads as a piece of the footer: infinite_scroll.js copies the footer's
 * background, a darker edge, its text colour and its links' colour into the
 * --lms-float-* variables. The literals are only the fallback for a footer
 * with no background colour. A site whose footer makes a poor bar declares
 * --lms-float-bg on the bar in its own stylesheet, with any of the others it
 * needs, and the script then leaves all of them to the stylesheet.
 *
 * The action bar is visible from the start, so a page whose script never runs
 * still has working buttons; .lms-float-bar is shown by the script. */
.lms-float-bar,
.infinite-scroll-actions {
    position: fixed;
    left: 10px;
    bottom: 8px;
    z-index: 90;
    box-sizing: border-box;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 4px 8px;
    text-align: left;
    color: var(--lms-float-text, inherit);
    background-color: var(--lms-float-bg, #fff);
    border: 1px solid var(--lms-float-edge, #ddd);
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}
/* On a wide screen the box is roomier, so it still catches the eye. */
@media (min-width: 1920px) {
    .lms-float-bar,
    .infinite-scroll-actions {
        padding: 8px 18px;
    }
}
.lms-float-bar {
    display: none;
}
.infinite-scroll-actions {
    display: flex;
}
.infinite-scroll-actions > .lms-page-tools {
    padding-right: 8px;
    border-right: 1px solid var(--lms-float-edge, #ddd);
}
/* A dropdown is held to its own width, or it takes a line of the box to
 * itself. */
.infinite-scroll-actions .form-control {
    width: auto;
}
/* A child that only holds dialogs takes no room in the row. */
.infinite-scroll-actions-aside {
    position: absolute;
}
/* A dialog the bar opens is drawn inside it, and a fixed box is a layer of
 * its own that nothing inside can rise above, so while one is open the box
 * itself goes above the page's dimming. */
.infinite-scroll-actions-dialog {
    z-index: 1050;
}
/* A list with nothing to tick puts its actions away, leaving the page tools. */
.infinite-scroll-no-picks > :not(.lms-page-tools) {
    display: none !important;
}
.infinite-scroll-no-picks > .lms-page-tools {
    padding-right: 0;
    border-right: 0;
}

/* The buttons are bigger here than in the footer, which has a fixed height,
 * to give the pointer a larger target. The hover is a tint of the icon's own
 * colour, which shows on a light footer and a dark one alike. */
.lms-float-bar .lms-page-tools,
.infinite-scroll-actions .lms-page-tools {
    gap: 6px;
}
.lms-float-bar .lms-page-tools .lms-page-tool,
.infinite-scroll-actions .lms-page-tools .lms-page-tool {
    width: 32px;
    height: 32px;
}
.lms-float-bar .lms-page-tool,
.lms-float-bar .lms-page-tool:link,
.lms-float-bar .lms-page-tool:visited,
.infinite-scroll-actions .lms-page-tool,
.infinite-scroll-actions .lms-page-tool:link,
.infinite-scroll-actions .lms-page-tool:visited,
.infinite-scroll-actions-close {
    color: var(--lms-float-fg, var(--link-color, #5cb85c));
}
.lms-float-bar .lms-page-tool:hover,
.lms-float-bar .lms-page-tool:focus,
.infinite-scroll-actions .lms-page-tool:hover,
.infinite-scroll-actions .lms-page-tool:focus,
.infinite-scroll-actions-close:hover,
.infinite-scroll-actions-close:focus {
    background-color: rgba(0, 0, 0, 0.08);
    background-color: color-mix(in srgb, currentColor 15%, transparent);
}

/* An action waiting for a ticked row is dimmed but stays focusable, so it can
 * say why it is waiting. */
.infinite-scroll-action-off,
.infinite-scroll-action-off:hover,
.infinite-scroll-action-off:focus {
    opacity: 0.5;
    cursor: not-allowed;
}
/* The count of ticked rows is a pill filled with the icons' colour, so it
 * stands apart from the buttons. The script picks the lettering that reads
 * on it: white, or the bar's own colour where the footer is dark. */
.infinite-scroll-actions-count {
    display: none;
    margin-left: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    background-color: var(--lms-float-fg, var(--link-color, #5cb85c));
    color: var(--lms-float-on-fg, #fff);
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}
/* Centred on its line, the text can sit high in the pill, by up to a few
 * pixels at the small sizes on the admin interface, where the browser rounds
 * the font's measurements. Where the browser can trim the text's box to the
 * height of a capital, the pill centres the letters themselves instead, and
 * the padding keeps it the same height. */
@supports (text-box: trim-both cap alphabetic) {
    .infinite-scroll-actions-count {
        padding-top: calc(0.25em + 3px);
        padding-bottom: calc(0.25em + 3px);
        text-box: trim-both cap alphabetic;
    }
}
/* Read out by a screen reader, never shown. */
.infinite-scroll-actions-why {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}
.infinite-scroll-actions-close {
    display: none;
    flex: none;
    padding: 0;
    width: 28px;
    height: 28px;
    line-height: 1;
    border: 0;
    border-radius: 4px;
    background: none;
    cursor: pointer;
}
.infinite-scroll-actions-close svg {
    display: block;
    margin: 0 auto;
    width: 16px;
    height: 16px;
}
/* The cue that the actions have come alive. */
.infinite-scroll-actions-armed {
    animation: infinite-scroll-armed 0.8s ease-out 1;
}
@keyframes infinite-scroll-armed {
    from { box-shadow: 0 0 0 0 var(--link-color, #5cb85c), 0 2px 6px rgba(0, 0, 0, 0.18); }
    to { box-shadow: 0 0 0 10px rgba(0, 0, 0, 0), 0 2px 6px rgba(0, 0, 0, 0.18); }
}
/* Keeps room under the list for the box to come to rest in at the end of it. */
.lms-float-spacer {
    clear: both;
}

/* The fade marks the rows that just arrived, so the reader can see where the
 * list they were reading ends. It starts at 30% of the strength of the
 * site's link background, which across a whole batch of rows is plenty; a
 * site whose colour is too pale for that sets --lms-new-rows-strength. It
 * goes on the cells rather than the row: a row's background is painted under
 * its cells, and the cells of a striped or hovered table have one of their
 * own. */
.infinite-scroll-new > td {
    animation: infinite-scroll-new-fade 10s ease-out 1;
}
@keyframes infinite-scroll-new-fade {
    from { background-color: color-mix(in srgb, var(--link-bg-color, #dff0d8) var(--lms-new-rows-strength, 30%), transparent); }
    to { background-color: transparent; }
}
@media (prefers-reduced-motion: reduce) {
    .infinite-scroll-new > td,
    .infinite-scroll-actions-armed {
        animation: none;
    }
}
@media print {
    .infinite-scroll-top,
    .infinite-scroll-more,
    .infinite-scroll-end,
    .lms-float-bar,
    .lms-float-spacer,
    .infinite-scroll-actions {
        display: none !important;
    }
}
