/*
 * WihdaTec Pro – Ajustements, couleurs du formulaire de recherche avancée.
 * Version 1.0.7, dernière modification : 2026-10-11_13-25-19 (Montréal).
 * Sélecteurs limités à #search_form_ajax et aux popups Select2 identifiées.
 */
#search_form_ajax .wih-recherche-unique-btn,
#search_form_ajax .wih-recherche-unique-btn.btn-theme {
    background:var(--wih-btn-bg)!important;
    border-color:var(--wih-btn-bg)!important;
    color:var(--wih-btn-text)!important;
}
#search_form_ajax .wih-recherche-unique-btn:hover,
#search_form_ajax .wih-recherche-unique-btn:focus-visible {
    background:var(--wih-btn-hover)!important;
    border-color:var(--wih-btn-hover)!important;
    color:var(--wih-btn-text)!important;
}
#search_form_ajax input[name="by_title"],
#search_form_ajax input#address_location,
#search_form_ajax select,
#search_form_ajax .select2-container--default .select2-selection--single {
    background-color:var(--wih-fields-bg)!important;
    color:var(--wih-fields-text)!important;
}
#search_form_ajax input[name="by_title"]::placeholder,
#search_form_ajax input#address_location::placeholder {color:var(--wih-fields-text)!important;opacity:.8;}
#search_form_ajax .select2-container--default .select2-selection--single .select2-selection__rendered,
#search_form_ajax .select2-container--default .select2-selection--single .select2-selection__placeholder {
    color:var(--wih-fields-text)!important;
}
body .select2-container.wih-search-select2 .select2-dropdown,
body .select2-container.wih-search-select2 .select2-results__options,
body .select2-container.wih-search-select2 .select2-results__option {
    background-color:var(--wih-dropdown-bg)!important;
    color:var(--wih-dropdown-text)!important;
}
body .select2-container.wih-search-select2 .select2-results__option--highlighted[aria-selected] {
    background-color:var(--wih-btn-bg)!important;
    color:var(--wih-btn-text)!important;
}
@media (max-width:767px) {
    #search_form_ajax input[name="by_title"],
    #search_form_ajax input#address_location,
    #search_form_ajax select,
    #search_form_ajax .select2-container--default .select2-selection--single {
        background-color:var(--wih-mobile-fields-bg)!important;
        color:var(--wih-mobile-fields-text)!important;
    }
    #search_form_ajax input[name="by_title"]::placeholder,
    #search_form_ajax input#address_location::placeholder,
    #search_form_ajax .select2-container--default .select2-selection--single .select2-selection__rendered,
    #search_form_ajax .select2-container--default .select2-selection--single .select2-selection__placeholder {
        color:var(--wih-mobile-fields-text)!important;
    }
    body .select2-container.wih-search-select2 .select2-dropdown,
    body .select2-container.wih-search-select2 .select2-results__options,
    body .select2-container.wih-search-select2 .select2-results__option {
        background-color:var(--wih-mobile-dropdown-bg)!important;
        color:var(--wih-mobile-dropdown-text)!important;
    }
}

/* 2026-10-11 : flèches Select2 contrastées, placées dans le cadre des champs.
 * Ne modifie ni les menus du bandeau global, ni ceux de l'administration.
 */
#search_form_ajax .select2-container--default .select2-selection--single {
    position: relative !important;
    box-sizing: border-box !important;
    padding-right: 34px !important;
    overflow: hidden !important;
}
#search_form_ajax .select2-container--default .select2-selection--single .select2-selection__rendered {
    box-sizing: border-box !important;
    padding-right: 8px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}
