/* =============================================================================
   FILTERS - MHB Theme
   ============================================================================= */

/* =============================================================================
   FILTER WRAPPER
   ============================================================================= */

.mhb-filter {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.45rem;
    flex-wrap: wrap;
    z-index: 2;
    position: relative;
    padding: 0;
}

/* Centered filter */
.mhb-filter--centered {
    justify-content: center;
}

/* =============================================================================
   FILTER BUTTON
   ============================================================================= */

.mhb-filter__btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 10px 20px 7px;
    font-family: var(--mhb-font-display);
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: background var(--mhb-transition-base),
        border-color var(--mhb-transition-base),
        color var(--mhb-transition-base);
    border-radius: var(--mhb-radius-sm);
}

.mhb-filter__btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.mhb-filter__btn.is-active {
    background: var(--mhb-secondary);
    border-color: var(--mhb-secondary);
    color: #fff;
}

.mhb-filter__btn.is-loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Light theme filter */
.mhb-filter--light .mhb-filter__btn {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
    color: var(--mhb-text-dark);
}

.mhb-filter--light .mhb-filter__btn:hover {
    background: rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.2);
}

.mhb-filter--light .mhb-filter__btn.is-active {
    background: var(--mhb-secondary);
    border-color: var(--mhb-secondary);
    color: #fff;
}

/* =============================================================================
   FILTER RESET
   ============================================================================= */

.mhb-filter__reset {
    background: none;
    border: none;
    color: var(--mhb-text-gray);
    padding: 10px;
    cursor: pointer;
    transition: color var(--mhb-transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mhb-filter__reset:hover {
    color: var(--mhb-accent);
}

.mhb-filter__reset .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* =============================================================================
   SLIDER FILTER (specific)
   ============================================================================= */

.mhb-slider-filter {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 0 var(--mhb-section-padding-x) 20px;
    padding: 0;
}

.mhb-slider-filter .mhb-filter__btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 10px 20px;
    border-radius: 4px;
}

.mhb-slider-filter .mhb-filter__btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.mhb-slider-filter .mhb-filter__btn.is-active {
    background: var(--mhb-secondary);
    border-color: var(--mhb-secondary);
}

/* =============================================================================
   RESPONSIVE
   ============================================================================= */

@media (max-width: 1024px) {
    .mhb-slider-filter {
        margin: 0 10px 15px;
    }
}

@media (max-width: 1024px) {
    .mhb-filter {
        margin-bottom: 1rem;
    }
}

@media (max-width: 768px) {
    .mhb-filter {
        gap: 0.5rem;
        margin-bottom: 1rem;
    }

    .mhb-filter__btn {
        padding: 8px 14px;
        font-size: 12px;
    }
}

@media (max-width: 576px) {
    .mhb-slider-filter {
        gap: 8px;
        margin: 0 10px 10px;
    }

    .mhb-slider-filter .mhb-filter__btn {
        padding: 8px 14px;
        font-size: 12px;
    }
}

/* =============================================================================
   LOADER
   ============================================================================= */

.mhb-loader {
    display: none;
    position: static;
    inset: auto;
    z-index: auto;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 40px 20px;
    width: 100%;
    background: transparent;
    transform: none;
    pointer-events: none;
}

.mhb-listing > .mhb-loader {
    position: static;
    inset: auto;
    z-index: auto;
    width: 100%;
    background: transparent;
    transform: none;
    pointer-events: none;
}

body.is-loaded .mhb-listing > .mhb-loader {
    opacity: 1;
    transform: none;
    transition: none;
}

.mhb-listing:has(.mhb-no-results) > .mhb-loader {
    display: none !important;
    opacity: 0 !important;
}

.mhb-loader__spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--mhb-accent, #E95323);
    border-radius: 50%;
    animation: mhbSpin 0.8s linear infinite;
}

.mhb-loader__text {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 1px;
}

@keyframes mhbSpin {
    to {
        transform: rotate(360deg);
    }
}

/* End message */
.mhb-listing__end {
    display: none;
    text-align: center;
    padding: 30px 20px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    width: 100%;
}

/* Error message */
.mhb-error {
    text-align: center;
    padding: 20px;
    color: #e53935;
    background: rgba(229, 57, 53, 0.1);
    border-radius: 8px;
    margin: 20px 0;
}

/* =============================================================================
   LISTING GRID
   ============================================================================= */

.mhb-listing__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    transition: opacity 0.3s ease;
}

.mhb-listing__staff {
    clear: both;
    width: 100%;
    margin-top: 80px;
}

.mhb-listing__staff .mhb-listing__grid {
    margin-top: 24px;
}

.mhb-listing__grid--carousel {
    display: flex;
    gap: 24px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 10px;
}

.mhb-listing__grid--carousel::-webkit-scrollbar {
    display: none;
}

