/* =========================
    PAPERS FILTERS — SIDEBAR
========================= */
.papers-filters {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.papers-filters__summary {
    font-size: 14px;
    line-height: 1.4;
}

.papers-filters__summary strong {
    font-weight: 700;
}

.papers-filters__empty {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.papers-filters__active {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.papers-filters__chip {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 8px;
    border: 1px solid #d7d7d7;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1.2;
}

.papers-filters__active .papers-filters__reset {
    width: auto;
    margin-left: 2px;
}

/* SEARCH + YEAR */
.papers-filters__search,
.papers-filters__year,
.papers-filters__group {
    width: 100%;
}

.papers-filters input[type="search"],
.papers-filters select {
    width: 100%;
    min-height: 44px;
    padding: 0 13px;
    background: #fff;
    border: 1px solid #d7d7d7;
    border-radius: 4px;
    font: inherit;
}

.papers-filters input[type="search"]:focus,
.papers-filters select:focus {
    outline: none;
    border-color: #8f8f8f;
}

/* HEADINGS */
.papers-filters__label {
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}

/* CATEGORY / SUBCATEGORY LISTS */
.papers-filters__categories,
.papers-filters__subcategories {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* OPTION */
.papers-filter-option {
    position: relative;
    display: flex;
    width: 100%;
    cursor: pointer;
    user-select: none;
}

.papers-filter-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.papers-filter-option span {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 36px;
    padding: 7px 10px 7px 32px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.3;
    transition:
        background-color .15s ease,
        color .15s ease;
}

/* custom checkbox/radio */
.papers-filter-option span::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 50%;
    width: 14px;
    height: 14px;
    transform: translateY(-50%);
    border: 1px solid #b8b8b8;
    background: #fff;
}

/* category = radio */
.papers-filters__categories .papers-filter-option span::before {
    border-radius: 50%;
}

/* subcategory = checkbox */
.papers-filters__subcategories .papers-filter-option span::before {
    border-radius: 2px;
}

.papers-filter-option:hover span {
    background: rgba(0, 0, 0, .035);
}

/* selected background */
.papers-filter-option input:checked+span {
    background: rgba(0, 0, 0, .055);
    font-weight: 600;
}

/* selected radio */
.papers-filters__categories .papers-filter-option input:checked+span::after {
    content: "";
    position: absolute;
    left: 12px;
    top: 50%;
    width: 6px;
    height: 6px;
    transform: translateY(-50%);
    border-radius: 50%;
    background: currentColor;
}

/* selected checkbox */
.papers-filters__subcategories .papers-filter-option input:checked+span::after {
    content: "✓";
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-52%);
    font-size: 11px;
    font-weight: 700;
}

/* BUTTON */
.papers-filters__button-wrap {
    width: 100% !important;
}

.papers-filters__button-wrap .elementor-button {
    width: 100%;
    min-height: 44px;
    justify-content: center;
    border: 0;
    border-radius: 0;
}

/* RESET */
.papers-filters__reset {
    display: block;
    width: 100%;
    text-align: center;
    font-size: 13px;
    text-decoration: underline;
    text-underline-offset: 3px;
    opacity: .7;
}

.papers-filters__reset:hover {
    opacity: 1;
}

.papers-search-hit {
    background: #fff1a8;
    color: inherit;
    padding: 0 .06em;
    border-radius: 2px;
}


.papers-filters__body {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.papers-filters .papers-filters__toggle,
.papers-filters-floating {
    display: none !important;
}

.papers-filter-option input:focus-visible+span {
    outline: 2px solid #555;
    outline-offset: 2px;
}

.papers-filters-dialog:not([open]) {
    display: none !important;
}

.papers-filters-dialog {
    box-sizing: border-box;
    position: fixed;
    inset: auto 0 0;
    margin: 0 auto;
    width: 100%;
    max-width: 768px;
    max-height: 85vh;
    max-height: 85dvh;
    padding: 0 20px calc(20px + env(safe-area-inset-bottom));
    border: 0;
    border-radius: 16px 16px 0 0;
    background: #fff;
    color: #222;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.papers-filters-dialog::backdrop {
    background: rgba(0, 0, 0, .45);
}

.papers-filters-dialog__header {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    background: #fff;
}

.papers-filters-dialog__close {
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #222;
    font-size: 28px;
    cursor: pointer;
}

@media (max-width: 767px) {
    .papers-filters.is-enhanced .papers-filters__toggle {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        min-height: 44px;
        padding: 12px 16px;
        border: 1px solid #d7d7d7;
        border-radius: 4px;
        background: #fff;
        color: inherit;
        font: inherit;
        cursor: pointer;
    }

    .papers-filters.is-enhanced .papers-filters__body {
        display: none;
    }

    .papers-filters.is-in-dialog .papers-filters__body {
        display: flex;
    }

    .papers-filters.is-in-dialog .papers-filters__toggle {
        display: none !important;
    }

    .papers-filters-floating:not([hidden]) {
        display: block !important;
        position: fixed;
        right: 20px;
        bottom: calc(20px + env(safe-area-inset-bottom));
        z-index: 99999;
        min-height: 48px;
        padding: 12px 22px;
        border: 0;
        border-radius: 999px;
        background: #222;
        color: #fff;
        font: inherit;
        box-shadow: 0 4px 18px rgba(0, 0, 0, .22);
        cursor: pointer;
    }

    .papers-filters-dialog .papers-filters__button-wrap {
        position: sticky;
        bottom: calc(-20px - env(safe-area-inset-bottom));
        padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
        background: #fff;
        z-index: 1;
    }
}