/* Select2 default theme, sized and coloured to sit with Bootstrap 5 form controls.
   Load AFTER select2.min.css. No select2-bootstrap theme.
   Sizes follow the AbStack .form-control (0.875rem text, 0.5rem vertical padding, 0.3rem
   radius) so a picker is the same height as the text field beside it. */
.select2-container { width: 100% !important; font-size: .875rem; }
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
  min-height: calc(1.5em + 1rem + 2px);
  border: 1px solid #ced4da;
  border-radius: .3rem;
  background: #fff;
}
.select2-container--default .select2-selection--single .select2-selection__rendered { line-height: calc(1.5em + 1rem); padding-left: .77rem; color: var(--abstack-body-color, #212529); }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: calc(1.5em + 1rem); right: 6px; }
.select2-container--default .select2-selection--multiple { padding: 0 .375rem .25rem; }
.select2-container--default .select2-selection--multiple .select2-selection__choice { margin: .25rem .25rem 0 0; }
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--open .select2-selection--multiple,
.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default .select2-selection--single:focus {
  border-color: #86b7fe; box-shadow: 0 0 0 .25rem rgba(13,110,253,.25); outline: 0;
}
/* Select2 4.1 renders the inline search as a <textarea>: undo app-wide input/textarea/.form-control styles */
.select2-container .select2-search--inline .select2-search__field {
  border: 0 !important; outline: 0 !important; box-shadow: none !important; background: transparent !important;
  height: 1.5rem; min-height: 0; margin: .375rem 0 0 .25rem; padding: 0; resize: none; overflow: hidden;
  font: inherit; line-height: 1.5rem; vertical-align: top; color: var(--abstack-body-color, #212529);
}
.select2-dropdown { border-color: #ced4da; border-radius: .375rem; overflow: hidden; z-index: 1056; }
.select2-container--open .select2-dropdown--below { margin-top: 2px; border-top: 1px solid #ced4da; }
.select2-container--open .select2-dropdown--above { margin-top: -2px; border-bottom: 1px solid #ced4da; }
.select2-container--default .select2-search--dropdown .select2-search__field { border-color: #ced4da; border-radius: .25rem; padding: .25rem .5rem; }
.select2-container--default .select2-search--dropdown .select2-search__field:focus { outline: 0; border-color: #86b7fe; box-shadow: 0 0 0 .2rem rgba(13,110,253,.25); }
.select2-results__option { padding: .375rem .75rem; }
.select2-container--default .select2-results > .select2-results__options { max-height: 15rem; }
/* The × is sized in rem, not em: em would follow its own 1.25rem font and overflow the box. */
.select2-container--default .select2-selection--single .select2-selection__clear { height: calc(1.3125rem + 1rem); margin-right: 1.5rem; color: #6c757d; font-weight: 400; font-size: 1.25rem; line-height: calc(1.3125rem + 1rem); }
/* Placeholders in the theme's .form-control::placeholder colour, single and multiple alike. */
.select2-container--default .select2-selection__placeholder { color: var(--abstack-secondary-color, #6c757d); }
.select2-container .select2-search--inline .select2-search__field::placeholder { color: var(--abstack-secondary-color, #6c757d); opacity: 1; }

/* ── App additions on top of the target look ─────────────────────────────── */

/* The original <select> sits immediately before its container, so its Bootstrap
   validation class reaches the visible box without any JS. */
select.is-invalid + .select2-container--default .select2-selection { border-color: #dc3545; }
select.is-invalid + .select2-container--default.select2-container--focus .select2-selection,
select.is-invalid + .select2-container--default.select2-container--open .select2-selection {
  border-color: #dc3545; box-shadow: 0 0 0 .25rem rgba(220,53,69,.25);
}

/* Disabled: the form-control disabled grey, not Select2's #eee. */
.select2-container--default.select2-container--disabled .select2-selection--single,
.select2-container--default.select2-container--disabled .select2-selection--multiple { background-color: #e9ecef; }

/* Tags: wrap onto as many lines as they need rather than clipping to one. */
.select2-container--default .select2-selection--multiple .select2-selection__rendered { white-space: normal; }

/* Small variant, for selects marked form-select-sm (table rows, filter bars): .form-control-sm. */
.select2-container--default .select2-selection--single.select2-selection--sm,
.select2-container--default .select2-selection--multiple.select2-selection--sm {
  min-height: calc(1.5em + .6rem + 2px); font-size: .85rem; border-radius: .25rem;
}
.select2-container--default .select2-selection--single.select2-selection--sm .select2-selection__rendered { line-height: calc(1.5em + .6rem); }
.select2-container--default .select2-selection--single.select2-selection--sm .select2-selection__arrow { height: calc(1.5em + .6rem); }
.select2-container--default .select2-selection--single.select2-selection--sm .select2-selection__clear { height: calc(1.275rem + .6rem); line-height: calc(1.275rem + .6rem); }
.select2-container--default .select2-selection--sm .select2-search--inline .select2-search__field { margin-top: .25rem; }
