/* BACKDROP OVERLAY */
.filter-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 0;
    pointer-events: none;
    z-index: 89;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.filter-overlay.is-active {
    opacity: 1;
    pointer-events: auto;
}

/* FLOATING BAR CONTAINER */
.floating-filter-bar {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    height: 44px;
    display: inline-flex;
    align-items: center;
    background-color: rgba(30, 30, 32, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    padding: 0 0.5rem;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    z-index: 90;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
    white-space: nowrap;
    overflow: hidden;
    transition: 
        height 0.5s cubic-bezier(0.16, 1, 0.3, 1),
        width 0.5s cubic-bezier(0.16, 1, 0.3, 1),
        border-radius 0.5s cubic-bezier(0.16, 1, 0.3, 1),
        padding 0.5s cubic-bezier(0.16, 1, 0.3, 1),
        background 0.4s ease;
}

.mobile-filter-header {
    display: none;
}

.filter-body {
    display: flex;
    align-items: center;
    width: 100%;
}

.filter-group {
    display: flex;
    align-items: center;
    position: relative;
}

.filter-btn {
    position: relative;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    padding: 0 1rem;
    height: 32px;
    border-radius: 999px;
    cursor: pointer;
    z-index: 2;
    transition: color 0.3s ease, background 0.2s ease, border-color 0.2s ease;
}

.filter-btn:hover,
.filter-btn.is-active {
    color: #ffffff;
}

.filter-divider {
    width: 1px;
    height: 18px;
    background-color: rgba(255, 255, 255, 0.15);
    margin: 0 0.25rem;
    position: relative;
    z-index: 2;
}

.filter-pill-indicator {
    position: absolute;
    top: 50%;
    left: 0;
    height: 32px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    z-index: 1;
    pointer-events: none;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform, width;
}



/* MOBILE EXPANDING SYSTEM */
@media (max-width: 850px) {
    .floating-filter-bar {
        width: calc(100vw - 10rem);
        max-width: 380px;
        bottom: 1rem;
        flex-direction: column;
        align-items: stretch;
        padding: 0 1rem;
        box-sizing: border-box;
    }

    .mobile-filter-header {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.75rem;
        position: relative;
        height: 44px;
        min-height: 44px;
        width: 100%;
    }

    .header-pill-indicator {
        position: absolute;
        top: 6px;
        bottom: 6px;
        left: 0;
        background: rgba(255, 255, 255, 0.12);
        border-radius: 999px;
        z-index: 1;
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        pointer-events: none;
        opacity: 0;
    }

    .floating-filter-bar.is-open .header-pill-indicator {
        opacity: 1;
    }

    .mobile-toggle-btn {
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        cursor: pointer;
        height: 100%;
        margin: 0;
        padding: 0 0.75rem;
        position: relative;
        z-index: 2;
        transition: opacity 0.3s ease;
    }

    .mobile-toggle-btn:not(.is-active) {
        opacity: 0.5;
    }

    .toggle-title {
        color: #ffffff;
        font-size: 0.75rem;
        font-weight: 700;
        letter-spacing: 0.12em;
        text-transform: uppercase;
        line-height: 1;
        display: inline-block;
        transform: translateY(-2px);
    }

    .desktop-only-divider {
        display: none;
    }

    .mobile-filter-header .filter-divider {
        height: 14px;
        width: 1px;
        background-color: rgba(255, 255, 255, 0.18);
        margin: 0;
        align-self: center;
        flex-shrink: 0;
        position: relative;
        z-index: 2;
    }

    .filter-body {
        display: grid;
        grid-template-columns: 1fr;
        padding: 1.25rem 0.25rem 1.25rem 0.25rem;
        opacity: 0;
        pointer-events: none;
        transform: translate3d(0, 10px, 0);
        transition: opacity 0.25s ease 0s, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) 0s;
    }

    .filter-group {
        grid-area: 1 / 1;
        display: flex;
        flex-direction: column;
        gap: 0.45rem;
        width: 100%;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translate3d(0, 5px, 0);
        transition: opacity 0.35s ease, transform 0.35s ease, visibility 0.35s;
    }

    .filter-group.is-visible {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translate3d(0, 0, 0);
    }

    .filter-btn {
        width: 100%;
        height: 36px;
        font-size: 0.72rem;
        padding: 0 1rem;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 999px;
        white-space: nowrap;
    }

    .filter-btn.is-active {
        background: var(--ruby-main);
        border-color: var(--ruby-main);
    }

    .filter-pill-indicator {
        display: none;
    }

    /* EXPANDED STATE */
    .floating-filter-bar.is-open {
        height: 320px;
        border-radius: 28px;
        background-color: rgba(20, 20, 22, 0.98);
    }

    .floating-filter-bar.is-open .filter-body {
        opacity: 1;
        pointer-events: auto;
        transform: translate3d(0, 0, 0);
        transition: opacity 0.4s ease 0.15s, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.15s;
    }
}