/* Search results (simple and advanced search): the filter panel and the result cards.

   One surface rule for the whole page (the toolbar in SearchResultsToolbar.razor.css follows it
   too): a panel takes the theme's grey card fill (--rz-card-flat-background-color: a light wash in
   light themes, a raised grey in dark ones), the theme's card border and corner radius, and no
   shadow; shadows are kept for things that float (the selection bar, menus). Fields on a panel keep
   the page colour, so they still read as fields. Every colour below is a theme token, or a blend of
   the theme's text colour where Radzen's grey scale is not symmetric between light and dark (dark
   --rz-base-200 is a bright grey), so Insignia, the stock Radzen themes and all their dark and WCAG
   variants follow without per-theme rules.

   Scoped by the wrapper classes the components add (.results-filters, .results-list), so the
   shared site.css filter classes keep their look everywhere else (digital, kiosk, dashboards).
   The advanced search builder (.as-shell: the query rows and the filter cards above the results)
   reads the same tokens, so the two halves of that page share one surface.
   Loaded after site.css; !important only where site.css itself uses it. */

.results-filters,
.results-list,
.as-shell {
    --results-line: var(--rz-card-border, var(--rz-border-base-300));
    --results-radius: var(--rz-card-border-radius, var(--dp-radius-lg));
    --results-surface: var(--rz-card-flat-background-color);
    /* The page colour, painted the way the page is: the layout colour over the body colour (some
       themes leave the layout colour transparent). A background image, so use it with background. */
    --results-field: linear-gradient(var(--rz-layout-body-background-color), var(--rz-layout-body-background-color)), var(--rz-body-background-color);
    --results-hover: color-mix(in srgb, var(--rz-text-color) 6%, transparent);
    /* Boundary of an input or neutral button: needs to read as a control, so stronger than a line. */
    --results-control-line: color-mix(in srgb, var(--rz-text-color) 32%, transparent);
    --results-ink: var(--primary-ink, var(--rz-primary));
}

/* ---------- Filter panel ---------- */

.results-filters .filter-container,
.results-filters .custom-accordion {
    background: var(--results-surface);
    border: var(--results-line);
    border-radius: var(--results-radius);
    box-shadow: none;
}

.results-filters .filter-container {
    margin-bottom: var(--dp-space-3);
}

/* Wide screens: "Filter By" and its sections are one panel. The header loses its bottom edge and
   the sections' top edge becomes the divider between them. (Below 1024px the sections open in
   the slide-over, so the two stay separate cards.) */
@media (min-width: 1024px) {
    .results-filters .filter-container {
        margin-bottom: 0;
        border-bottom: 0;
        border-end-start-radius: 0;
        border-end-end-radius: 0;
    }

    .results-filters .custom-accordion {
        border-start-start-radius: 0;
        border-start-end-radius: 0;
    }
}

.results-filters .filters-header {
    padding: var(--dp-space-3) var(--dp-space-4) 0;
    border-bottom: 0;
}

    .results-filters .filters-header .filter-title {
        margin: 0;
        font-size: var(--dp-font-size-lg);
        line-height: 1.4;
        font-weight: 600;
        color: var(--rz-text-color);
    }

.results-filters .filters-status {
    padding: var(--dp-space-1) var(--dp-space-4) var(--dp-space-3);
    background: transparent;
}

.results-filters .no-filter-text {
    font-size: var(--dp-font-size-sm);
    color: var(--rz-text-secondary-color);
}

.results-filters .accordion-item {
    border-bottom: var(--results-line);
}

    .results-filters .accordion-item:last-child {
        border-bottom: 0;
    }

/* Section headers: plain text, a muted icon and a chevron. No accent fill, so the panel
   no longer competes with the results for attention. Medium weight, like the sidebar menu, the
   tabs and the buttons beside them; bold is kept for headings ("Filter By", result titles). */
.results-filters .accordion-header {
    min-height: 2.75rem;
    padding: 0 var(--dp-space-4);
    background: transparent;
    color: var(--rz-text-color);
    font-size: var(--dp-font-size-md);
    font-weight: 500;
    transition: background-color 0.15s ease;
}

    .results-filters .accordion-header:hover,
    .results-filters .accordion-header.expanded:hover {
        background: var(--results-hover);
        color: var(--rz-text-color) !important;
        transform: none;
    }

    .results-filters .accordion-header:focus,
    .results-filters .accordion-header.focused {
        background: transparent;
        color: var(--rz-text-color) !important;
        outline: none;
        box-shadow: none;
    }

    .results-filters .accordion-header:focus-visible {
        background: var(--results-hover);
        outline: 2px solid var(--results-ink);
        outline-offset: -2px;
    }

    .results-filters .accordion-header.expanded {
        background: transparent;
        color: var(--rz-text-color) !important;
    }

        .results-filters .accordion-header i.rzi,
        .results-filters .accordion-header:hover i.rzi,
        .results-filters .accordion-header:focus i.rzi,
        .results-filters .accordion-header.focused i.rzi,
        .results-filters .accordion-header.expanded i.rzi {
            color: var(--rz-text-secondary-color) !important;
        }

    .results-filters .accordion-header i.rzi:first-child {
        font-size: 1.125rem;
    }

    /* The glyph already switches between up and down; site.css also turned it over, so an open
       section showed a down arrow. */
    .results-filters .accordion-header.expanded .toggle-icon {
        transform: none;
    }

