/* /css/filter-page-v2.css
   Overrides sobre filter-page.css para la pagina de filtro de slots:
   buscador, modal de filtros fullscreen en mobile e indicador de filtros.
*/

/* ===== SEARCH BAR - BASE (desktop + mobile) ===== */
.game-search-wrapper {
    width: 100%;
}
.game-search-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.04);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border: 0;
    border-bottom: 1px solid #e60881;
    border-radius: 0;
    transition: border-color .2s ease, background .2s ease;
}
.game-search-input {
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
    padding: 10px 4px 10px 10px;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    line-height: 1.3;
}
.game-search-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}
.game-search-input::-ms-clear,
.game-search-input::-webkit-search-cancel-button {
    display: none;
}
.game-search-clear,
.game-search-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
    transition: color .15s ease, opacity .15s ease;
}
.game-search-clear {
    display: none;
    width: 26px;
    height: 26px;
    color: rgba(255, 255, 255, 0.45);
}
.game-search-clear:hover {
    color: #fff;
}
.game-search-container.has-value .game-search-clear {
    display: inline-flex;
}
.game-search-button {
    width: 34px;
    height: 34px;
    margin-right: 4px;
    color: #e60881;
}

.options-selected-filtros {
    display: flex;
    flex-direction: row;
    align-items: center;
}
.options-selected-filtros a::after {
    content: "";
    background-image: url("/img/layout/icons/X.png");
    background-size: 12px auto;
    background-position: center center;
    background-repeat: no-repeat;
    width: 12px;
    height: 12px;
    position: relative;
    margin-left: 7px;
}

.filter-page-section .games-lobby figure.jackpot_active figcaption.figcaption-jackpot {
    width: max-content;
    max-width: 94%;
    padding: 1.5px 6px;
    box-sizing: border-box;
}
.filter-page-section .figcaption-jackpot .jackpot-amount {
    font-size: clamp(10px, 3vw, 14px);
    overflow: visible;
}

.filter-page-section #games-lobby,
.filter-page-section .games-recommended-lobby {
    align-content: start;
}

/* ===== SIN RESULTADOS + RECOMENDADOS ===== */
.games-empty-state[hidden],
.games-recommended[hidden] {
    display: none;
}
/* El CSS base reserva 630px al lobby; vacio no debe empujar el mensaje hacia abajo */
.games-lobby.is-empty {
    min-height: 0 !important;
}
.games-empty-state {
    padding: 40px 16px 24px;
    text-align: center;
}
.games-empty-title {
    margin: 0 0 6px;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
}
.games-empty-subtitle {
    margin: 0;
    color: rgba(255, 255, 255, 0.55);
    font-size: 14px;
}
.games-recommended {
    margin-top: 36px;
    text-align: left;
}
.games-recommended-title {
    display: block;
    margin: 0 0 12px;
    padding-left: 10px;
    border-left: 3px solid #e60881;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
}

/* ===== MOBILE-ONLY BAR: oculta en desktop ===== */
.game-search-mobile-only {
    display: none;
}
.icon-filter-mobile {
    display: none;
}
.filter-modal-backdrop {
    display: none;
}

