/* Leave room below sidebar layouts for the floating Cookiebot widget. */
.bn-filter:has(.bn-filterpanel) {
    margin-bottom: 5rem;
}

/* Sidebar filter layout (inc/components/general/filter-panel.php) - same look
   as the Resource Order filter panel. Loaded on the site and in the editor. */
.bn-filter-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}
.bn-filter-trigger svg {
    width: 1.125rem;
    height: 1.125rem;
}
.bn-filter__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.375rem;
    height: 1.375rem;
    padding-inline: 0.375rem;
    border-radius: 1rem;
    background-color: var(--bs-primary, #b83b26);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
}

/* Full-screen takeover by default (mobile/tablet); the >=992px
   override below turns it into a sticky sidebar. */
.bn-filterpanel {
    --bn-admin-bar-offset: 0px;
    position: fixed;
    inset: 0;
    top: var(--bn-admin-bar-offset);
    z-index: 1060;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    visibility: hidden;
    transform: translateX(100%);
    transition: transform 0.3s ease, visibility 0.3s;
}
body.admin-bar .bn-filterpanel {
    --bn-admin-bar-offset: 32px;
}
@media (max-width: 782px) {
    body.admin-bar .bn-filterpanel {
        --bn-admin-bar-offset: 46px;
    }
}
.bn-filterpanel[data-open="true"] {
    visibility: visible;
    transform: translateX(0);
}
.bn-filterpanel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: none;
    padding: 1.125rem 1.25rem;
    border-bottom: 1px solid var(--bs-border-color, #e2e2e2);
}
.bn-filterpanel__title {
    font-size: 1.125rem;
    font-weight: 700;
}
.bn-filterpanel__close {
    padding: 0;
    border: 0;
    background: none;
    font-size: 1.75rem;
    line-height: 1;
    color: var(--bs-body-color, #212529);
    cursor: pointer;
}
.bn-filterpanel__body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 1.25rem;
}
.bn-filterpanel__search {
    position: relative;
    margin-bottom: 1.25rem;
}
.bn-filterpanel__search svg {
    position: absolute;
    top: 50%;
    left: 0.75rem;
    width: 1.125rem;
    height: 1.125rem;
    transform: translateY(-50%);
    color: var(--bs-secondary, #6c757d);
    pointer-events: none;
}
.bn-filterpanel__search-input {
    width: 100%;
    padding: 0.625rem 0.75rem 0.625rem 2.25rem;
    border: 1px solid var(--bs-border-color, #bababa);
    border-radius: 0.5rem;
    font-size: 0.9375rem;
}
.bn-filterpanel__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex: none;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--bs-border-color, #e2e2e2);
}
.bn-filterpanel__apply {
    flex: 1 1 auto;
}

.bn-filter__group {
    border: 1px solid var(--bs-border-color, #e2e2e2);
    border-radius: 0.5rem;
    padding: 1rem 1.125rem;
    margin: 0 0 1rem;
}
.bn-filter__group:last-of-type {
    margin-bottom: 0;
}
.bn-filter__legend {
    margin-bottom: 0.75rem;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--bs-secondary, #6c757d);
}
.bn-filter__option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.3;
    cursor: pointer;
}
.bn-filter__option input {
    width: 1rem;
    height: 1rem;
    flex: none;
    accent-color: var(--bs-primary, #b83b26);
    cursor: pointer;
}
.bn-filter__clear {
    padding: 0;
    border: 0;
    background: none;
    color: var(--bs-primary, #b83b26);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}
.bn-filter__clear:hover {
    color: var(--bs-link-hover-color, #932f1e);
}

@media (min-width: 992px) {
    .bn-filterpanel {
        position: sticky;
        inset: auto;
        top: calc(var(--header-height, 84px) + var(--bn-admin-bar-offset, 0px) + 4rem);
        z-index: 10;
        display: block;
        visibility: visible;
        transform: none;
        transition: none;
    }
    .bn-filterpanel__body {
        overflow-y: auto;
        padding: 0;
        padding-inline-end: 0.75rem;
        max-height: calc(100vh - var(--header-height, 84px) - var(--bn-admin-bar-offset, 0px) - 9.5rem);
    }
    .bn-filterpanel__footer {
        justify-content: flex-start;
        padding: 1rem 0 0;
        border-top: none;
    }
}

.bn-filter-col[hidden],
.bn-filter__empty[hidden] {
    display: none !important;
}
