joomla-field-fancy-select.slistajax {
    display: block;
    min-width: 0;
}

joomla-field-fancy-select.slistajax[aria-busy="true"] .choices__inner {
    cursor: progress;
}

joomla-field-fancy-select.slistajax.slistajax--not-clearable .choices__button,
joomla-field-fancy-select.slistajax.slistajax--not-clearable .choices__button_joomla {
    display: none !important;
}

joomla-field-fancy-select.slistajax .slistajax__status {
    padding: .75rem 1rem;
    color: var(--body-color, inherit);
    font-size: .875rem;
}

joomla-field-fancy-select.slistajax .slistajax__load-more {
    display: block;
    width: calc(100% - 1rem);
    margin: .5rem;
}

joomla-field-fancy-select.slistajax .slistajax__load-more[hidden] {
    display: none !important;
}

joomla-field-fancy-select.slistajax .slistajax__choice-list--hidden {
    display: none !important;
}

joomla-field-fancy-select.slistajax .slistajax__description {
    display: block;
    margin-top: .125rem;
    opacity: .72;
    font-size: .8125rem;
    line-height: 1.25;
    white-space: normal;
}

joomla-field-fancy-select.slistajax.is-disabled {
    opacity: .75;
}

/*
 * Joomla/Choices renders the search input for a multiple select inside the
 * closed control. SListAjax keeps it hidden until the dropdown is opened and
 * then gives it a full row, matching the single-select interaction pattern.
 */
joomla-field-fancy-select.slistajax .choices[data-type="select-multiple"]:not(.is-open) .choices__input--cloned {
    display: none !important;
}

joomla-field-fancy-select.slistajax:not(.slistajax--not-searchable) .choices[data-type="select-multiple"].is-open .choices__input--cloned {
    display: block !important;
    box-sizing: border-box;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    margin-top: .25rem;
}

/* Vertically center the selected value in single-select controls. */
joomla-field-fancy-select.slistajax .choices[data-type="select-one"] .choices__inner {
    display: flex;
    align-items: center;
}

joomla-field-fancy-select.slistajax .choices[data-type="select-one"] .choices__list--single {
    display: flex;
    align-items: center;
    padding-top: 0;
    padding-bottom: 0;
}

joomla-field-fancy-select.slistajax .choices[data-type="select-one"] .choices__list--single .choices__item {
    align-items: center;
    line-height: 1.25;
}

/*
 * Joomla places the clear button 50px from the right edge. Move it closer to
 * the dropdown arrow and center the x glyph in both axes.
 */
joomla-field-fancy-select.slistajax .choices[data-type="select-one"] .choices__button_joomla {
    top: 50%;
    right: 2rem;
    margin-top: 0;
    margin-right: 0;
    transform: translateY(-50%);
    line-height: 1;
    z-index: 2;
}

joomla-field-fancy-select.slistajax .choices[data-type="select-one"] .choices__button_joomla::before {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/*
 * Some Joomla templates disable Choices' native ::after arrow and expect a
 * background SVG. Render a local arrow so SListAjax remains readable when a
 * template overrides that background.
 */
joomla-field-fancy-select.slistajax .choices[data-type="select-one"]::after,
joomla-field-fancy-select.slistajax .choices[data-type="select-multiple"]::after {
    content: "";
    display: block !important;
    position: absolute;
    top: 50%;
    right: .875rem;
    width: 0;
    height: 0;
    margin-top: -.125rem;
    border: .3125rem solid transparent;
    border-top-color: currentColor;
    pointer-events: none;
    z-index: 2;
}

joomla-field-fancy-select.slistajax .choices[data-type="select-one"].is-open::after,
joomla-field-fancy-select.slistajax .choices[data-type="select-multiple"].is-open::after {
    margin-top: -.4375rem;
    border-top-color: transparent;
    border-bottom-color: currentColor;
}

joomla-field-fancy-select.slistajax.slistajax--not-searchable .choices__input--cloned {
    display: none !important;
}
