.yaf-filter {
    --yaf-accent: #971c20;
    --yaf-accent-dark: #7d171b;
    --yaf-border: #e3e6ea;
    --yaf-muted: #667085;
    display: block;
    width: 100%;
}

.yaf-filter-sections {
    display: grid;
    gap: 16px;
}

.yaf-filter-section {
    position: relative;
    padding: 18px;
    border: 1px solid var(--yaf-border);
    border-radius: 14px;
    background: #fff;
    box-sizing: border-box;
}

.yaf-filter-section.is-locked {
    background: #f2f4f7;
    border-color: #d0d5dd;
    color: #667085;
}

.yaf-filter-section.is-scope-locked {
    background: #f7f8fa;
    border-color: #d0d5dd;
}

.yaf-section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.yaf-section-header h3 {
    margin: 0;
    font-size: 18px;
    line-height: 1.4;
}

.yaf-lock-badge {
    display: inline-flex;
    margin-top: 5px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #e4e7ec;
    color: #475467;
    font-size: 11px;
    font-weight: 600;
}

.yaf-clear-button,
.yaf-apply-button {
    appearance: none;
    border: 0;
    cursor: pointer;
    font: inherit;
}

.yaf-clear-button {
    padding: 4px 0;
    background: transparent;
    color: var(--yaf-accent);
    font-size: 13px;
}

.yaf-search-wrap {
    display: block;
    margin-bottom: 12px;
}

.yaf-search {
    width: 100%;
    min-height: 42px;
    padding: 9px 12px;
    border: 1px solid #d0d5dd;
    border-radius: 10px;
    background: #fff;
    color: #101828;
    font: inherit;
    box-sizing: border-box;
}

.yaf-search:focus {
    border-color: var(--yaf-accent);
    outline: 2px solid color-mix(in srgb, var(--yaf-accent) 18%, transparent);
    outline-offset: 0;
}

.yaf-tree-wrap {
    max-height: 390px;
    overflow: auto;
    padding-inline-end: 4px;
}

.yaf-tree-node {
    margin: 4px 0;
}

.yaf-tree-node[hidden] {
    display: none !important;
}

.yaf-tree-node.is-root + .yaf-tree-node.is-root {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #eaecf0;
}

.yaf-parent-label {
    margin-bottom: 6px;
    color: #344054;
    font-weight: 700;
}

.yaf-tree-children {
    margin-inline-start: 15px;
    padding-inline-start: 12px;
    border-inline-start: 1px solid #eaecf0;
}

.yaf-option {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 34px;
    margin: 0;
    padding: 5px 7px;
    border-radius: 8px;
    cursor: pointer;
    line-height: 1.4;
}

.yaf-option:hover {
    background: #f8fafc;
}

.yaf-filter .yaf-option input.yaf-category-checkbox[type="checkbox"] {
    -webkit-appearance: none !important;
    appearance: none !important;
    position: relative;
    flex: 0 0 17px;
    width: 17px !important;
    min-width: 17px;
    height: 17px !important;
    min-height: 17px;
    margin: 0 !important;
    padding: 0 !important;
    border: 1px solid #98a2b3 !important;
    border-radius: 4px !important;
    background: #fff !important;
    box-shadow: none !important;
    cursor: pointer;
    box-sizing: border-box;
    clip-path: none !important;
    transform: none !important;
    opacity: 1 !important;
}

.yaf-filter .yaf-option input.yaf-category-checkbox[type="checkbox"]::before {
    content: none !important;
    display: none !important;
}

.yaf-filter .yaf-option input.yaf-category-checkbox[type="checkbox"]:checked {
    border-color: var(--yaf-accent) !important;
    background: var(--yaf-accent) !important;
}

.yaf-filter .yaf-option input.yaf-category-checkbox[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    top: 1px;
    left: 5px;
    width: 4px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.yaf-filter .yaf-option input.yaf-category-checkbox[type="checkbox"]:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--yaf-accent) 25%, transparent);
    outline-offset: 2px;
}

.yaf-option.is-disabled {
    cursor: not-allowed;
    opacity: .78;
}

.yaf-option.is-disabled:hover {
    background: transparent;
}

.yaf-locked-value {
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid #d0d5dd;
    border-radius: 10px;
    background: #eaecf0;
}

.yaf-locked-value p,
.yaf-locked-path {
    display: block;
}

.yaf-locked-value p {
    margin-top: 4px;
    color: #667085;
    font-size: 12px;
}

.yaf-locked-value p {
    margin-bottom: 0;
}

.yaf-locked-path {
    margin-bottom: 8px;
    font-size: 12px;
}

