/* =============================================================================
   CAROUSEL - MHB Theme
   ============================================================================= */

/* =============================================================================
   CAROUSEL WRAPPER
   ============================================================================= */

.mhb-carousel {
    width: 100%;
    margin: 0;
    padding: 0 var(--mhb-content-padding-x);
    z-index: 2;
    overflow: hidden;
    touch-action: pan-y pinch-zoom;
}

/* Carousel pleine largeur (100% écran) */
/* Compense: bleed-margin + section-padding + content-padding */
.mhb-carousel--full {
    --carousel-offset: calc(var(--mhb-bleed-margin) + var(--mhb-section-padding-x) + var(--mhb-content-padding-x));
    width: calc(100% + var(--carousel-offset) * 2);
    margin-left: calc(var(--carousel-offset) * -1);
    margin-right: calc(var(--carousel-offset) * -1);
    padding: 0 var(--carousel-offset);
}

/* Carousel centré (joueurs/légendes) */
.mhb-carousel--centered {
    --carousel-offset: calc(var(--mhb-bleed-margin) + var(--mhb-section-padding-x) + var(--mhb-content-padding-x));
    margin-left: calc(var(--carousel-offset) * -1);
    margin-right: calc(var(--carousel-offset) * -1);
    width: calc(100% + var(--carousel-offset) * 2);
}

/* =============================================================================
   CAROUSEL TRACK
   ============================================================================= */

.mhb-carousel__track {
    display: flex;
    align-items: stretch;
    gap: 32px;
    transition: margin-left var(--mhb-transition-smooth);
    will-change: auto;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}

/* Track pour cartes matchs - hauteur automatique */
.mhb-carousel__track--matchs {
    transition-property: margin-left;
    will-change: auto;
}

.mhb-carousel__track:active {
    cursor: grabbing;
}

.mhb-carousel__track--dragging {
    transition: none;
}

.mhb-carousel--empty .mhb-carousel__track {
    justify-content: center;
}

/* =============================================================================
   CAROUSEL PAGINATION
   ============================================================================= */

.mhb-carousel__pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px auto 0 auto;
    gap: 18px;
    z-index: 2;
    position: relative;
    max-width: 600px;
}

/* Arrows */
.mhb-carousel__arrow {
    background: none !important;
    color: var(--mhb-accent);
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color var(--mhb-transition-base), transform var(--mhb-transition-smooth), opacity var(--mhb-transition-base);
    opacity: 1;
}

.mhb-carousel__arrow[disabled],
.mhb-carousel__arrow.is-disabled {
    color: #c7d6e6 !important;
    opacity: 0.4;
    cursor: default;
    transform: scale(0.9);
}

.mhb-carousel__arrow:not([disabled]):hover {
    color: var(--mhb-accent);
    transform: scale(1.15);
}

.mhb-carousel__arrow:not([disabled]):active {
    transform: scale(0.95);
}

/* Arrow variants */
.mhb-carousel__arrow--dark {
    color: #000;
}

/* Dots container */
.mhb-carousel__dots {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 18px;
}

/* Dot */
.mhb-carousel__dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: background var(--mhb-transition-smooth), width var(--mhb-transition-smooth), transform var(--mhb-transition-base), box-shadow var(--mhb-transition-base);
}

.mhb-carousel__dot:hover:not(.is-active) {
    transform: scale(1.2);
    box-shadow: var(--mhb-shadow-sm);
}

.mhb-carousel__dot.is-active {
    background: var(--mhb-secondary) !important;
    width: 70px;
    border-radius: 12px;
}

/* Dot variants */
.mhb-carousel__dot--gray {
    background: #B8CBCB;
}

.mhb-carousel__dot--gray.is-active {
    background: #000 !important;
}

/* =============================================================================
   BULLETS STYLES (via classe sur le carousel)
   ============================================================================= */

