/**
 * choices.js, styled like the app's own inputs (@see main.css, the forms section)
 *
 * the library ships a stylesheet of its own; this one replaces it so a choices
 * box looks like a .form-control - same border, same radius, same focus ring -
 * and follows the light/dark theme through the app's variables
 */
[dir=rtl] .choices__list--dropdown .choices__item {
    text-align: right;
}
.choices {
    position: relative;
    margin-bottom: 5px;
    font-size: 0.9375rem;
}
.choices:focus {
    outline: 0;
}
.choices:last-child {
    margin-bottom: 0;
}
.choices.is-disabled .choices__inner,
.choices.is-disabled .choices__input {
    background-color: var(--app-surface-2);
    cursor: not-allowed;
    user-select: none;
}
.choices.is-disabled .choices__item {
    cursor: not-allowed;
    color: var(--app-text-2);
}
.choices [hidden] {
    display: none !important;
}
.choices[data-type*=select-one] {
    cursor: pointer;
}
.choices[data-type*=select-one] .choices__inner {
    padding-bottom: 7.5px;
}
.choices[data-type*=select-one] .choices__input {
    display: block;
    width: 100%;
    padding: 10px;
    border-bottom: 1px solid var(--app-border);
    background-color: var(--app-surface);
    margin: 0;
}
.choices[data-type*=select-one] .choices__button {
    padding: 0;
    position: absolute;
    top: 50%;
    right: 0;
    margin-top: -10px;
    margin-right: 28px;
    height: 20px;
    width: 20px;
    border-radius: 10em;
    box-sizing: content-box;
    color: var(--app-text);
    background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round'%3e%3cpath d='M3.5 3.5l9 9M12.5 3.5l-9 9'/%3e%3c/svg%3e") center / 0.9em auto no-repeat;
    border: 0;
    opacity: 0.5;
}
.choices[data-type*=select-one] .choices__button:focus,
.choices[data-type*=select-one] .choices__button:hover {
    opacity: 1;
}
.choices[data-type*=select-one] .choices__button:focus {
    box-shadow: 0 0 0 2px var(--app-ring);
}
.choices[data-type*=select-one] .choices__item[data-value=""] .choices__button {
    display: none;
}
.choices[data-type*=select-one]::after {
    content: "";
    width: 1rem;
    height: 1rem;
    background-color: var(--app-text-2);
    -webkit-mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M4 6l4 4 4-4'/%3e%3c/svg%3e") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M4 6l4 4 4-4'/%3e%3c/svg%3e") center / contain no-repeat;
    position: absolute;
    right: 0.75rem;
    top: 50%;
    margin-top: -0.5rem;
    pointer-events: none;
    transition: transform 0.15s ease;
}
.choices[data-type*=select-one].is-open::after {
    transform: rotate(180deg);
}
.choices[data-type*=select-one][dir=rtl]::after {
    left: 0.75rem;
    right: auto;
}
.choices[data-type*=select-one][dir=rtl] .choices__button {
    right: auto;
    left: 0;
    margin-left: 28px;
    margin-right: 0;
}
.choices[data-type*=select-multiple] .choices__inner,
.choices[data-type*=text] .choices__inner {
    cursor: text;
}
.choices[data-type*=select-multiple] .choices__button,
.choices[data-type*=text] .choices__button {
    position: relative;
    display: inline-block;
    margin: 0 -4px 0 8px;
    padding-left: 16px;
    border-left: 1px solid rgba(0, 0, 0, 0.15);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round'%3e%3cpath d='M3.5 3.5l9 9M12.5 3.5l-9 9'/%3e%3c/svg%3e");
    background-size: 10px;
    width: 10px;
    line-height: 1;
    opacity: 0.6;
    border-radius: 0;
}
.choices[data-type*=select-multiple] .choices__button:focus,
.choices[data-type*=select-multiple] .choices__button:hover,
.choices[data-type*=text] .choices__button:focus,
.choices[data-type*=text] .choices__button:hover {
    opacity: 1;
}
.choices__inner {
    display: inline-block;
    vertical-align: top;
    width: 100%;
    background-color: var(--app-surface);
    padding: 0.4rem 0.5rem 0.2rem;
    border: 1px solid var(--app-border-strong);
    border-radius: var(--app-radius);
    font-size: 0.9375rem;
    min-height: 2.75rem;
    overflow: hidden;
    color: var(--app-text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.is-focused .choices__inner,
.is-open .choices__inner {
    border-color: var(--app-accent);
    box-shadow: 0 0 0 var(--bs-focus-ring-width, 0.2rem) var(--app-ring);
}
.is-open .choices__inner {
    border-radius: var(--app-radius) var(--app-radius) 0 0;
}
.is-flipped.is-open .choices__inner {
    border-radius: 0 0 var(--app-radius) var(--app-radius);
}
.choices__list {
    margin: 0;
    padding-left: 0;
    list-style: none;
}
.choices__list--single {
    display: inline-block;
    padding: 4px 16px 4px 4px;
    width: 100%;
}
[dir=rtl] .choices__list--single {
    padding-right: 4px;
    padding-left: 16px;
}
.choices__list--single .choices__item {
    width: 100%;
}
.choices__list--multiple {
    display: inline;
}
.choices__list--multiple .choices__item {
    display: inline-block;
    vertical-align: middle;
    border-radius: 50rem;
    padding: 0.2rem 0.65rem;
    font-size: 0.8rem;
    font-weight: 500;
    margin-right: 0.25rem;
    margin-bottom: 0.25rem;
    background-color: var(--app-accent-soft);
    border: 1px solid var(--bs-success-border-subtle);
    color: var(--app-accent-text);
    word-break: break-all;
    box-sizing: border-box;
}
.choices__list--multiple .choices__item[data-deletable] {
    padding-right: 5px;
}
[dir=rtl] .choices__list--multiple .choices__item {
    margin-right: 0;
    margin-left: 0.25rem;
}
.choices__list--multiple .choices__item.is-highlighted,
.is-disabled .choices__list--multiple .choices__item {
    background-color: var(--app-surface-3);
    border: 1px solid var(--app-border-strong);
    color: var(--app-text-2);
}
.choices__list--dropdown {
    visibility: hidden;
    /**
     * fix render with floating labels from bootstrap
     * (floating labels are z-index: 2;)
     */
    z-index: 3;
    position: absolute;
    width: 100%;
    background-color: var(--app-surface);
    border: 1px solid var(--app-border);
    top: 100%;
    margin-top: 0.25rem;
    border-radius: var(--app-radius-lg);
    box-shadow: var(--app-shadow-lg);
    overflow: hidden;
    word-break: break-all;
    will-change: visibility;
}
.choices__list--dropdown.is-active {
    visibility: visible;
}
.is-flipped .choices__list--dropdown {
    top: auto;
    bottom: 100%;
    margin-top: 0;
    margin-bottom: 0.25rem;
}
.choices__list--dropdown .choices__list {
    padding: 0.35rem;
    position: relative;
    max-height: 300px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    will-change: scroll-position;
}
.choices__list--dropdown .choices__item {
    position: relative;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    border-radius: 0.5rem;
}
@media (min-width: 640px) {
    .choices__list--dropdown .choices__item--selectable {
        padding-right: 100px;
    }
    .choices__list--dropdown .choices__item--selectable::after {
        content: attr(data-select-text);
        font-size: 0.75rem;
        opacity: 0;
        position: absolute;
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
    }
    [dir=rtl] .choices__list--dropdown .choices__item--selectable {
        text-align: right;
        padding-left: 100px;
        padding-right: 10px;
    }
    [dir=rtl] .choices__list--dropdown .choices__item--selectable::after {
        right: auto;
        left: 10px;
    }
}
.choices__list--dropdown .choices__item--selectable.is-highlighted {
    background-color: var(--app-surface-2);
}
.choices__list--dropdown .choices__item--selectable.is-highlighted::after {
    opacity: 0.5;
}
.choices__item {
    cursor: default;
}
.choices__item--selectable {
    cursor: pointer;
}
.choices__item--disabled {
    cursor: not-allowed;
    user-select: none;
    opacity: 0.5;
}
.choices__heading {
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--app-border);
    color: var(--app-text-2);
}
.choices__button {
    text-indent: -9999px;
    appearance: none;
    border: 0;
    background-color: transparent;
    background-repeat: no-repeat;
    background-position: center;
    cursor: pointer;
}
.choices__button:focus {
    outline: 0;
}
.choices__input {
    display: inline-block;
    vertical-align: baseline;
    margin-bottom: 0;
    border: 0;
    background-color: transparent;
    color: var(--app-text);
    font-size: 0.9rem;
    border-radius: 0;
    max-width: 100%;
    padding: 4px 0 4px 2px;
}
.choices__input:focus {
    outline: 0;
}
[dir=rtl] .choices__input {
    padding-right: 2px;
    padding-left: 0;
}
.choices__placeholder {
    opacity: 0.5;
}
[data-bs-theme=dark] .choices[data-type*=select-one] .choices__button,
[data-bs-theme=dark] .choices[data-type*=select-multiple] .choices__button,
[data-bs-theme=dark] .choices[data-type*=text] .choices__button {
    filter: invert(1) grayscale(100%) brightness(200%);
}
[data-bs-theme=dark] .choices.is-disabled .choices__button {
    display: none;
}
