.game-filters-wrapper {
    position: absolute;
    width: 100%;
    top: 61%;
    z-index: 99;
    left: 50%;
    transform: translateX(-50%);
}

@media (max-width: 991px) {
    .game-filters-wrapper {
        position: static;
        left: auto;
        transform: none;
    }
}

.filters-container {
    padding: 16px 40px;
    background: white;
    box-shadow: 0px 4px 50px 0px #0000001F;
    border-radius: 16px;
}

.filters-grid {
    display: flex;
    gap: 16px;
    align-items: stretch;
}

.filter-item {
    flex: 1;
    min-width: 0;
}

.filter-select {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #fff;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 45px;
}

.filter-select:hover {
    border-color: rgba(255, 255, 255, 0.4);
}

.filter-select:focus {
    border-color: var(--primary, #ffc700);
    outline: none;
}

.filter-select option {
    background-color: #1a1a1a;
    color: #fff;
    padding: 0.5rem;
}

.filter-actions {
    display: flex;
    gap: 8px;
    height: 100%;
}

.apply-filters {
    background-color: var(--primary) !important;
    border: none !important;
    color: #000;
    font-weight: 600;
    padding: 0.75rem 2rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-height: 45px;
    flex: 1;
}

.apply-filters:hover {
    background-color: #ffdb4d;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 199, 0, 0.3);
}

.apply-filters:active {
    transform: translateY(0);
}

.reset-filters {
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    background-color: transparent;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    min-height: 45px;
}

.reset-filters:hover {
    border-color: var(--primary, #ffc700);
    color: var(--primary, #ffc700);
    background-color: rgba(255, 199, 0, 0.1);
}

.games-loading-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    background: rgba(0, 0, 0, 0.8);
    padding: 2rem;
    border-radius: 8px;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
}

.project-archive-content .row {
    transition: opacity 0.3s ease;
}

.mobile-filter-trigger {
    display: none;
}

.mobile-filter-overlay {
    display: none;
}

.mobile-filter-panel {
    display: none;
}

@media (max-width: 991px) {
    .desktop-filters {
        display: none !important;
    }

    .mobile-filter-trigger {
        border-radius: 85px !important;
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        bottom: 20px;
        right: 20px;
        left: 20px;
        background-color: white;
        color: #000;
        border: none;
        padding: 16px 24px;
        font-size: 16px;
        box-shadow: 0px 4px 50px 0px #00000040;
        z-index: 998;
        cursor: pointer;
        transition: all 0.3s ease;
    }

    .mobile-filter-trigger span {
        display: flex;
        gap: 10px;
        align-items: center;
    }

    .mobile-filter-trigger:active {
        transform: scale(0.95);
    }

    .mobile-filter-trigger.hidden {
        opacity: 0;
        pointer-events: none;
        transform: translateY(20px);
    }

    .mobile-filter-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.7);
        z-index: 999;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .mobile-filter-overlay.active {
        display: block;
        opacity: 1;
    }

    .mobile-filter-panel {
        display: flex;
        flex-direction: column;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-radius: 20px 20px 0 0;
        max-height: 80vh;
        z-index: 1000;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
    }

    .mobile-filter-panel.active {
        transform: translateY(0);
    }

    .mobile-filter-close {
        position: absolute;
        width: 32px;
        height: 32px;
        font-size: 20px;
        top: -12%;
        left: 50%;
        color: black;
        transform: translateX(-50%);
        padding: 10px;
        background: white;
        border-radius: 100% !important;
        display: none;
    }

    .mobile-filter-panel.active .mobile-filter-close {
        display: flex;
    }

    .mobile-filter-content {
        flex: 1;
        overflow-y: auto;
        padding: 20px;
    }

    .mobile-filter-content .filters-grid {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    .mobile-filter-content .filter-item {
        width: 100%;
    }

    .mobile-filter-content .filter-select {
        width: 100%;
        padding: 12px 16px;
        font-size: 1rem;
        border: 2px solid #ddd;
        border-radius: 8px;
        background-color: #fff;
        color: #000;
    }

    .mobile-filter-footer {
        display: flex;
        gap: 12px;
        padding: 20px;
        border-top: 1px solid #eee;
        background: white;
    }

    .mobile-filter-footer .btn {
        flex: 1;
        padding: 14px 24px;
        border-radius: 8px;
        font-weight: 600;
        font-size: 1rem;
        border: none;
        cursor: pointer;
        transition: all 0.3s ease;
    }

    .mobile-filter-footer .apply-filters {
        background-color: var(--primary, #ffc700);
        color: white;
    }

    .mobile-filter-footer .reset-filters {
        background-color: #f5f5f5;
        color: #666;
        border: 2px solid #ddd;
    }

    body.filter-panel-open {
        overflow: hidden;
    }
}

/* Multi-select dropdown: the native <select multiple> stays in the DOM as the
   state holder, the visitor uses the checkbox menu drawn next to it. */
/* display: none rather than a visually-hidden clip: a <select multiple> sizes
   to its options and ignores width, so a clipped one overflows the page. */
.filter-select--enhanced {
    display: none;
}

.filter-dropdown {
    position: relative;
}

.game-filters-wrapper .filter-dropdown__toggle {
    position: relative;
    display: block;
    width: 100%;
    min-height: 45px;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    background-color: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    box-shadow: none;
    color: #fff;
    font-size: 0.95rem;
    font-weight: inherit;
    line-height: 1.4;
    letter-spacing: normal;
    text-align: left;
    text-transform: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.game-filters-wrapper .filter-dropdown__toggle::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 1rem;
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-75%) rotate(45deg);
    transition: transform 0.2s ease;
}

.game-filters-wrapper .filter-dropdown.is-open .filter-dropdown__toggle::after {
    transform: translateY(-25%) rotate(-135deg);
}

.game-filters-wrapper .filter-dropdown__toggle:hover,
.game-filters-wrapper .filter-dropdown__toggle:focus {
    background-color: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
}

.game-filters-wrapper .filter-dropdown__toggle:focus-visible,
.game-filters-wrapper .filter-dropdown.is-open .filter-dropdown__toggle {
    border-color: var(--primary, #ffc700);
    outline: none;
}

.filter-dropdown__menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 100%;
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem 0;
    background-color: #1a1a1a;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.filter-dropdown__menu[hidden] {
    display: none;
}

.filter-dropdown__option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    padding: 0.5rem 1rem;
    color: #fff;
    font-size: 0.95rem;
    white-space: nowrap;
    cursor: pointer;
}

.filter-dropdown__option:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.filter-dropdown__option input {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--primary, #ffc700);
}

/* Inside the mobile panel the menu unfolds in the flow of the scrolling panel. */
.mobile-filter-content .filter-dropdown__toggle,
.mobile-filter-content .filter-dropdown__toggle:hover,
.mobile-filter-content .filter-dropdown__toggle:focus {
    padding: 12px 40px 12px 16px;
    font-size: 1rem;
    background-color: #fff;
    border-color: #ddd;
    border-radius: 8px;
    color: #000;
}

.mobile-filter-content .filter-dropdown__menu {
    position: static;
    max-height: none;
    margin-top: 8px;
    background-color: #fff;
    border: 2px solid #ddd;
    border-radius: 8px;
    box-shadow: none;
}

.mobile-filter-content .filter-dropdown__option {
    color: #000;
    white-space: normal;
}

.mobile-filter-content .filter-dropdown__option:hover {
    background-color: #f5f5f5;
}

.mobile-filter-content .filter-dropdown__toggle:focus-visible,
.mobile-filter-content .filter-dropdown.is-open .filter-dropdown__toggle {
    border-color: var(--primary, #ffc700);
}

.game-filters-wrapper .filter-dropdown__toggle:disabled {
    opacity: 0.5;
    cursor: default;
}