.results-filters .accordion-content {
    padding: 0 var(--dp-space-2) var(--dp-space-3);
    background: transparent;
    border-top: 0;
}

/* The list sits straight in the section: no second box inside the panel. */
.results-filters .filter-items-container {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.results-filters .filter-item {
    gap: 0;
    min-height: 2rem;
    padding: 0 var(--dp-space-2) !important;
    border-radius: var(--dp-radius-md) !important;
}

    .results-filters .filter-item:hover {
        background: var(--results-hover) !important;
        transform: none;
    }

    .results-filters .filter-item:focus-visible {
        outline: 2px solid var(--results-ink);
        outline-offset: -2px;
        background: var(--results-hover);
    }

/* Format, Collection Type, Language, Library and Rate use the browser's own checkbox, which ignores
   the theme (in dark mode the browser draws a white box). Drawn here from the tokens Radzen's own
   checkbox uses, so these rows match the RadzenCheckBox rows (Subject, Author, ...) in every theme:
   the same box and check, and the same 24px footprint radzen-overrides.css gives those (an 18px box
   inset by 3px), so the labels line up too. */
.results-filters .filter-item > input[type="checkbox"],
.results-filters .rating-item > input[type="checkbox"] {
    appearance: none;
    display: inline-grid;
    place-content: center;
    flex: none;
    box-sizing: border-box;
    width: var(--rz-checkbox-width, 1.125rem) !important;
    height: var(--rz-checkbox-height, 1.125rem) !important;
    margin: 0 calc(0.1875rem + var(--dp-space-2)) 0 0.1875rem !important;
    border: var(--rz-input-border-block-end);
    border-width: var(--rz-checkbox-border-width, 2px);
    border-radius: var(--rz-checkbox-border-radius, 2px);
    background-color: var(--rz-input-background-color);
    box-shadow: var(--rz-input-shadow);
    transform: none;
    transition: var(--rz-transition-all);
}

    .results-filters .filter-item > input[type="checkbox"]::before,
    .results-filters .rating-item > input[type="checkbox"]::before {
        content: "";
        width: 0.625rem;
        height: 0.625rem;
        background: var(--rz-checkbox-checked-color, var(--rz-on-primary));
        clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0, 43% 62%);
        transform: scale(0);
        transition: transform 0.1s ease-in-out;
    }

    .results-filters .filter-item > input[type="checkbox"]:checked,
    .results-filters .rating-item > input[type="checkbox"]:checked {
        background-color: var(--rz-checkbox-checked-background-color, var(--rz-primary));
        border: var(--rz-checkbox-checked-border, var(--rz-border-primary));
    }

        .results-filters .filter-item > input[type="checkbox"]:checked::before,
        .results-filters .rating-item > input[type="checkbox"]:checked::before {
            transform: scale(1);
        }

    .results-filters .filter-item > input[type="checkbox"]:focus-visible {
        outline: 2px solid var(--results-ink);
        outline-offset: 2px;
    }

/* Touch screens keep the roomier finger target site.css gives them. */
@media (pointer: coarse) {
    .results-filters .filter-item {
        min-height: 2.5rem;
    }
}

.results-filters .filter-item-label {
    min-width: 0;
    font-size: var(--dp-font-size-sm);
    color: var(--rz-text-color);
    overflow-wrap: anywhere;
}

/* Counts in their own right-aligned column, so labels line up and numbers are easy to compare. */
.results-filters .filter-item-count {
    flex: none;
    margin-inline-start: auto;
    padding-inline-start: var(--dp-space-2);
    font-size: var(--dp-font-size-12);
    color: var(--tertiary-ink, var(--rz-text-secondary-color));
    font-variant-numeric: tabular-nums;
}