.yaf-apply-button {
    width: 100%;
    margin-top: 14px;
    padding: 11px 16px;
    border-radius: 10px;
    background: var(--yaf-accent);
    color: #fff;
    font-weight: 700;
}

.yaf-filter-status {
    min-height: 20px;
    margin-top: 8px;
    color: var(--yaf-muted);
    font-size: 12px;
}

.yaf-filter-status.is-error {
    color: #b42318;
}

.yaf-filter.is-loading {
    pointer-events: none;
    opacity: .72;
}

.yaf-results-loading {
    position: relative;
    opacity: .45;
    transition: opacity .18s ease;
}

.yaf-managed-results-inner > .woocommerce-result-count,
.yaf-result-count {
    float: none;
    margin: 0 0 16px;
}

.yaf-pagination .page-numbers button.page-numbers {
    cursor: pointer;
    font: inherit;
}

.yaf-no-products {
    width: 100%;
}

.yaf-empty-config {
    margin: 0;
    color: var(--yaf-muted);
    font-size: 13px;
}

@media (max-width: 767px) {
    .yaf-filter-section {
        padding: 14px;
    }

    .yaf-tree-wrap {
        max-height: 310px;
    }
}

/* Selected filter summary */
.yaf-selected-wrap {
    display: none;
    margin: -2px 0 14px;
}

.yaf-selected-wrap.has-selections {
    display: block;
}

.yaf-selected-title {
    display: block;
    margin-bottom: 7px;
    color: #475467;
    font-size: 12px;
    font-weight: 700;
}

.yaf-selected-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.yaf-selected-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 100%;
    min-height: 32px;
    padding: 6px 10px;
    border: 1px solid color-mix(in srgb, var(--yaf-accent) 32%, #d0d5dd);
    border-radius: 999px;
    background: color-mix(in srgb, var(--yaf-accent) 8%, #fff);
    color: #344054;
    font: inherit;
    font-size: 12px;
    line-height: 1.4;
    text-align: start;
    box-sizing: border-box;
}

button.yaf-selected-chip {
    appearance: none;
    cursor: pointer;
}

button.yaf-selected-chip:hover,
button.yaf-selected-chip:focus-visible {
    border-color: var(--yaf-accent);
    background: color-mix(in srgb, var(--yaf-accent) 14%, #fff);
    outline: none;
}

.yaf-selected-chip > span:first-child {
    overflow-wrap: anywhere;
}

.yaf-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(16, 24, 40, .08);
    color: #344054;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
}

.yaf-selected-chip.is-fixed {
    border-color: #cbd0d8;
    background: #e4e7ec;
    color: #475467;
}

.yaf-chip-lock {
    color: #98a2b3;
    font-size: 8px;
}

.yaf-locked-note {
    margin: 0;
    color: #667085;
    font-size: 12px;
}


/* Compact permanent archive context (no disabled filter panel). */
.yaf-context-summary {
    margin: 0 0 10px;
    color: #475467;
    font-size: 13px;
    line-height: 1.6;
}

.yaf-context-summary strong {
    color: #101828;
}

/* Compact removable filters shared by both category types. */
.yaf-active-filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    width: fit-content;
    max-width: 100%;
    margin: 0 0 12px;
    padding: 7px 9px;
    border: 1px solid var(--yaf-border);
    border-radius: 9px;
    background: #fff;
    box-sizing: border-box;
}

.yaf-active-filters[hidden] {
    display: none !important;
}

.yaf-active-filter-title {
    flex: 0 0 auto;
    color: #344054;
    font-size: 12px;
    line-height: 1.4;
}

.yaf-active-filters .yaf-selected-chips {
    gap: 5px;
}

.yaf-active-filters .yaf-selected-chip {
    min-height: 26px;
    padding: 3px 7px;
    font-size: 11px;
}

.yaf-active-filters .yaf-chip-remove {
    width: 16px;
    height: 16px;
    font-size: 14px;
}

.yaf-filter-section.is-scope-restricted {
    background: #fff;
    border-color: var(--yaf-border);
}

@media (max-width: 767px) {
    .yaf-active-filters {
        width: 100%;
    }
}

/* Mobile off-canvas filter trigger / panel */
.yaf-mobile-trigger,
.yaf-mobile-backdrop,
.yaf-mobile-panel-header,
.yaf-mobile-panel-footer {
    display: none;
}

