/**
 * CSS complet pour le module Home Selector
 * Design horizontal simple avec carrousel fluide
 */

/* Style de base avec Poppins — exclure les icônes Font Awesome et ceicon */
.home-selector-wrapper,
.home-selector-wrapper *:not(.fas):not(.far):not(.fab):not(.fa):not([class*="ceicon"]) {
    font-family: 'Poppins', sans-serif;
}

.home-selector-wrapper {
    position: relative;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.home-selector-wrapper.loaded {
    opacity: 1;
}

.bg-slide {
    position: relative;
    width: 100%;
    height: 530px;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

/* Image de fond mobile (fixe, pas de carrousel) */
@media (max-width: 768px) {
    .bg-slide.mobile-bg {
        background-image: var(--mobile-bg-image) !important;
    }
}

/* Stack d'images de fond desktop (crossfade) */
.hs-bg-stack {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

@media (max-width: 768px) {
    .hs-bg-stack {
        display: none;
    }
}

.hs-bg-slide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    opacity: 0;
    transition: opacity 1.2s ease-in-out;
}

.hs-bg-slide.is-active {
    opacity: 1;
}

/* Indicateurs de progression du carrousel d'images (desktop uniquement) */
.hs-bg-indicators {
    position: absolute;
    bottom: 36px;
    right: 48px;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

@media (max-width: 768px) {
    .hs-bg-indicators {
        display: none;
    }
}

.hs-bg-indicator {
    position: relative;
    display: inline-block;
    width: 28px;
    height: 2px;
    background: rgba(255, 255, 255, 0.25);
    overflow: hidden;
    transition: width 0.4s ease;
}

.hs-bg-indicator.is-active {
    width: 54px;
}

.hs-bg-indicator-fill {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 0;
    background: #E02020;
    will-change: width;
    transform: translateZ(0);
    transition: width linear;
}

.hs-bg-indicator.is-active .hs-bg-indicator-fill {
    width: 100%;
}

/* Overlay sombre au-dessus des images mais sous le contenu */
.bg-slide::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1;
    pointer-events: none;
}

/* Le header doit être le parent de référence pour le positionnement du bloc AV */
.selector-header {
    position: relative;
}

/* Bloc Avis Vérifiés - centré verticalement sur le sous-titre (desktop uniquement) */
/* Le sous-titre fait ~20px de haut (font-size 15px, line-height 1.3) -> on aligne le centre du bloc sur ~10px depuis le top du header */
.hs-av-block {
    position: absolute;
    top: 10px;
    right: -70px;
    z-index: 3;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 8px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    color: #163C5D;
    font-family: 'Poppins', sans-serif;
    min-height: 80px;
    opacity: 0;
    transform: translateY(calc(-50% - 60px));
    transition: opacity 0.5s ease 0.2s, transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s;
}

.home-selector-wrapper.loaded .hs-av-block {
    opacity: 1;
    transform: translateY(-50%);
}

.hs-av-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-right: 14px;
}

.hs-av-logo img {
    max-width: 70px;
    height: auto;
    display: block;
}

.hs-av-separator {
    width: 1px;
    height: 40px;
    align-self: center;
    background: lightgray;
    opacity: 0.5;
}

.hs-av-rating {
    padding-left: 14px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    color: #163C5D;
}

.hs-av-stars {
    position: relative;
    display: inline-block;
    font-size: 14px;
    line-height: 1;
    letter-spacing: 1px;
}

.hs-av-stars-bg {
    color: rgba(0, 110, 255, 0.25);
}

.hs-av-stars-fill {
    position: absolute;
    top: 0;
    left: 0;
    color: #006EFF;
    overflow: hidden;
    white-space: nowrap;
}

.hs-av-note {
    font-size: 20px;
    font-weight: 800;
    color: #163C5D;
    line-height: 1.1;
}

.hs-av-link {
    font-size: 10px;
    color: #9CA3AF;
    text-decoration: underline !important;
    line-height: 1.2;
}

.hs-av-link:hover {
    color: #006EFF;
    text-decoration: underline;
    opacity: 1;
}

/* Masqué en dessous de 768px */
@media (max-width: 768px) {
    .hs-av-block,
    .home-selector-wrapper.loaded .hs-av-block {
        display: none !important;
    }
}

/* Carrousel des catégories en haut — masqué temporairement, conservé pour réutilisation future */
.hs-categories-carousel {
    display: none;
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    width: 98%; /* Agrandi de 95% à 98% */
    max-width: 1400px; /* Agrandi de 1200px à 1400px */
}

.hs-carousel-container {
    background: transparent;
    padding: 12px 0;
    position: relative;
    overflow: hidden;
    border-bottom: 2px solid rgba(255, 255, 255, 0.8);
}

.hs-carousel-content {
    display: flex;
    align-items: center;
    position: relative;
    padding: 0 40px; /* Retour à 40px */
}

.hs-carousel-track-container {
    flex: 1;
    overflow: hidden;
    width: 100%;
}

.hs-carousel-track {
    display: flex;
    gap: 0px; /* Pas de gap entre les éléments - l'espacement sera aux extrémités */
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 8px 0;
    align-items: center;
    justify-content: flex-start;
    width: max-content;
}

.hs-carousel-item {
    flex: 0 0 auto;
    text-align: center;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid rgba(255, 255, 255, 0.2); /* Séparation subtile entre les éléments */
}

/* Masquer la bordure du dernier élément visible dans le viewport */
.hs-carousel-item:last-child {
    border-right: none; /* Pas de bordure sur le dernier élément du DOM */
}

/* Classe dynamique pour masquer la bordure du dernier élément visible */
.hs-carousel-item.last-visible {
    border-right: none;
}

/* Classe pour forcer l'affichage de la bordure lors de la navigation */
.hs-carousel-item.show-border {
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.hs-category-link {
    color: white;
    text-decoration: none;
    font-size: 0.72rem; /* Réduit de 0.81rem à 0.72rem (environ 10% de réduction) */
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    transition: color 0.3s ease;
    padding: 4px 24px; /* Retour à 24px */
    display: flex;
    align-items: center;
    gap: 8px; /* Réduit de 10px à 8px */
    text-align: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.hs-category-link:hover {
    color: #e74c3c;
    text-decoration: none;
}

/* Icônes des catégories */
.hs-category-icon {
    width: 26px; /* Réduit de 29px à 26px (environ 10% de réduction) */
    height: 26px;
    object-fit: contain; /* Préserve le ratio tout en respectant les dimensions */
    flex-shrink: 0; /* Empêche la réduction de l'icône */
    filter: brightness(0) invert(1); /* Rend l'icône blanche */
    transition: filter 0.3s ease; /* Transition fluide pour les effets hover */
}

/* Effet hover sur l'icône (rouge comme le texte) */
.hs-category-link:hover .hs-category-icon {
    filter: brightness(0) saturate(100%) invert(27%) sepia(51%) saturate(2878%) hue-rotate(346deg) brightness(104%) contrast(97%);
    /* Ce filtre produit la couleur #e74c3c (rouge) */
}

/* Texte des catégories */
.hs-category-text {
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    text-align: center;
}

/* Flèches du carrousel */
.hs-carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: white;
    height: 35px;
    cursor: pointer;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.hs-carousel-prev {
    left: 5px;
}

.hs-carousel-next {
    right: 5px;
}

.hs-carousel-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.hs-carousel-btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

/* État disabled pour les boutons du carrousel */
.hs-carousel-btn:disabled,
.hs-carousel-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.hs-carousel-btn:disabled:hover,
.hs-carousel-btn.disabled:hover {
    background: transparent;
    border-radius: 0;
}

/* Contenu principal - aligné à gauche */
.main-content {
    position: relative;
    z-index: 2;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 20px;
    max-width: 1350px;
    margin: 70px auto 0;
    width: 100%;
}

/* Header du sélecteur */
.selector-header {
    text-align: left;
    margin-bottom: 40px;
    width: 100%;
}

.selector-main-title {
    font-family: 'Poppins', sans-serif;
    font-size: 3rem;
    font-weight: 700;
    color: white;
    margin-bottom: 15px;
    line-height: 1.2;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Classe spécifique pour le H1 du module home selector */
.home-selector-main-title {
    font-family: 'Poppins', sans-serif;
    font-size: 60px;
    font-weight: bold;
    color: white;
    margin-top: 15px;
    margin-bottom: 0;
    line-height: 1.2;
    letter-spacing: 1px;
}

.selector-subtitle {
    font-family: 'Poppins', serif;
    font-size: 15px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0;
    transform: translateX(80vw) scale(0.3);
    transform-origin: left center;
    transition: opacity 0.6s ease, transform 0.7s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.home-selector-wrapper.loaded .selector-subtitle {
    opacity: 1;
    transform: translateX(0) scale(1);
}

/* Container simple du sélecteur */
.selector-3-steps-container {
    width: 85%;
    max-width: none;
    position: relative; /* Ajouté pour le positionnement absolu du reset */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(20px);
    background: rgba(255, 255, 255, 0.08);
    border-radius: 80px;
    padding: 30px 60px;
}

/* Ligne horizontale simple */
.selector-steps-row {
    display: flex;
    gap: 12px;
    align-items: stretch;
    justify-content: center;
}

/* Chaque étape */
.selector-step {
    flex: 0 0 250px;
    position: relative;
}

/* Overlay pour afficher le texte du select */
.select-overlay {
    font-family: 'Poppins', sans-serif;
    position: absolute;
    top: 0;
    left: 0;
    right: 54px; /* Espace pour l'icône flèche */
    height: 46px;
    padding: 12px 30px;
    display: flex;
    align-items: center;
    pointer-events: none;
    z-index: 2;
    background: transparent;
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Texte de l'étape */
.step-text {
    color: inherit;
    flex: 1;
}

/* Couleurs par défaut (rouge) */
.select-overlay.default-text .step-text {
    color: #FC2938;
}

/* Couleurs pour champs désactivés (bleu foncé) */
.selector-step.disabled .select-overlay.default-text .step-text {
    color: #003d60;
}

/* Couleurs pour vraies sélections (bleu foncé) */
.select-overlay:not(.default-text) .step-text {
    color: #003d60;
}

/* Champs blancs simples - TOUS les champs ont un fond blanc */
.selector-dropdown {
    font-family: 'Poppins', sans-serif;
    width: 100%;
    height: 46px;
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    background: white !important; /* Force le fond blanc sur TOUS les champs */
    background-color: white !important;
    font-size: 0.9rem;
    font-weight: 500;
    appearance: none;
    padding-right: 54px;
    position: relative;
}

/* Icône flèche Font Awesome dans les champs */
.step-arrow {
    position: absolute;
    top: 50%;
    right: 24px;
    transform: translateY(-50%);
    color: #6b7280;
    font-size: 1rem;
    pointer-events: none;
    z-index: 3;
    transition: transform 0.3s ease;
}

/* Rotation de la flèche quand le select est ouvert */
.selector-step.open .step-arrow {
    transform: translateY(-50%) rotate(180deg);
}

/* Style pour les champs avec option par défaut sélectionnée */
.selector-dropdown.default-selected {
    color: #FC2938; /* Rouge pour les options par défaut */
}

/* Style pour les champs désactivés - fond blanc, texte bleu */
.selector-dropdown:disabled {
    background-color: white !important; /* Force le fond blanc même si désactivé */
    background: white !important; /* Double sécurité */
    cursor: not-allowed;
    opacity: 1 !important; /* Force l'opacité à 1 pour éviter la transparence */
}

.selector-dropdown:disabled.default-selected {
    color: #003d60; /* Bleu foncé pour les champs désactivés */
}

/* Style pour les options dans la liste déroulante */
.selector-dropdown option.default-option {
    color: #FC2938; /* Rouge pour les options par défaut */
}

.selector-dropdown:disabled option.default-option {
    color: #003d60; /* Bleu foncé pour les champs désactivés */
}

/* Style pour les vraies options (non par défaut) */
.selector-dropdown option:not(.default-option) {
    color: #000; /* Noir pour les vraies sélections */
}

/* Conteneur du bouton reset - en dessous du container flouté, aligné à gauche avec la première étape */
.reset-button-container {
    margin-top: 15px;
    padding-left: 30px; /* Aligné avec le padding intérieur du container flouté */
    display: flex;
    align-items: center;
    justify-content: flex-start;
    /* L'espace est toujours réservé, seule la visibilité change */
    visibility: hidden;
}

.reset-button-container.is-visible {
    visibility: visible;
}

/* Bouton de reset avec couleur rouge */
.reset-btn {
    background: #E81F1F; /* Rouge du bouton rechercher */
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reset-btn:hover {
    background: #BE4142; /* Rouge plus foncé au hover, comme le bouton rechercher */
}

/* Bouton de recherche */
.search-button-container {
    flex: 0 0 250px;
    display: flex;
    align-items: center;
}

.search-btn {
    font-family: 'Poppins', sans-serif;
    background: #E81F1F;
    border: none;
    color: white;
    padding: 0 24px;
    width: 100%;
    height: 46px;
    border-radius: 25px;
    font-weight: 500;
    font-size: 14px;
    text-transform: capitalize;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: background 0.3s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.search-btn .ceicon {
    display: flex;
    align-items: center;
    line-height: 1;
}

.search-btn:hover {
    background: #163C5D;
}

.search-btn:disabled {
    background: #E81F1F;
    color: white;
    opacity: 1;
    cursor: not-allowed;
    pointer-events: auto;
}

.search-btn:disabled:hover {
    background: #E81F1F;
}

/* Tablette : retirer le height forcé */
@media (max-width: 991px) and (min-width: 769px) {
    .bg-slide {
        height: auto;
    }

    .main-content {
        margin-top: 0;
    }
}

/* Responsive */
@media (max-width: 768px) {
    /* Masquer le carrousel sur mobile */
    .hs-categories-carousel {
        display: none;
    }

    /* Ajuster la hauteur de fond sur mobile sans carrousel */
    .bg-slide {
        height: auto;
        min-height: 80vh; /* Réduit de 100vh à 80vh sur mobile */
    }

    /* Centrer le contenu verticalement sur mobile */
    .main-content {
        padding: 60px 20px 40px 20px;
        justify-content: center;
        min-height: calc(100vh - 100px);
        margin-top: 0;
    }

    /* Header centré et plus compact sur mobile */
    .selector-header {
        text-align: left; /* Changé de center à left pour garder l'alignement desktop */
        margin-bottom: 50px;
        position: relative; /* Pour la ligne séparatrice */
    }

    /* Ligne séparatrice sous les titres sur mobile */
    .selector-header::after {
        content: '';
        position: absolute;
        bottom: -25px;
        left: 0;
        right: 0;
        height: 2px;
        background: rgba(255, 255, 255, 0.8);
    }

    /* Titre principal plus petit et optimisé mobile */
    .home-selector-main-title {
        font-size: 2.2rem; /* Réduit de 3rem à 2.2rem */
        line-height: 1.1;
        margin-top: 20px;
        margin-bottom: 0;
        letter-spacing: 0.5px;
    }

    /* Sous-titre plus petit sur mobile */
    .selector-subtitle {
        font-size: 1.1rem; /* Réduit de 1.4rem à 1.1rem */
        line-height: 1.4;
        max-width: 100%; /* Changé de 90% à 100% pour éviter le décalage */
        margin: 0; /* Assurer qu'il n'y a pas de marge automatique */
        text-align: left; /* Forcer l'alignement à gauche comme le H1 */
    }

    /* Container du sélecteur adapté mobile : prend toute la largeur, padding réduit, centré */
    .selector-3-steps-container {
        width: 100%;
        padding: 30px 20px;
        border-radius: 24px;
        margin: 0 auto;
    }

    /* Disposition verticale des champs sur mobile */
    .selector-steps-row {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    /* Reset du flex-basis horizontal qui devient une hauteur en colonne */
    .selector-step,
    .search-button-container {
        flex: 0 0 auto;
        width: 100%;
    }

    /* Champs plus hauts et plus confortables sur mobile */
    .selector-dropdown {
        height: 56px; /* Plus haut que desktop (50px) */
        font-size: 1rem; /* Légèrement plus gros */
        padding: 18px 20px;
        padding-right: 50px;
    }

    /* Overlay adapté pour mobile */
    .select-overlay {
        height: 56px;
        padding: 18px 20px;
        right: 50px;
        font-size: 0.98rem;
    }

    /* Icône flèche ajustée pour mobile */
    .step-arrow {
        right: 18px;
        font-size: 1.1rem;
    }

    /* Bouton de recherche optimisé mobile */
    .search-btn {
        width: 100%;
        height: 56px;
        font-size: 1.1rem;
        font-weight: 700;
        padding: 0 32px;
        margin-top: 10px;
    }

    /* Container du bouton reset repositionné pour mobile */
    .reset-button-container {
        margin-top: 16px;
        padding-left: 0;
        justify-content: center;
        width: 100%;
    }

    /* Bouton reset plus compact sur mobile */
    .reset-btn {
        width: 45px;
        height: 45px;
    }

    /* Icône flèche rotative un peu plus grande à l'intérieur du bouton */
    .reset-btn svg {
        width: 22px;
        height: 22px;
    }

    /* Ajustements pour très petits écrans */
    @media (max-width: 480px) {
        .main-content {
            padding: 40px 15px 30px 15px;
        }

        .home-selector-main-title {
            font-size: 1.9rem; /* Encore plus petit sur très petits écrans */
            margin-top: 15px;
            margin-bottom: 0;
        }

        .selector-subtitle {
            font-size: 1rem;
        }

        .selector-steps-row {
            gap: 15px;
        }

        .search-btn {
            width: 100%;
            height: 52px;
            font-size: 1rem;
        }

        .selector-dropdown {
            height: 52px;
            font-size: 0.95rem;
            padding: 16px 18px;
            padding-right: 45px;
        }

        .select-overlay {
            height: 52px;
            padding: 16px 18px;
            right: 45px;
            font-size: 0.95rem;
        }
    }

    /* Mode paysage mobile */
    @media (max-width: 768px) and (orientation: landscape) {
        .bg-slide {
            height: auto;
            min-height: 100vh;
        }

        .main-content {
            padding: 30px 20px;
            min-height: calc(100vh - 60px);
        }

        .selector-header {
            margin-bottom: 30px;
        }

        .home-selector-main-title {
            font-size: 2rem;
            margin-top: 15px;
            margin-bottom: 0;
        }

        .selector-subtitle {
            font-size: 1rem;
        }
    }
}