/**
 * Global Select2 / searchable select styles
 * Use with Select2 (https://select2.org). Load after select2.min.css.
 * Applied on admin and student layouts for consistent UI.
 */

/* Trigger (single select) – vertical alignment for text, clear (X), and arrow */
.select2-container--default .select2-selection--single {
    height: var(--ee-control-height, 42px);
    min-height: var(--ee-control-height, 42px);
    padding: 0 12px;
    border-radius: var(--ee-radius, 5px);
    border: 1px solid rgb(226 232 240);
    transition: border-color 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    position: relative;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    padding: 0 1.75rem 0 0;
    line-height: calc(var(--ee-control-height, 42px) - 2px);
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: auto;
    top: 50%;
    transform: translateY(-50%);
    bottom: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}
.select2-container--default .select2-selection--single .select2-selection__arrow b {
    margin: 0;
    top: auto;
    border-width: 5px 4px 0 4px;
}
.select2-container--default .select2-selection--single .select2-selection__clear {
    position: absolute;
    right: 1.75rem;
    top: 50%;
    transform: translateY(-50%);
    float: none;
    height: auto;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
    width: 1.25rem;
}
.select2-container--default.select2-container--focus .select2-selection--single {
    outline: none !important;
    box-shadow: none !important;
}
.dark .select2-container--default .select2-selection--single {
    border-color: rgb(75 85 99);
    background: rgb(31 41 55);
}
.dark .select2-container--default.select2-container--focus .select2-selection--single {
    box-shadow: none !important;
}

/* Dropdown panel */
.select2-container--default .select2-dropdown {
    border: 1px solid rgb(226 232 240);
    border-radius: var(--ee-radius, 5px);
    box-shadow: 0 10px 25px rgb(0 0 0 / 0.1);
}
.dark .select2-container--default .select2-dropdown {
    border-color: rgb(71 85 105);
    background: rgb(30 41 59);
}

/* Search box at top of dropdown */
.select2-container--default .select2-search--dropdown {
    padding: 8px;
    border-bottom: 1px solid rgb(226 232 240);
}
.dark .select2-container--default .select2-search--dropdown {
    border-bottom-color: rgb(51 65 85);
}
.select2-container--default .select2-search__field {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid rgb(226 232 240);
    border-radius: var(--ee-radius, 5px);
    font-size: 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.select2-container--default .select2-search__field:focus,
.select2-container--default .select2-search__field:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}
.select2-container--default .select2-search__field::placeholder {
    color: rgb(148 163 184);
}
.dark .select2-container--default .select2-search__field {
    border-color: rgb(71 85 105);
    background: rgb(51 65 85);
    color: rgb(248 250 252);
}
.dark .select2-container--default .select2-search__field:focus,
.dark .select2-container--default .select2-search__field:focus-visible {
    box-shadow: none !important;
}

/* Results list */
.select2-container--default .select2-results__option {
    padding: 8px 12px;
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background: rgb(241 245 249);
    color: rgb(30 27 75);
}
.dark .select2-container--default .select2-results__option--highlighted[aria-selected] {
    background: rgb(51 65 85);
    color: rgb(248 250 252);
}
.select2-container--default .select2-results__options {
    max-height: 220px;
}

/* Ensure search is always shown – use minimumResultsForSearch: 0 in JS */
.select2-container--default .select2-search--dropdown .select2-search__field {
    display: block;
}

/*
 * Global select rules (height/padding !important on select.w-full) were
 * un-hiding Select2's original <select>, which painted a second box under the field.
 */
select.select2-hidden-accessible,
:is(#admin-body, #student-body) select.select2-hidden-accessible {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: -1px !important;
    border: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
}

/* Optional: wrapper for fixed width (e.g. .filter-role-wrap) */
.select-search-wrap .select2-container {
    min-width: 200px;
    width: 100% !important;
}

/* In filter rows, give select search a comfortable width */
.users-mgmt-filter-row .filter-role-wrap .select2-container {
    min-width: 200px;
    width: 220px !important;
}