.mhb-listing__grid--carousel>* {
    scroll-snap-align: start;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .mhb-listing__grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 480px) {
    .mhb-listing__grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* =============================================================================
   GENERIC FILTERS (mhb-filters)
   Utilisation : matchs, news, partenaires, etc.
   ============================================================================= */

.mhb-filters {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 40px;
}

.mhb-filters__row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

/* Flèches masquées en desktop, affichées uniquement en responsive */
.mhb-filters__arrow {
    display: none;
}

/* =============================================================================
   FILTER BUTTONS (.filter-btn)
   Variantes de couleur : --blue, --orange, --white
   ============================================================================= */

.filter-btn {
    font-weight: 500;
    letter-spacing: 1px;
    color: #fff;
    background: var(--mhb-primary, #1a365d);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
    position: relative;
    border: none;
    box-shadow: none;
    padding: 12px 20px 9px;
    font-family: var(--mhb-font-display, 'Formula Condensed', Arial, sans-serif);
    font-size: 16px;
    line-height: 17px;
    text-transform: none;
}

.filter-btn:hover {
    opacity: 0.85;
}

/* État actif par défaut (bleu) */
.filter-btn.is-active {
    background: var(--mhb-secondary, #00A3E0);
}

/* Variante bleu (explicite) */
.filter-btn--blue.is-active {
    background: var(--mhb-secondary, #00A3E0);
}

/* Variante orange */
.filter-btn--orange.is-active {
    background: var(--mhb-accent, #E95323);
}

/* Variante blanc (fond clair) */
.filter-btn--white {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.filter-btn--white:hover {
    background: rgba(255, 255, 255, 0.25);
}

.filter-btn--white.is-active {
    background: #fff;
    color: var(--mhb-primary, #1a365d);
}

/* État désactivé pendant le chargement */
.filter-btn.is-loading {
    opacity: 0.5;
    pointer-events: none;
}

/* =============================================================================
   FILTERS - RESPONSIVE
   ============================================================================= */

@media (max-width: 1024px) {
    .mhb-filters {
        gap: 12px;
        margin-bottom: 25px;
    }

    .filter-btn {
        padding: 10px 16px 7px;
        font-size: 14px;
    }
}

@media (max-width: 768px) {
    .mhb-filters {
        gap: 10px;
    }

    .filter-btn {
        padding: 8px 12px 6px;
        font-size: 13px;
        border-radius: 8px;
    }

    /* Wrapper scroll carousel pour les filtres */
    .mhb-filters__row-wrapper {
        position: relative;
        overflow: hidden;
    }

    /* Row devient scrollable */
    .mhb-filters__row {
        display: flex;
        flex-wrap: nowrap;
        justify-content: flex-start;
        gap: 8px;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding: 0 5px;
    }

    .mhb-filters__row::-webkit-scrollbar {
        display: none;
    }

    .mhb-filters__row .filter-btn {
        flex-shrink: 0;
    }

    /* Flèches de navigation pour les filtres */
    .mhb-filters__arrow {
        position: absolute;
        top: 0;
        bottom: 0;
        width: 40px;
        display: none;
        align-items: center;
        padding: 0;
        border: none;
        cursor: pointer;
        z-index: 3;
        transition: opacity 0.2s ease;
    }

    .mhb-filters__arrow:hover {
        opacity: 1 !important;
    }

    .mhb-filters__arrow--prev {
        left: 0;
        justify-content: flex-start;
        padding-left: 5px;
        background: linear-gradient(to left, transparent, var(--mhb-bg-dark, #001025) 70%);
    }

    .mhb-filters__arrow--next {
        right: 0;
        justify-content: flex-end;
        padding-right: 5px;
        background: linear-gradient(to right, transparent, var(--mhb-bg-dark, #001025) 70%);
    }

    .mhb-filters__arrow svg {
        width: 16px;
        height: 16px;
        color: rgba(255, 255, 255, 0.8);
    }

    /* Animation de la flèche next */
    .mhb-filters__arrow--next svg {
        animation: filterArrowHintNext 1.5s ease-in-out infinite;
    }

    /* Animation de la flèche prev */
    .mhb-filters__arrow--prev svg {
        animation: filterArrowHintPrev 1.5s ease-in-out infinite;
    }

    @keyframes filterArrowHintNext {

        0%,
        100% {
            transform: translateX(0);
            opacity: 0.7;
        }

        50% {
            transform: translateX(4px);
            opacity: 1;
        }
    }

    @keyframes filterArrowHintPrev {

        0%,
        100% {
            transform: translateX(0);
            opacity: 0.7;
        }

        50% {
            transform: translateX(-4px);
            opacity: 1;
        }
    }

    /* Afficher les flèches selon l'état */
    .mhb-filters__row-wrapper.has-overflow .mhb-filters__arrow--next {
        display: flex;
    }

    .mhb-filters__row-wrapper.has-overflow.is-scrolled .mhb-filters__arrow--prev {
        display: flex;
    }

    .mhb-filters__row-wrapper.has-overflow.scrolled-end .mhb-filters__arrow--next {
        display: none;
    }

    /* Fond clair (si besoin) */
    .mhb-section__content--light .mhb-filters__arrow--prev {
        background: linear-gradient(to left, transparent, #fff 70%);
    }

    .mhb-section__content--light .mhb-filters__arrow--next {
        background: linear-gradient(to right, transparent, #fff 70%);
    }

    .mhb-section__content--light .mhb-filters__arrow svg {
        color: var(--mhb-primary, #1a365d);
    }
}