.results-filters .filter-search-box {
    height: 2.25rem;
    padding: 0 var(--dp-space-3);
    border: 1px solid var(--results-control-line);
    border-radius: var(--dp-radius-md);
    background: var(--results-field);
    color: var(--rz-text-color);
    font-size: var(--dp-font-size-md);
}

    .results-filters .filter-search-box:focus {
        border-color: var(--results-ink);
        box-shadow: 0 0 0 3px var(--rz-primary-lighter);
        outline: none;
    }

.results-filters .more-button-container {
    padding: var(--dp-space-1) 0 0;
    margin-top: 0;
    border-top: 0;
    text-align: start;
}

.results-filters .show-more-btn {
    padding: var(--dp-space-1) var(--dp-space-2);
    border: 0;
    border-radius: var(--dp-radius-sm);
    background: none;
    color: var(--results-ink);
    font-size: var(--dp-font-size-sm);
    font-weight: 600;
    cursor: pointer;
}

    .results-filters .show-more-btn:hover {
        background: var(--results-hover);
        box-shadow: none;
        transform: none;
        text-decoration: underline;
    }

.results-filters .year-range-container {
    border: var(--results-line);
    background: transparent;
}

.results-filters .year-display {
    background: var(--rz-primary-lighter);
    color: var(--rz-text-color);
}

.results-filters .rating-item:hover {
    background: var(--results-hover) !important;
    transform: none;
}

.results-filters .rating-item:focus,
.results-filters .rating-item input[type="checkbox"]:focus {
    outline: 2px solid var(--results-ink) !important;
    box-shadow: none !important;
}

.results-filters .rating-item:has(input[type="checkbox"]:focus) {
    background: var(--results-hover) !important;
}

/* ---------- Result cards ---------- */

/* The page's own .rz-datalist rule gave the list a panel fill behind the cards. */
.results-list .rz-datalist {
    background-color: transparent;
}

.results-list .rz-datalist-data > li {
    margin-bottom: var(--dp-space-3) !important;
}

/* List view: the card is the item. The result components' page-wide <style> blocks pad every list
   item (0.5rem in the catalog, Radzen's 1rem above and below in e-Resources), which pulled the cards
   in from the toolbar's edges and spread them 28-44px apart. Grid tiles keep theirs: it is their gutter. */
.results-list .rz-datalist-data > li:has(.results-card) {
    padding: 0;
}

/* "No cover" is a flat light-grey picture (images/cover/noimage.png) that glares on a dark page. Its
   pixels are moved out of the box so the theme's neutral fill shows instead, the same fill a catalog
   cover has while it loads. */
.results-list img[src$="cover/noimage.png"] {
    object-position: -100vmax 0;
    background-color: color-mix(in srgb, var(--rz-text-color) 8%, transparent);
}

/* Cards are Radzen's outlined variant (theme border); this adds the panel fill, the shared radius,
   keeps any theme shadow off, and gives the clickable card a hover and a keyboard focus state.
   .rz-card in the fill rule outranks the variant's own "background: transparent" even if Radzen
   re-inserts its stylesheet after this one when the theme changes. */
.results-list .rz-card.results-card,
.results-list .rz-card.cardCustomWidth {
    background-color: var(--results-surface);
}

.results-list .results-card,
.results-list .cardCustomWidth {
    border-radius: var(--results-radius);
    box-shadow: none;
    transition: border-color 0.15s ease;
}

    .results-list .results-card:hover,
    .results-list .cardCustomWidth:hover {
        border-color: var(--results-control-line);
    }

    .results-list .results-card:focus-visible,
    .results-list .cardCustomWidth:focus-visible {
        outline: 2px solid var(--results-ink);
        outline-offset: 2px;
    }

/* e-Resources / Online: same title size as the catalog list. */
.results-list .results-card .rz-text-h4 {
    margin: 0;
    font-size: var(--dp-font-size-xl);
    line-height: 1.35;
    font-weight: 600;
}

/* e-Resources / Online: the format and its actions, under one divider instead of a box in the card. */
.results-list .results-format {
    margin-top: var(--dp-space-3);
    padding-top: var(--dp-space-3);
    border-top: var(--results-line);
}

/* Secondary actions (Shelf List, Locate It, Favorite, Text Me) keep the accent label but take a
   neutral outline, so the one filled action (Reserve) is what stands out in each row. */
.results-list .frbr-list-format-actions .rz-button.rz-variant-outlined.rz-shade-default:not(.rz-state-disabled),
.results-list .results-format .rz-button.rz-variant-outlined.rz-shade-default:not(.rz-state-disabled) {
    box-shadow: inset 0 0 0 var(--rz-border-width, 1px) var(--results-control-line);
}

.results-list .frbr-list-format-actions .rz-button.rz-button-sm,
.results-list .results-format .rz-button.rz-button-sm {
    font-size: var(--dp-font-size-sm);
}
