/*
 * BoxToPlay - select enrichi par icones (btp-icon-select).
 * Markup attendu :
 *   <div class="btp-icon-select">
 *     <select class="form-control btp-icon-select-native" id="...">
 *       <option value="X" data-icon="fa-users">Label</option>
 *       <option value="Y" data-symbol="&ge;">Label</option>
 *       <option value="Z" data-image="/assets/logo.webp" data-icon="fa-server">Label</option>
 *     </select>
 *   </div>
 * Activation : BtpIconSelect.enhance(selectElement) ou BtpIconSelect.enhanceAll(rootElement).
 * Les overrides sombres vivent dans dark-modern.css ou dark-modern-frontend.css selon la surface.
 */
.btp-icon-select {
    position: relative;
}

.btp-icon-select.is-enhanced .btp-icon-select-native {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
    opacity: 0;
    pointer-events: none;
}

.btp-icon-select-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    text-align: left;
}

/*
 * Dans un .input-group, Bootstrap 3 force .form-control en table-cell flottant et annule les coins :
 * on conserve la mise en page flex du toggle et les coins du select natif.
 */
.input-group .btp-icon-select > .btp-icon-select-toggle.form-control {
    display: flex;
    float: none;
    border-radius: 3px;
}

.btp-icon-select-current {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.btp-icon-select-current .btp-icon-select-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btp-icon-select-current .fa,
.btp-icon-select-option .fa,
.btp-icon-select-current .btp-icon-select-symbol,
.btp-icon-select-option .btp-icon-select-symbol {
    width: 1.15em;
    flex: 0 0 auto;
    text-align: center;
    color: #1bbae1;
}

.btp-icon-select-current .btp-icon-select-symbol,
.btp-icon-select-option .btp-icon-select-symbol {
    font-weight: 700;
    font-size: 1.05em;
    line-height: 1;
}

.btp-icon-select-image {
    display: inline-flex;
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    align-items: center;
    justify-content: center;
}

.btp-icon-select-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.btp-icon-select-caret {
    flex: 0 0 auto;
    opacity: 0.7;
}

.btp-icon-select.is-open .btp-icon-select-caret {
    transform: rotate(180deg);
}

.btp-icon-select-menu {
    position: fixed;
    z-index: 1080;
    margin: 0;
    padding: 4px 0;
    list-style: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid #1bbae1;
    border-radius: 3px;
    background: #fff;
    color: #333;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.btp-icon-select-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    white-space: normal;
    overflow-wrap: anywhere;
}

.btp-icon-select-option.is-active,
.btp-icon-select-option:hover {
    background: #1bbae1;
    color: #fff;
}

.btp-icon-select-option.is-active .fa,
.btp-icon-select-option:hover .fa,
.btp-icon-select-option.is-active .btp-icon-select-symbol,
.btp-icon-select-option:hover .btp-icon-select-symbol {
    color: #fff;
}
