/* ==========================================================
   SELECT RECHERCHABLE (marque / modèle, et tout <select> habillé via
   SearchableSelect.enhance() — voir public/js/searchable-select.js)
   Base neutre, proche du .form-select standard de Bootstrap, pensée pour
   être utilisée telle quelle côté admin ET surchargée côté site public
   (voir custom.css) pour matcher les dimensions du thème.
   ========================================================== */

.searchable-select {
    position: relative;
}

/* Le <select> natif reste dans le DOM (masqué via clip/1px, pas
   display:none) pour garder la validation "required" du navigateur — c'est
   lui la source de vérité, ce fichier n'habille que l'affichage. */
.searchable-select__native {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.searchable-select__trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-height: calc(1.5em + .75rem + 2px);
    padding: .375rem .75rem;
    border-radius: .375rem;
    border: 1px solid #ced4da;
    background: #fff;
    font-size: 1rem;
    color: #212529;
    cursor: pointer;
}

.searchable-select.is-open .searchable-select__trigger {
    border-color: #86b7fe;
}

.searchable-select__value {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.searchable-select__value.is-placeholder {
    color: #9a9fa8;
}

.searchable-select__trigger .material-icons {
    font-size: 20px;
    color: #9a9fa8;
    flex-shrink: 0;
    transition: transform .15s;
}

.searchable-select.is-open .searchable-select__trigger .material-icons {
    transform: rotate(180deg);
}

.searchable-select__panel {
    position: absolute;
    inset-inline-start: 0;
    top: calc(100% + 6px);
    z-index: 1050;
    width: 100%;
    min-width: 260px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .14);
    padding: 10px;
}

.searchable-select__search {
    position: relative;
    margin-bottom: 8px;
}

.searchable-select__search input {
    width: 100%;
    height: 40px;
    padding-inline-start: 12px;
    padding-inline-end: 36px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
}

/* Positionné sur ce span englobant plutôt que directement sur .material-icons :
   cette classe (police d'icônes) force elle-même direction:ltr (pour garder la
   ligature "search" -> glyphe lisible), ce qui fait qu'un inset-inline-end posé
   dessus se calculerait en LTR et placerait l'icône du mauvais côté en RTL. */
.searchable-select__search-icon {
    position: absolute;
    inset-inline-end: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    display: flex;
}
.searchable-select__search-icon .material-icons {
    font-size: 18px;
    color: #9a9fa8;
}

.searchable-select__options {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 260px;
    overflow-y: auto;
}

.searchable-select__options li {
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 14px;
    color: #444;
    cursor: pointer;
}

.searchable-select__options li:hover {
    background: #f1f2f3;
}

.searchable-select__options li.is-selected {
    background: #e7f1ff;
    color: #0d6efd;
    font-weight: 600;
}

.searchable-select__empty {
    padding: 10px 12px;
    margin: 0;
    font-size: 13px;
    color: #9a9fa8;
    text-align: center;
}