#search_form_ajax .select2-container--default .select2-selection--single .select2-selection__arrow {
    display: block !important;
    position: absolute !important;
    top: 0 !important;
    right: 4px !important;
    left: auto !important;
    bottom: 0 !important;
    width: 30px !important;
    height: 100% !important;
    margin: 0 !important;
    transform: none !important;
    opacity: 1 !important;
    pointer-events: none !important;
}
#search_form_ajax .select2-container--default .select2-selection--single .select2-selection__arrow b {
    display: none !important;
}
#search_form_ajax .select2-container--default .select2-selection--single .select2-selection__arrow::after {
    content: "" !important;
    position: absolute !important;
    top: calc(50% - 4px) !important;
    left: calc(50% - 5px) !important;
    width: 9px !important;
    height: 9px !important;
    border: solid var(--wih-arrow-color, #044353) !important;
    border-width: 0 2px 2px 0 !important;
    transform: rotate(45deg) !important;
    opacity: 1 !important;
}
#search_form_ajax .select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow::after {
    top: calc(50% - 1px) !important;
    transform: rotate(225deg) !important;
}
@media (max-width: 767px) {
    #search_form_ajax .select2-container--default .select2-selection--single {
        width: 100% !important;
        min-width: 0 !important;
        padding-right: 37px !important;
        overflow: hidden !important;
    }
    #search_form_ajax .select2-container--default .select2-selection--single .select2-selection__arrow {
        right: 5px !important;
        width: 33px !important;
    }
    #search_form_ajax .select2-container--default .select2-selection--single .select2-selection__arrow::after {
        border-color: var(--wih-mobile-arrow-color, #044353) !important;
    }
}
/* Le sélecteur de pays peut être en RTL en arabe : flèche du côté logique du champ. */
html[dir="rtl"] #search_form_ajax .select2-container--default .select2-selection--single {
    padding-left: 34px !important;
    padding-right: 8px !important;
}
html[dir="rtl"] #search_form_ajax .select2-container--default .select2-selection--single .select2-selection__arrow {
    left: 4px !important;
    right: auto !important;
}

/*
 * 2026-10-11 13:25:19 (Montréal)
 * Réinitialisation Select2 : la croix X doit se trouver à l'extrémité droite,
 * et la flèche juste à gauche lorsqu'une valeur est sélectionnée.
 * Le correctif se limite aux menus du formulaire de recherche avancée.
 */
#search_form_ajax .select2-container--default .select2-selection--single .select2-selection__rendered {
    position: static !important;
    overflow: visible !important;
    padding-right: 40px !important;
}
#search_form_ajax .select2-container--default .select2-selection--single .select2-selection__clear {
    position: absolute !important;
    float: none !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    top: 50% !important;
    right: 5px !important;
    left: auto !important;
    transform: translateY(-50%) !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 24px !important;
    height: 26px !important;
    line-height: 26px !important;
    font-size: 19px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    color: var(--wih-arrow-color, #044353) !important;
    z-index: 3 !important;
}
#search_form_ajax .select2-container--default .select2-selection--single:has(.select2-selection__clear) .select2-selection__rendered,
#search_form_ajax .select2-container--default .select2-selection--single.wih-choix-effacable .select2-selection__rendered {
    padding-right: 75px !important;
}
#search_form_ajax .select2-container--default .select2-selection--single:has(.select2-selection__clear) .select2-selection__arrow,
#search_form_ajax .select2-container--default .select2-selection--single.wih-choix-effacable .select2-selection__arrow {
    right: 33px !important;
}
@media(max-width:767px) {
    #search_form_ajax .select2-container--default .select2-selection--single .select2-selection__clear {
        color: var(--wih-mobile-arrow-color, #044353) !important;
    }
}
html[dir="rtl"] #search_form_ajax .select2-container--default .select2-selection--single .select2-selection__clear {
    left: 5px !important;
    right: auto !important;
}
html[dir="rtl"] #search_form_ajax .select2-container--default .select2-selection--single:has(.select2-selection__clear) .select2-selection__arrow,
html[dir="rtl"] #search_form_ajax .select2-container--default .select2-selection--single.wih-choix-effacable .select2-selection__arrow {
    left: 33px !important;
    right: auto !important;
}
html[dir="rtl"] #search_form_ajax .select2-container--default .select2-selection--single:has(.select2-selection__clear) .select2-selection__rendered,
html[dir="rtl"] #search_form_ajax .select2-container--default .select2-selection--single.wih-choix-effacable .select2-selection__rendered {
    padding-left: 75px !important;
    padding-right: 8px !important;
}
