/* ERP searchable select (Choices.js) — scoped to .erp-choices */
.erp-choices.choices {
    margin-bottom: 0;
    font-size: 0.875rem;
}

.erp-choices .choices__inner {
    min-height: 38px;
    padding-block: 0.4rem !important;
    padding-inline: 0.75rem !important;
    border-radius: 0.375rem !important;
    border: 1px solid var(--bs-border-color, #dee2e6) !important;
    background-color: #fff !important;
    line-height: 1.5 !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.erp-choices.is-focused .choices__inner,
.erp-choices.is-open .choices__inner {
    border-color: #15487B !important;
    box-shadow: 0 0 0 0.2rem rgba(21, 72, 123, 0.12) !important;
}

.erp-choices.is-open .choices__inner {
    border-end-end-radius: 0 !important;
    border-end-start-radius: 0 !important;
}

.erp-choices .choices__list--single {
    padding: 0 !important;
}

.erp-choices .choices__list--single .choices__item {
    color: #212529;
}

.erp-choices .choices__placeholder {
    opacity: 0.55;
    color: #6c757d;
}

.erp-choices[data-type*="select-one"]::after {
    border-color: #6c757d transparent transparent !important;
    margin-top: -2px;
}

/* Dropdown panel */
.erp-choices .choices__list--dropdown,
.erp-choices .choices__list[aria-expanded] {
    margin-top: -1px !important;
    border: 1px solid #15487B !important;
    border-start-start-radius: 0 !important;
    border-start-end-radius: 0 !important;
    border-end-end-radius: 0.375rem !important;
    border-end-start-radius: 0.375rem !important;
    background-color: #fff !important;
    box-shadow: 0 8px 20px rgba(21, 72, 123, 0.1) !important;
    z-index: 1060 !important;
    overflow: hidden;
}

.erp-choices .choices__list--dropdown .choices__list,
.erp-choices .choices__list[aria-expanded] .choices__list {
    max-height: 240px !important;
    padding-block: 0.25rem;
}

/* Search input inside dropdown */
.erp-choices[data-type*="select-one"] .choices__input,
.erp-choices .choices__list--dropdown .choices__input {
    display: block;
    width: 100% !important;
    margin: 0 !important;
    padding: 0.55rem 0.75rem !important;
    border: none !important;
    border-block-end: 1px solid #e9edf4 !important;
    border-radius: 0 !important;
    background-color: #f8f9fb !important;
    color: #212529 !important;
    font-size: 0.875rem !important;
    line-height: 1.4 !important;
    box-shadow: none !important;
    outline: none !important;
    -webkit-appearance: none;
    appearance: none;
}

.erp-choices[data-type*="select-one"] .choices__input:focus,
.erp-choices .choices__list--dropdown .choices__input:focus {
    border-block-end-color: #15487B !important;
    background-color: #fff !important;
    outline: none !important;
    box-shadow: none !important;
}

.erp-choices .choices__input::placeholder {
    color: #9aa3af;
    opacity: 1;
}

/* Options */
.erp-choices .choices__list--dropdown .choices__item,
.erp-choices .choices__list[aria-expanded] .choices__item {
    padding: 0.5rem 0.75rem !important;
    font-size: 0.875rem;
    text-align: start;
    border-radius: 0;
    transition: background-color 0.12s ease, color 0.12s ease;
}

.erp-choices .choices__list--dropdown .choices__item--selectable.is-highlighted,
.erp-choices .choices__list[aria-expanded] .choices__item--selectable.is-highlighted {
    background-color: rgba(21, 72, 123, 0.08) !important;
    color: #15487B !important;
}

.erp-choices .choices__list--dropdown .choices__item--selectable.is-selected,
.erp-choices .choices__list[aria-expanded] .choices__item--selectable.is-selected {
    color: #15487B !important;
    font-weight: 600;
}

.erp-choices .choices__list--dropdown .choices__item--selectable.is-selected.is-highlighted,
.erp-choices .choices__list[aria-expanded] .choices__item--selectable.is-selected.is-highlighted {
    background-color: #15487B !important;
    color: #fff !important;
}

.erp-choices .choices__list--dropdown .choices__item--selectable[data-choice-disabled],
.erp-choices .choices__list[aria-expanded] .choices__item--selectable[data-choice-disabled] {
    opacity: 0.5;
}

/* Invalid state */
.erp-search-select.is-invalid + .erp-choices .choices__inner {
    border-color: #dc3545 !important;
}

/* RTL */
[dir="rtl"] .erp-choices .choices__inner,
body.rtl .erp-choices .choices__inner {
    text-align: right;
}

[dir="rtl"] .erp-choices .choices__list--dropdown .choices__item,
[dir="rtl"] .erp-choices .choices__list[aria-expanded] .choices__item,
body.rtl .erp-choices .choices__list--dropdown .choices__item,
body.rtl .erp-choices .choices__list[aria-expanded] .choices__item {
    text-align: right;
}

[dir="rtl"] .erp-choices .choices__input,
body.rtl .erp-choices .choices__input {
    text-align: right;
}

[dir="rtl"] .erp-choices[data-type*="select-one"]::after,
body.rtl .erp-choices[data-type*="select-one"]::after {
    left: 0.75rem;
    right: auto;
}

/* Compact variant (filters) */
.erp-choices.erp-choices--sm .choices__inner {
    min-height: 31px;
    padding-block: 0.2rem !important;
    font-size: 0.8125rem !important;
}

@media (max-width: 575.98px) {
    .erp-choices .choices__list--dropdown .choices__list,
    .erp-choices .choices__list[aria-expanded] .choices__list {
        max-height: 200px !important;
    }
}