/* Bleu actif / Blanc (défaut) */
.mhb-carousel--bullets-blue-white .mhb-carousel__dot {
    background: #fff;
}
.mhb-carousel--bullets-blue-white .mhb-carousel__dot.is-active {
    background: var(--mhb-secondary, #007AC1) !important;
}

/* Bleu actif / Gris */
.mhb-carousel--bullets-blue-gray .mhb-carousel__dot {
    background: #B8CBCB;
}
.mhb-carousel--bullets-blue-gray .mhb-carousel__dot.is-active {
    background: var(--mhb-secondary, #007AC1) !important;
}

/* Noir actif / Gris */
.mhb-carousel--bullets-black-gray .mhb-carousel__dot {
    background: #B8CBCB;
}
.mhb-carousel--bullets-black-gray .mhb-carousel__dot.is-active {
    background: #000 !important;
}

/* Noir actif / Blanc */
.mhb-carousel--bullets-black-white .mhb-carousel__dot {
    background: #fff;
}
.mhb-carousel--bullets-black-white .mhb-carousel__dot.is-active {
    background: #000 !important;
}

/* Orange actif / Blanc */
.mhb-carousel--bullets-orange-white .mhb-carousel__dot {
    background: #fff;
}
.mhb-carousel--bullets-orange-white .mhb-carousel__dot.is-active {
    background: var(--mhb-accent, #E95323) !important;
}

/* Orange actif / Gris */
.mhb-carousel--bullets-orange-gray .mhb-carousel__dot {
    background: #B8CBCB;
}
.mhb-carousel--bullets-orange-gray .mhb-carousel__dot.is-active {
    background: var(--mhb-accent, #E95323) !important;
}

/* =============================================================================
   SLIDER PRINCIPAL
   ============================================================================= */

/* Note: .mhb-slider utilise .mhb-bleed pour largeur/marges (voir base.css) */
.mhb-slider {
    position: relative;
    overflow: hidden;
    min-height: 900px;
    background: #0f1419;
    z-index: 1;
}

.mhb-slider__track {
    width: 100%;
    height: 900px;
    position: relative;
}

/* Slide */
.mhb-slider__slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    z-index: 1;
    display: flex;
    align-items: stretch;
    will-change: opacity;
    pointer-events: none;
    transition: opacity 0.9s cubic-bezier(0.77, 0, 0.18, 1);
    overflow: hidden;
}

.mhb-slider__slide.is-active {
    opacity: 1;
    z-index: 2;
    pointer-events: auto;
}

.mhb-slider__slide.is-prev {
    opacity: 0;
    z-index: 1;
    pointer-events: none;
}

/* Background image (Ken Burns effect) */
.mhb-slider__bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transform: scale(1);
    transition: transform 6s cubic-bezier(0.25, 0.1, 0.25, 1);
    z-index: 0;
}

.mhb-slider__slide.is-active .mhb-slider__bg {
    transform: scale(1.06);
}

.mhb-slider__slide.is-prev .mhb-slider__bg {
    transform: scale(1.06);
    transition: none;
}

/* Overlay */
.mhb-slider__overlay {
    background: linear-gradient(90deg, rgba(15, 20, 25, 0.85) 0%, rgba(15, 20, 25, 0.2) 50%);
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    pointer-events: none;
}

/* Content */
.mhb-slider__content {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
    margin-left: 80px;
    max-width: 800px;
    color: #fff;
    pointer-events: none;
}

.mhb-slider__slide.is-active .mhb-slider__content {
    pointer-events: auto;
}

/* Content animation */
.mhb-slider__content>* {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s cubic-bezier(0.77, 0, 0.18, 1), transform 0.6s cubic-bezier(0.77, 0, 0.18, 1);
}

.mhb-slider__slide.is-active .mhb-slider__content>* {
    opacity: 1;
    transform: translateY(0);
}

.mhb-slider__slide.is-active .mhb-slider__category {
    transition-delay: 0.1s;
}

.mhb-slider__slide.is-active .mhb-slider__title {
    transition-delay: 0.2s;
}

.mhb-slider__slide.is-active .mhb-slider__cta {
    transition-delay: 0.35s;
}

/* Category */
.mhb-slider__category {
    font-size: 13px;
    margin-bottom: 15px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* Title */
.mhb-slider__title {
    font-family: var(--mhb-font-display);
    font-size: 86px;
    font-weight: 600;
    letter-spacing: 1px;
    line-height: 1.05;
    margin-bottom: 32px;
    color: var(--mhb-text-white);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    word-break: break-word;
    text-transform: uppercase;
}

/* CTA */
.mhb-slider__cta {
    margin-top: 10px;
    display: flex;
}

/* =============================================================================
   SLIDER PAGINATION (titles)
   ============================================================================= */

.mhb-slider__pagination {
    position: absolute;
    left: 0;
    bottom: 80px;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    z-index: 10;
    background: transparent;
    min-height: 60px;
    padding: 0 80px;
}

.mhb-slider__pagination-btn {
    background: none;
    border: none;
    color: #fff;
    font-family: var(--mhb-font-display);
    font-weight: 500;
    font-size: 20px;
    line-height: 1;
    opacity: 0.7;
    cursor: pointer;
    padding: 15px;
    transition: color var(--mhb-transition-base), opacity var(--mhb-transition-base);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    outline: none;
    height: 68px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    text-align: left;
    word-break: break-word;
    white-space: normal;
    text-transform: uppercase;
    position: relative;
    border-bottom: 2px solid rgba(255, 255, 255, 0.5);
    overflow: hidden;
}

.mhb-slider__pagination-btn::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0%;
    height: 100%;
    background: var(--mhb-accent);
    z-index: 0;
    transition: width 0.4s cubic-bezier(0.77, 0, 0.18, 1);
    opacity: 0.15;
}

/* Progress bar */
.mhb-slider__pagination-btn::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0%;
    height: 3px;
    background: var(--mhb-accent);
    z-index: 1;
    transition: none;
}

.mhb-slider__pagination-btn.is-active::after {
    animation: sliderProgress 5s linear forwards;
}

@keyframes sliderProgress {
    from {
        width: 0%;
    }

    to {
        width: 100%;
    }
}

.mhb-slider__pagination-btn.is-active::before,
.mhb-slider__pagination-btn:hover::before {
    width: 100%;
}

.mhb-slider__pagination-btn.is-active,
.mhb-slider__pagination-btn:hover {
    color: var(--mhb-accent);
    opacity: 1;
    border-bottom-color: var(--mhb-accent);
    background: none;
}

/* Pause on hover */
.mhb-slider:hover .mhb-slider__pagination-btn.is-active::after {
    animation-play-state: paused;
}

.mhb-slider__pagination-btn span {
    position: relative;
    z-index: 1;
}

/* =============================================================================
   SLIDER ARROWS (Flèches navigation)
   ============================================================================= */

.mhb-slider__arrows {
    position: absolute;
    bottom: 20px;
    right: 30px;
    display: flex;
    gap: 10px;
    z-index: 20;
    pointer-events: auto;
}

.mhb-slider__arrow {
    width: 48px;
    height: 48px;
    background: #fff;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    pointer-events: auto;
    position: relative;
    z-index: 21;
}

.mhb-slider__arrow:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
}

