/* Style Choices.js dropdowns to match form-control inputs */
.choices__inner {
    display: block !important;
    width: 100% !important;
    padding: 0.5rem 1rem !important;
    font-size: 0.875rem !important;
    font-weight: 400 !important;
    line-height: 1.5 !important;
    color: var(--bs-body-color) !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    background-color: var(--bs-secondary-bg) !important;
    background-clip: padding-box !important;
    border: var(--bs-border-width) solid var(--bs-input-border-color) !important;
    border-radius: 0.3rem !important;
    -webkit-transition: border-color 0.15s ease-in-out, -webkit-box-shadow 0.15s ease-in-out !important;
    transition: border-color 0.15s ease-in-out, -webkit-box-shadow 0.15s ease-in-out !important;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out !important;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, -webkit-box-shadow 0.15s ease-in-out !important;
}

.choices__inner:focus {
    color: var(--bs-body-color) !important;
    background-color: var(--bs-secondary-bg) !important;
    border-color: var(--bs-input-focus-border-color) !important;
    outline: 0 !important;
    box-shadow: none !important;
}

.choices__inner:hover:not(.is-focused) {
    border-color: #adb5bd !important;
}

/* Style remove buttons in multi-select Choices.js dropdowns */
.choices__list--multiple .choices__item {
    background-color: #e9ecef !important;
    border: 1px solid #ced4da !important;
    border-radius: 0.25rem !important;
    color: #495057 !important;
    padding: 0.25rem 0.5rem !important;
    margin: 0.125rem !important;
    display: inline-flex !important;
    align-items: center !important;
    font-size: 0.875rem !important;
    position: relative !important;
}

.choices__list--multiple .choices__item.is-highlighted {
    background-color: #d1ecf1 !important;
    border-color: #bee5eb !important;
}

.choices__list--multiple .choices__item .choices__button {
    background: none !important;
    border: none !important;
    color: #6c757d !important;
    cursor: pointer !important;
    padding: 0 !important;
    margin-left: 0.25rem !important;
    font-size: 1em !important;
    line-height: 1 !important;
    width: auto !important;
    height: auto !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 0.125rem !important;
    transition: color 0.15s ease-in-out !important;
}

.choices__list--multiple .choices__item .choices__button:hover,
.choices__list--multiple .choices__item .choices__button:focus {
    color: #495057 !important;
    background-color: rgba(108, 117, 125, 0.1) !important;
}

.choices__list--multiple .choices__item .choices__button:before {
    content: "×" !important;
    font-size: 1.2em !important;
    font-weight: bold !important;
}


/* Style dropdown options when the dropdown is open */
.choices__list--dropdown .choices__item {
    background-color: #fff !important;
    color: #495057 !important;
    padding: 0.5rem 0.75rem 0.5rem 1rem !important;
    font-size: 0.875rem !important;
    border: none !important;
    cursor: pointer !important;
    transition: background-color 0.15s ease-in-out !important;
}

.choices__list--dropdown .choices__item:hover,
.choices__list--dropdown .choices__item.is-highlighted {
    background-color: #f8f9fa !important;
    color: #495057 !important;
}

.choices__list--dropdown .choices__item--selectable.is-highlighted {
    background-color: #007bff !important;
    color: #fff !important;
}

/* Style the dropdown list container */
.choices__list--dropdown {
    background-color: #fff !important;
    border: 1px solid #ced4da !important;
    border-top: none !important;
    border-radius: 0 0 0.25rem 0.25rem !important;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
    max-height: 200px !important;
    overflow-y: auto !important;
}

/* Ensure proper spacing and appearance */
.choices.is-open .choices__list--dropdown {
    border-color: #80bdff !important;
}

/* Dark theme styles */
html[data-bs-theme="dark"] .choices__inner {
    color: var(--bs-body-color) !important;
    background-color: var(--bs-secondary-bg) !important;
    border-color: var(--bs-input-border-color) !important;
}

html[data-bs-theme="dark"] .choices__inner:focus {
    color: var(--bs-body-color) !important;
    background-color: var(--bs-secondary-bg) !important;
    border-color: var(--bs-input-focus-border-color) !important;
    box-shadow: none !important;
}

@media (prefers-reduced-motion: reduce) {
    .choices__inner {
        -webkit-transition: none !important;
        transition: none !important;
    }
}

html[data-bs-theme="dark"] .choices__inner:hover:not(.is-focused) {
    border-color: var(--bs-gray-600) !important;
}

html[data-bs-theme="dark"] .choices__list--multiple .choices__item {
    background-color: var(--bs-gray-800) !important;
    border-color: var(--bs-border-color) !important;
    color: var(--bs-body-color) !important;
}

html[data-bs-theme="dark"] .choices__list--multiple .choices__item.is-highlighted {
    background-color: var(--bs-info-bg-subtle) !important;
    border-color: var(--bs-info-border-subtle) !important;
}

html[data-bs-theme="dark"] .choices__list--multiple .choices__item .choices__button {
    color: var(--bs-secondary-color) !important;
}

html[data-bs-theme="dark"] .choices__list--multiple .choices__item .choices__button:hover,
html[data-bs-theme="dark"] .choices__list--multiple .choices__item .choices__button:focus {
    color: var(--bs-body-color) !important;
    background-color: rgba(var(--bs-secondary-rgb), 0.1) !important;
}

html[data-bs-theme="dark"] .choices__list--multiple .choices__item .choices__button:hover,
html[data-bs-theme="dark"] .choices__list--multiple .choices__item .choices__button:focus {
    color: var(--bs-body-color) !important;
    background-color: rgba(var(--bs-secondary-rgb), 0.1) !important;
}

html[data-bs-theme="dark"] .choices__list--dropdown .choices__item {
    background-color: var(--bs-body-bg) !important;
    color: var(--bs-body-color) !important;
}

html[data-bs-theme="dark"] .choices__list--dropdown .choices__item:hover,
html[data-bs-theme="dark"] .choices__list--dropdown .choices__item.is-highlighted {
    background-color: var(--bs-gray-800) !important;
    color: var(--bs-body-color) !important;
}

html[data-bs-theme="dark"] .choices__list--dropdown .choices__item--selectable.is-highlighted {
    background-color: var(--bs-primary) !important;
    color: var(--bs-white) !important;
}

html[data-bs-theme="dark"] .choices__list--dropdown {
    background-color: var(--bs-body-bg) !important;
    border-color: var(--bs-border-color) !important;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.15) !important;
}

html[data-bs-theme="dark"] .choices.is-open .choices__list--dropdown {
    border-color: var(--bs-primary) !important;
}

/* Dark theme styles for choices input */
html[data-bs-theme="dark"] .choices__input {
    background-color: var(--bs-body-bg) !important;
    color: var(--bs-body-color) !important;
}

html[data-bs-theme="dark"] .choices__input::placeholder {
    color: var(--bs-secondary-color) !important;
}

html[data-bs-theme="dark"] .choices__input::-webkit-input-placeholder {
    color: var(--bs-secondary-color) !important;
}

html[data-bs-theme="dark"] .choices__input::-moz-placeholder {
    color: var(--bs-secondary-color) !important;
}

html[data-bs-theme="dark"] .choices__input:-ms-input-placeholder {
    color: var(--bs-secondary-color) !important;
}

html[data-bs-theme="dark"] .choices__input::-ms-input-placeholder {
    color: var(--bs-secondary-color) !important;
}