/* Select2 Picker - shared Select2 styling (formerly flow-entity-select.css).
   The .select2-result-entity* class names are referenced by select2-picker.js templates. */

.select2-result-entity {
    padding: 0.25rem 0;
    /* Rows must never force horizontal scrolling: long names/emails truncate so the
       trailing badge (compliance state) stays visible inside narrow dropdowns (e.g. the
       assignments-table cell pickers). */
    max-width: 100%;
    overflow: hidden;
}

/* The left column (name + secondary line) yields space to the badge and truncates. */
.select2-result-entity > div {
    min-width: 0;
    flex: 1 1 auto;
}

.select2-result-entity__name {
    font-weight: 500;
    color: #212529;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.select2-result-entity__info {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 0.15rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Badge column on the 'staff' template rows (compliance state etc.) - never crushed,
   never pushed off-screen. */
.select2-result-entity .badge {
    flex-shrink: 0;
    font-size: 0.7rem;
    white-space: nowrap;
}

/* Narrow hosts (table-cell pickers): give the dropdown a sensible floor so name + badge
   both fit; Select2 positions a dropdown wider than its control without issue. */
.select2-dropdown {
    min-width: 260px;
}

/* Belt and braces: options themselves never scroll horizontally. */
.select2-results__option {
    overflow-x: hidden;
}

/* Improve Select2 appearance to match Bootstrap 5 */
.select2-container--default .select2-selection--single {
    height: calc(1.5em + 0.75rem + 2px);
    border-color: #dee2e6;
    border-radius: 0.375rem;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: calc(1.5em + 0.75rem);
    padding-left: 0.75rem;
    color: #212529;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: calc(1.5em + 0.75rem + 2px);
}

.select2-container--default.select2-container--focus .select2-selection--single {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.select2-dropdown {
    border-color: #dee2e6;
    border-radius: 0.375rem;
}

.select2-search--dropdown .select2-search__field {
    border-color: #dee2e6;
    border-radius: 0.375rem;
}