.mhb-slider__arrow:active {
    transform: scale(0.95);
}

.mhb-slider__arrow[disabled],
.mhb-slider__arrow.is-disabled {
    opacity: 0.4;
    cursor: default;
    transform: none;
}

.mhb-slider__arrow[disabled]:hover,
.mhb-slider__arrow.is-disabled:hover {
    transform: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.mhb-slider__arrow svg {
    width: 20px;
    height: 20px;
    stroke: var(--mhb-text-dark, #0A2745);
    pointer-events: none;
}

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

@media (max-width: 1200px) {
    /* .mhb-slider width/margin géré par .mhb-bleed */

    .mhb-slider__pagination-btn {
        font-size: 17px;
        height: 60px;
        padding: 12px;
    }

    .mhb-carousel__track {
        gap: 26px;
    }
}

@media (max-width: 1024px) {
    .mhb-carousel {
        padding: 0 var(--mhb-content-padding-x);
    }

    /* Les variables sont déjà mises à jour en responsive, le calcul s'adapte automatiquement */
    .mhb-carousel--full {
        --carousel-offset: calc(var(--mhb-bleed-margin) + var(--mhb-section-padding-x) + var(--mhb-content-padding-x));
        width: calc(100% + var(--carousel-offset) * 2);
        margin-left: calc(var(--carousel-offset) * -1);
        margin-right: calc(var(--carousel-offset) * -1);
        padding: 0 var(--carousel-offset);
        overflow: visible;
    }

    .mhb-carousel--centered {
        --carousel-offset: calc(var(--mhb-bleed-margin) + var(--mhb-section-padding-x) + var(--mhb-content-padding-x));
        margin-left: calc(var(--carousel-offset) * -1);
        margin-right: calc(var(--carousel-offset) * -1);
        width: calc(100% + var(--carousel-offset) * 2);
    }

    .mhb-carousel__track {
        gap: 22px;
    }

    .mhb-carousel__pagination {
        margin-top: 15px;
    }

    /* .mhb-slider width/margin géré par .mhb-bleed */
    .mhb-slider {
        min-height: 600px;
        border-bottom-left-radius: var(--mhb-radius-md);
        border-bottom-right-radius: var(--mhb-radius-md);
    }

    .mhb-slider__track {
        height: 600px;
    }

    .mhb-slider__pagination {
        display: none;
    }

    .mhb-slider__arrows {
        bottom: 20px;
        right: 20px;
    }

    .mhb-slider__arrow {
        width: 44px;
        height: 44px;
    }

    .mhb-slider__arrow svg {
        width: 18px;
        height: 18px;
    }
}

/* À partir de 900px: carousels bord à bord */
@media (max-width: 900px) {
    .mhb-carousel {
        padding: 0;
        overflow: visible;
    }

    /* Le calcul s'adapte grâce aux variables responsive */
    .mhb-carousel--full {
        --carousel-offset: calc(var(--mhb-bleed-margin) + var(--mhb-section-padding-x) + var(--mhb-content-padding-x));
        width: calc(100% + var(--carousel-offset) * 2);
        margin-left: calc(var(--carousel-offset) * -1);
        margin-right: calc(var(--carousel-offset) * -1);
        padding: 0;
        overflow: visible;
    }

    /* Sections sans padding latéral */
    .mhb-section--spacing-medium {
        padding-left: 0;
        padding-right: 0;
    }

    .mhb-section__content--rounded-shadow {
        border-radius: 0;
    }
}

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

    .mhb-slider {
        min-height: 80svh;
    }

    .mhb-slider__track {
        height: 80svh;
    }

    .mhb-slider__content {
        margin-left: 30px;
        max-width: 90%;
    }

    .mhb-slider__title {
        font-size: clamp(36px, 7.8vw, 50px);
    }

    .mhb-slider__arrows {
        bottom: 15px;
        right: 15px;
        gap: 8px;
    }

    .mhb-slider__arrow {
        width: 40px;
        height: 40px;
    }

    .mhb-slider__arrow svg {
        width: 16px;
        height: 16px;
    }
}

@media (max-width: 576px) {

    /* Cards centrées - taille fixe 320px */
    .mhb-carousel__track>.mhb-card {
        flex: 0 0 320px;
        min-width: 320px;
        max-width: 320px;
        scroll-snap-align: center;
    }

    .mhb-carousel__pagination {
        gap: 12px;
    }

    .mhb-carousel__dots {
        gap: 8px;
    }

    .mhb-carousel__arrow {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    .mhb-carousel__dot {
        width: 12px;
        height: 12px;
    }

    .mhb-carousel__dot.is-active {
        width: 50px;
    }

    .mhb-slider:not(.mhb-shop-slider) {
        margin-top: -20px;
    }

    .mhb-slider {
        min-height: 80svh;
    }

    .mhb-slider__track {
        height: 80svh;
    }

    .mhb-slider__content {
        justify-content: flex-end;
        padding-bottom: 20px;
    }

    .mhb-slider__title {
        font-size: clamp(30px, 8.4vw, 38px);
        margin-bottom: 15px;
    }

    .mhb-slider__content {
        margin-left: 15px;
        margin-right: 15px;
        max-width: calc(100% - 30px);
    }

    .mhb-slider__overlay {
        background: linear-gradient(0deg, rgba(15, 20, 25, 0.9) 0%, rgba(15, 20, 25, 0.3) 60%, rgba(15, 20, 25, 0.1) 100%);
    }

    .mhb-slider__arrows {
        bottom: 10px;
        right: 10px;
        gap: 6px;
    }

    .mhb-slider__arrow {
        width: 36px;
        height: 36px;
    }

    .mhb-slider__arrow svg {
        width: 14px;
        height: 14px;
    }
}

@media (max-width: 450px) {
    .mhb-carousel__track {
        gap: 18px;
    }

    .mhb-carousel__track > .mhb-card,
    .mhb-carousel__track > .mhb-legend-card,
    .mhb-carousel__track > .mhb-carousel__item {
        scroll-snap-align: center;
    }
}

@media (max-width: 350px) {
    .mhb-carousel__pagination {
        gap: 5px;
        margin-left: -12px;
    }

    .mhb-carousel__dots {
        gap: 6px;
    }
}