/* ===== MOBILE ===== */
@media (max-width: 1279px) {

    /* Ocultar barra desktop (dentro de filtros) */
    .game-search-wrapper:not(.game-search-mobile-only) {
        display: none;
    }

    /* Barra mobile: fixed justo debajo de top-section del header (46px) */
    .game-search-mobile-only {
        display: flex;
        align-items: center;
        gap: 8px;
        position: fixed;
        top: 46px;
        left: 0;
        right: 0;
        z-index: 201; /* encima del header (z-index 200) */
        padding: 6px 12px;
        background: #1a1a1a;
    }
    .game-search-mobile-only .game-search-container {
        flex: 1;
    }

    /* Una vez montada dentro del header ocupa el hueco entre ambas franjas. */
    #header #mobile-container > .game-search-mobile-only {
        position: static;
        width: 100%;
        box-sizing: border-box;
        z-index: auto;
    }

    /* Icono filtro al lado de la barra */
    .icon-filter-mobile {
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        width: 36px;
        height: 36px;
        cursor: pointer;
    }
    .icon-filter-mobile img {
        width: 22px;
        height: 22px;
        filter: brightness(0) invert(1);
    }

    /* Indicador rosa con el numero de filtros activos */
    .icon-filter-mobile {
        position: relative;
    }
    .icon-filter-mobile::after {
        content: attr(data-count);
        position: absolute;
        top: 1px;
        right: 0;
        min-width: 16px;
        height: 16px;
        padding: 0 4px;
        box-sizing: border-box;
        border-radius: 999px;
        background: #e60881;
        color: #fff;
        font-size: 10px;
        font-weight: 700;
        line-height: 16px;
        text-align: center;
        box-shadow: 0 0 0 2px #1a1a1a;
        transform: scale(0);
        transition: transform .2s ease;
        pointer-events: none;
    }
    .icon-filter-mobile.has-filters::after {
        transform: scale(1);
    }
    .icon-filter-mobile.badge-pop::before {
        content: "";
        position: absolute;
        top: 1px;
        right: 0;
        width: 16px;
        height: 16px;
        border-radius: 50%;
        background: #e60881;
        opacity: 0;
        animation: filter-badge-pulse 1.2s ease-out 2 forwards;
        pointer-events: none;
    }
    @keyframes filter-badge-pulse {
        0%   { transform: scale(1);   opacity: .7; }
        100% { transform: scale(2.6); opacity: 0; }
    }

    /* La barra de busqueda se monta (JS) debajo de la nav PROMOS/SLOTS/CATEGORIAS */
    #header .bottom-section {
        margin-top: 0;
    }

    /* Ocultar filter-space original (icono + pills) */
    .filter-space {
        display: none !important;
    }

    /* Bloquea la pagina mientras el bottom-sheet esta abierto.
       El clic se consume aqui y el JS se limita a cerrar los filtros. */
    .filter-modal-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 300;
        background: rgba(0, 0, 0, 0.3);
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s ease;
    }
    .filter-modal-backdrop.is-visible {
        opacity: 1;
        pointer-events: auto;
    }

    /* Input mas grande en mobile (evita zoom iOS) */
    .game-search-input {
        font-size: 16px;
        padding: 11px 4px 11px 10px;
    }

    /* Ajustar padding del body para compensar barras fijas
       header top-section(46) + search bar(~46) + bottom-section(48) = ~140 */
    section .body-home {
        padding-top: 70px;
    }

    /* El slider (modulo 2616) es solo desktop: en mobile no se pinta (grupo 2)
       y en ventanas desktop estrechas se oculta. */
    section.filter-page-section > .slideshow-container {
        display: none;
    }

    /* 3 columnas reales en mobile: anulamos los 146x230px fijos del CSS base. */
    .games-lobby {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        justify-content: stretch;
        gap: 8px;
        width: 100%;
        padding: 0 8px;
        box-sizing: border-box;
    }
    .games-lobby figure {
        width: 100% !important;
        min-width: 0;
        margin: 0;
        overflow: hidden;
    }
    .games-lobby figure .game-link,
    .games-lobby figure .game-image-container {
        width: 100%;
        min-width: 0;
    }
    .games-lobby figure .game-image-container {
        overflow: hidden;
    }
    .games-lobby figure .game-image-container .game-image {
        display: block;
        width: 100% !important;
        max-width: 100%;
        height: auto !important;
        min-height: 0 !important;
        object-fit: contain;
    }
    .games-lobby figure .game-figcaption,
    .games-lobby figure .game-title {
        width: 100%;
        min-width: 0;
    }
    .games-lobby figure span {
        font-size: clamp(12px, 3.4vw, 14px);
    }
    .games-lobby figure .game-provider {
        width: calc(100% - 52px) !important;
        font-size: clamp(11px, 3vw, 13px);
    }
    .games-lobby figure .game-favourites-link img,
    .games-lobby figure .game-info-link img {
        width: 18px;
        height: 18px;
    }

    .filter-buttons {
        justify-content: flex-start;
        inset: 0;
        width: 100%;
        height: 100vh;
        height: 100dvh;
        max-height: none;
        box-sizing: border-box;
        border-radius: 0;
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        background: rgba(24, 24, 24, 0.94);
        overflow: hidden;
        bottom: 0 !important;
        transform: translate3d(0, 100%, 0);
        visibility: hidden;
        pointer-events: none;
        will-change: transform;
        backface-visibility: hidden;
        contain: layout paint;
        transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1),
                    visibility 0s linear 320ms;
    }
    .filter-buttons.filter-hidden {
        bottom: 0 !important;
        transform: translate3d(0, 100%, 0);
    }
    .filter-buttons:not(.filter-hidden) {
        bottom: 0 !important;
        transform: translate3d(0, 0, 0);
        visibility: visible;
        pointer-events: auto;
        transition: transform 380ms cubic-bezier(0.22, 1, 0.36, 1),
                    visibility 0s;
        z-index: 301;
    }
    .filter-buttons:not(.filter-hidden) .apply-filters-mobile-container {
        position: relative;
        z-index: 2;
        background: rgba(24, 24, 24, 0.98);
        flex-shrink: 0;
        width: 90% !important;
        min-height: 64px;
        padding: 10px 0;
        box-sizing: border-box;
    }
    .filter-modal-clear {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        height: 38px;
        flex-shrink: 0;
        padding: 0 14px;
        border: 1px solid rgba(255, 255, 255, 0.35);
        border-radius: 5px;
        background: transparent;
        color: #fff;
        font-family: inherit;
        font-size: 14px;
        letter-spacing: .5px;
        cursor: pointer;
        transition: border-color .15s ease, color .15s ease;
    }
    .filter-modal-clear:active:not(:disabled) {
        border-color: var(--main-color, #e60881);
        color: var(--main-color, #e60881);
    }
    .filter-modal-clear:disabled {
        border-color: rgba(255, 255, 255, 0.12);
        color: rgba(255, 255, 255, 0.3);
        cursor: default;
    }

    /* Numero de juegos por filtro: visible pero discreto */
    .filter-buttons .selector-container .selector-inputs-container .filter-button {
        justify-content: space-between;
        gap: 6px;
        min-width: 0;
        padding-right: 8px;
        box-sizing: border-box;
    }
    .filter-buttons .selector-container .selector-inputs-container .filter-button .input-name-container {
        min-width: 0;
    }
    .filter-buttons .selector-container .selector-inputs-container .filter-button .filter-name {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .filter-buttons .selector-container .selector-inputs-container .filter-button .games-amount {
        display: inline;
        flex-shrink: 0;
        font-size: 11px;
        color: rgba(255, 255, 255, 0.35);
    }
    .filter-modal-clear:focus-visible {
        outline: 2px solid var(--main-color, #e60881);
        outline-offset: 2px;
    }
    .filter-buttons .filter-content {
        flex: 1 1 auto;
        min-height: 0;
        max-height: none;
        overscroll-behavior: contain;
        overflow-y: auto;
        scrollbar-width: thin;
        scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
        -webkit-overflow-scrolling: touch;
        padding-bottom: calc(25px + env(safe-area-inset-bottom));
    }
    .filter-buttons .filter-content::-webkit-scrollbar {
        width: 4px;
    }
    .filter-buttons .filter-content::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.35);
        border-radius: 4px;
    }
}

@media (max-width: 1279px) and (orientation: landscape) {
    .games-lobby {
        grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    }
    .games-lobby figure span {
        font-size: clamp(11px, 1.6vw, 14px);
    }
    .games-lobby figure .game-provider {
        font-size: clamp(10px, 1.4vw, 13px);
    }
    .filter-buttons:not(.filter-hidden) .apply-filters-mobile-container {
        width: 94% !important;
        min-height: 52px;
        padding: 5px 0;
    }
    .filter-buttons .filter-content {
        width: 94%;
        gap: 14px;
        padding-bottom: calc(14px + env(safe-area-inset-bottom));
    }
    .filter-modal-clear {
        height: 34px;
    }
}

/* slider.css (modulo 2616 de sliders) trae ".active { background-color: #fff }" global,
   que pintaba de blanco las secciones de filtros abiertas. */
.filter-buttons .selector-container.active {
    background-color: transparent;
}