@media (max-width: 767px) {
    body.yaf-mobile-filter-open {
        overflow: hidden !important;
        touch-action: none;
    }

    .yaf-mobile-trigger {
        --yaf-accent: #971c20;
        --yaf-accent-dark: #7d171b;
        position: fixed;
        right: 14px;
        bottom: max(14px, env(safe-area-inset-bottom));
        left: 14px;
        z-index: 2147482000;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 9px;
        width: auto;
        max-width: 430px;
        min-height: 54px;
        margin-inline: auto;
        padding: 11px 18px;
        overflow: hidden;
        isolation: isolate;
        border: 1px solid rgba(92, 10, 16, .44);
        border-radius: 16px;
        background:
            linear-gradient(135deg, #6f1117 0%, #971c20 48%, #b6282f 100%) !important;
        background-size: 160% 160% !important;
        background-position: 50% 50% !important;
        background-clip: padding-box !important;
        box-shadow: none !important;
        filter: none !important;
        -webkit-filter: none !important;
        outline: none !important;
        text-shadow: none !important;
        color: #fff !important;
        font-family: "Modam", "modam", sans-serif !important;
        font-size: 14px;
        font-weight: 800;
        line-height: 1;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        transition: transform .22s cubic-bezier(.2,.75,.25,1), background-position .28s ease, opacity .18s ease, visibility .18s ease;
        will-change: transform, opacity;
    }

    .yaf-mobile-trigger::before,
    .yaf-mobile-trigger::after {
        content: none !important;
        display: none !important;
        box-shadow: none !important;
        filter: none !important;
        -webkit-filter: none !important;
        background: none !important;
        border: 0 !important;
    }

    .yaf-mobile-trigger > span {
        font-family: "Modam", "modam", sans-serif !important;
    }

    .yaf-mobile-trigger:hover,
    .yaf-mobile-trigger:focus,
    .yaf-mobile-trigger:focus-visible {
        border-color: rgba(92, 10, 16, .58) !important;
        background:
            linear-gradient(135deg, #651016 0%, #8d181d 44%, #ad242b 100%) !important;
        background-size: 160% 160% !important;
        background-position: 72% 38% !important;
        color: #fff !important;
        outline: none !important;
        box-shadow: none !important;
        filter: none !important;
        -webkit-filter: none !important;
        text-shadow: none !important;
    }

    .yaf-mobile-trigger:active {
        background:
            linear-gradient(135deg, #5d0d13 0%, #7d171b 52%, #971c20 100%) !important;
        color: #fff !important;
        transform: translateY(1px) scale(.99);
        box-shadow: none !important;
        filter: none !important;
        -webkit-filter: none !important;
        text-shadow: none !important;
    }

    .yaf-mobile-trigger.is-panel-open {
        pointer-events: none;
        opacity: 0;
        visibility: hidden;
        transform: translateY(16px);
    }

    .yaf-mobile-trigger.is-footer-hidden {
        pointer-events: none;
        opacity: 0;
        visibility: hidden;
        transform: translateY(calc(100% + 30px));
    }

    .yaf-mobile-trigger-icon,
    .yaf-mobile-panel-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
    }

    .yaf-mobile-trigger-icon {
        width: 34px;
        height: 34px;
        border-radius: 11px;
        background: rgba(255, 255, 255, .11);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, .10);
    }

    .yaf-mobile-trigger-icon svg,
    .yaf-mobile-panel-icon svg {
        width: 22px;
        height: 22px;
    }

    .yaf-mobile-trigger-icon svg path,
    .yaf-mobile-trigger-icon svg circle,
    .yaf-mobile-panel-icon svg path,
    .yaf-mobile-panel-icon svg circle {
        stroke: currentColor;
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .yaf-mobile-badge {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 22px;
        height: 22px;
        padding: 0 6px;
        border-radius: 999px;
        background: rgba(255, 255, 255, .98);
        color: #7d171b;
        box-shadow: 0 2px 7px rgba(59, 8, 12, .14);
        font-size: 11px;
        font-weight: 900;
        line-height: 1;
        box-sizing: border-box;
    }

    .yaf-mobile-badge[hidden] {
        display: none !important;
    }

    .yaf-mobile-backdrop {
        position: fixed;
        inset: 0;
        z-index: 2147482900;
        display: block;
        background: rgba(15, 23, 42, .48);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        -webkit-backdrop-filter: blur(2px);
        backdrop-filter: blur(2px);
        transition: opacity .22s ease, visibility .22s ease;
    }

    .yaf-mobile-backdrop.is-active {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .yaf-filter {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 2147483000;
        display: flex;
        flex-direction: column;
        width: min(92vw, 430px);
        max-width: 100%;
        height: 100vh;
        height: 100dvh;
        padding: 0;
        background: #fff;
        box-shadow: -18px 0 48px rgba(16, 24, 40, .18);
        overflow: hidden;
        opacity: 1;
        transform: translateX(105%);
        visibility: hidden;
        pointer-events: none;
        transition: transform .24s cubic-bezier(.2,.75,.25,1), visibility .24s ease;
    }

    .yaf-filter.is-mobile-open {
        transform: translateX(0);
        visibility: visible;
        pointer-events: auto;
    }

    .yaf-mobile-panel-header {
        display: flex;
        flex: 0 0 auto;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        min-height: 68px;
        padding: 10px 16px;
        padding-top: max(10px, env(safe-area-inset-top));
        border-bottom: 1px solid #eaecf0;
        background: #fff;
        box-sizing: border-box;
    }

    .yaf-mobile-panel-header,
    .yaf-mobile-panel-content,
    .yaf-mobile-panel-footer {
        font-family: "Modam", "modam", sans-serif !important;
    }

    .yaf-mobile-panel-heading {
        display: flex;
        align-items: center;
        gap: 10px;
        min-width: 0;
        color: #101828;
    }

    .yaf-mobile-panel-heading strong {
        font-size: 16px;
        font-weight: 800;
        line-height: 1.4;
    }

    .yaf-mobile-panel-icon {
        width: 38px;
        height: 38px;
        border-radius: 12px;
        background: color-mix(in srgb, var(--yaf-accent) 10%, #fff);
        color: var(--yaf-accent);
    }

    .yaf-mobile-close {
        appearance: none;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 38px;
        width: 38px;
        height: 38px;
        margin: 0;
        padding: 0 0 3px;
        border: 1px solid #e4e7ec;
        border-radius: 12px;
        background: #f8fafc;
        color: #344054;
        font-family: "Modam", "modam", sans-serif !important;
        font-size: 27px;
        font-weight: 400;
        line-height: 1;
        cursor: pointer;
        box-shadow: none;
    }

    .yaf-mobile-close:hover,
    .yaf-mobile-close:focus,
    .yaf-mobile-close:active {
        border-color: #d0d5dd;
        background: #f2f4f7;
        color: #101828;
        outline: none;
    }

    .yaf-mobile-panel-content {
        flex: 1 1 auto;
        min-height: 0;
        padding: 16px;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .yaf-filter-sections {
        gap: 12px;
    }

    .yaf-filter-section {
        padding: 14px;
        border-radius: 14px;
    }

    .yaf-tree-wrap {
        max-height: none;
        overflow: visible;
        padding-inline-end: 0;
    }

    .yaf-filter-status {
        min-height: 0;
        margin-top: 8px;
    }

    .yaf-mobile-panel-footer {
        display: block;
        flex: 0 0 auto;
        padding: 12px 16px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
        border-top: 1px solid #eaecf0;
        background: rgba(255, 255, 255, .96);
        box-shadow: 0 -8px 24px rgba(16, 24, 40, .06);
    }

    .yaf-mobile-apply {
        appearance: none;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        min-height: 48px;
        margin: 0;
        padding: 10px 16px;
        border: 0;
        border-radius: 13px;
        background: var(--yaf-accent) !important;
        color: #fff !important;
        font-family: "Modam", "modam", sans-serif !important;
        font-size: 14px;
        font-weight: 800;
        line-height: 1.2;
        cursor: pointer;
        box-shadow: none;
    }

    .yaf-mobile-apply:hover,
    .yaf-mobile-apply:focus,
    .yaf-mobile-apply:focus-visible {
        border-color: #971c20 !important;
        background: #971c20 !important;
        color: #fff !important;
        outline: none !important;
    }

    .yaf-mobile-apply:active {
        background: var(--yaf-accent-dark) !important;
        color: #fff !important;
    }

    .yaf-filter.is-loading {
        pointer-events: auto;
        opacity: 1;
    }

    .yaf-filter.is-loading .yaf-mobile-panel-content {
        pointer-events: none;
        opacity: .72;
    }

    .yaf-active-filters {
        width: 100%;
    }
}

/* ChinPars brand hardening: prevent theme button/checkbox hover colors from overriding the filter. */
.yaf-filter {
    accent-color: #971c20;
}

.yaf-filter .yaf-clear-button:hover,
.yaf-filter .yaf-clear-button:focus,
.yaf-filter .yaf-clear-button:focus-visible {
    color: #971c20 !important;
    background: transparent !important;
    outline: none !important;
}

.yaf-filter .yaf-apply-button:hover,
.yaf-filter .yaf-apply-button:focus,
.yaf-filter .yaf-apply-button:focus-visible {
    background: #971c20 !important;
    color: #fff !important;
    outline: none !important;
}

.yaf-filter .yaf-apply-button:active {
    background: #7d171b !important;
}
