/* Dropdown-only styling shared by ERP, clinic portals and store administration. */
/* The body-attached positioning span must not inherit the full-width field rule.
   In LTR it otherwise creates horizontal document overflow beyond the popup. */
/* The alignment transform creates a stacking context: elevate the outer portal,
   so sticky table headings cannot paint above its dropdown child. */
.select2-container.erp-searchable-positioner { width: auto !important; min-width: 0; max-width: none; z-index: 1060; }
/* The bundled Select2 adds mb-4 to every generated container. Field spacing belongs
   to the surrounding form/grid, not to this control (including flex toolbars). */
.erp-searchable-select.select2-container { max-width: 100%; min-width: 0; margin: 0 !important; vertical-align: middle; font-family: inherit; }
.erp-searchable-select.select2-container .select2-selection {
    min-height: 42px; border: 1px solid #dbe3ec; border-radius: 10px;
    background: #fff; color: #182238; transition: border-color .15s, box-shadow .15s;
}
.erp-searchable-select .select2-selection--single { position: relative; display: flex; align-items: center; height: 42px; }
.erp-searchable-select.select2-container .select2-selection--single .select2-selection__rendered {
    border: 0; background: transparent; height: auto; line-height: 1.5;
    padding-inline: 12px 44px; color: #182238; font-size: .9rem;
}
.erp-searchable-select.select2-container--default .select2-selection--single .select2-selection__arrow { top: 1px !important; height: calc(100% - 2px) !important; transform: none; }
.erp-searchable-select.select2-container--focus .select2-selection,
.erp-searchable-select.select2-container--open .select2-selection {
    border-color: var(--erp-field-border-focus, #2878b8); box-shadow: 0 0 0 3px var(--erp-field-focus-ring, #2878b81a);
}
.erp-searchable-select.select2-container--disabled .select2-selection { background: #f3f5f8; color: #64748b; cursor: not-allowed; }
.erp-searchable-select [aria-invalid="true"] { border-color: #be3544 !important; }
.erp-searchable-select--small.select2-container .select2-selection { min-height: 34px; height: 34px; border-radius: 8px; }
.erp-searchable-select--small.select2-container--default .select2-selection--single .select2-selection__arrow { width: 26px !important; }
.erp-searchable-select--small.select2-container--default .select2-selection--single .select2-selection__rendered { padding-inline-end: 35px !important; }
.erp-searchable-select .select2-selection--multiple { padding: 3px 8px; height: auto; }
.erp-searchable-select .select2-selection--multiple .select2-selection__choice { border-radius: 6px; border-color: #dbe3ec; background: #f0f5fa; color: #182238; }
.select2-container .erp-searchable-dropdown {
    border: 1px solid #dbe3ec; border-radius: 12px; overflow: hidden;
    box-shadow: 0 12px 32px #18223824; font-family: inherit; color: #182238; background: #fff;
    max-width: calc(100vw - 16px);
}
.erp-searchable-dropdown .select2-search--dropdown { display: block; padding: 10px; border-bottom: 1px solid #edf1f5; background: #fafbfd; }
.erp-searchable-dropdown .select2-search--dropdown .select2-search__field {
    width: 100%; height: 38px; padding: 6px 12px; border: 1px solid #ccd8e5;
    border-radius: 8px; outline: none; background: #fff; color: #182238; font: inherit; font-size: .9rem;
}
.erp-searchable-dropdown .select2-search__field:focus { border-color: var(--erp-field-border-focus, #2878b8); box-shadow: 0 0 0 2px #2878b814; }
.erp-searchable-dropdown .select2-results > .select2-results__options { max-height: min(300px, 45vh); overscroll-behavior: contain; }
.erp-searchable-dropdown .select2-results__option { padding: 10px 12px; line-height: 1.5; font-size: .9rem; overflow-wrap: anywhere; }
.erp-searchable-dropdown .select2-results__option[aria-selected="true"] { background: #eaf2f9; color: #164b75; font-weight: 600; }
.erp-searchable-dropdown .select2-results__option--highlighted[aria-selected] { background: var(--erp-option-hover-bg, #edf7f2); color: var(--erp-option-hover-color, #174d38); }
.erp-searchable-dropdown .select2-results__option[aria-disabled="true"] { color: #738094; background: #f7f8fa; }
.erp-searchable-dropdown .select2-results__message { text-align: center; padding: 20px 12px; color: #52637a; }
@media (max-width: 576px) {
    .erp-searchable-dropdown .select2-search__field { font-size: 16px !important; }
    .erp-searchable-dropdown .select2-results__option { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) { .erp-searchable-select .select2-selection { transition: none; } }
.erp-searchable-dropdown.employee-table-dropdown .select2-results { overflow-x: auto; }
.erp-searchable-dropdown.employee-table-dropdown .employee-picker-head,
.erp-searchable-dropdown.employee-table-dropdown .employee-picker-row { min-width: 540px; }

/* Table page-size controls stay compact, including Select2's generated field. */
:root body :is(.dataTables_length, .dt-length) label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 0;
    font-size: 12px;
    white-space: nowrap;
}
:root body :is(.dataTables_length, .dt-length) select:not(.select2-hidden-accessible),
:root body :is(.dataTables_length, .dt-length) .select2-container {
    width: 76px !important;
    min-width: 76px !important;
    max-width: 76px !important;
    margin: 0 !important;
    vertical-align: middle;
    flex: 0 0 76px;
}
:root body :is(.dataTables_length, .dt-length) select:not(.select2-hidden-accessible) {
    height: 30px !important;
    min-height: 30px !important;
    padding-block: 3px !important;
    padding-inline: 8px 24px !important;
    border-radius: 6px !important;
    font-size: 12px !important;
    line-height: 1.5 !important;
}
:root body :is(.dataTables_length, .dt-length) .select2-container .select2-selection--single {
    height: 30px !important;
    min-height: 30px !important;
    padding: 0 !important;
    border-radius: 6px !important;
}
:root body :is(.dataTables_length, .dt-length) .select2-container .select2-selection--single .select2-selection__rendered {
    height: auto !important;
    width: 100%;
    line-height: 28px !important;
    padding-inline: 8px 26px !important;
    font-size: 12px !important;
    white-space: nowrap;
}
:root body :is(.dataTables_length, .dt-length) .select2-container .select2-selection--single .select2-selection__arrow {
    width: 22px !important;
    height: 28px !important;
    top: 0 !important;
}
