/* ============================================================================
   TDMS — Select2 skin
   ----------------------------------------------------------------------------
   Split out of tdms.css so the auth screens (layouts/auth.blade.php), which
   deliberately do not load the whole admin design system, still get the same
   dropdowns as the rest of TDMS. Loaded by both layouts.
   ============================================================================ */

/* These files load without tdms.css on the auth screens, so the two brand
   tokens they use are declared here as well. Same values as tdms.css — a
   redeclaration, not a second source of truth. */
:root {
    --tdms-navy: #0B2A63;
    --tdms-navy-dark: #082050;
}

/* The control borrows its metrics from the form it sits in: the admin shell
   uses 38px/6px fields, the auth screens 50px/10px. Override these on an
   ancestor instead of restating the rules. */
:root {
    --tdms-s2-height: 38px;
    --tdms-s2-radius: 6px;
    --tdms-s2-pad-x: .75rem;
    --tdms-s2-font: .875rem;
    --tdms-s2-ring: 0 0 0 3px rgba(18, 59, 132, .12);
}

/* ============================================================
   Select2 → TDMS skin
   ------------------------------------------------------------
   Replaces the vendor's purple highlight with the neutral hover and navy
   selected state, and matches .form-select height and border so a select2
   sitting next to a native select stays aligned.
   ============================================================ */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    min-height: var(--tdms-s2-height);
    border: 1px solid #D0D5DD;
    border-radius: var(--tdms-s2-radius);
    background: #fff;
}

.select2-container--default .select2-selection--single { height: var(--tdms-s2-height); }

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--multiple {
    border-color: #123B84;
    box-shadow: var(--tdms-s2-ring);
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    padding: 0 2.25rem 0 var(--tdms-s2-pad-x);
    /* Two borders shorter than the control, so the text sits centred. */
    line-height: calc(var(--tdms-s2-height) - 2px);
    font-size: var(--tdms-s2-font);
    color: #101828;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder,
.select2-container--default .select2-selection--multiple .select2-search__field::placeholder { color: #8A94A6; }

/* One chevron, drawn from the icon font, instead of the CSS triangle. */
.select2-container--default .select2-selection--single .select2-selection__arrow {
    top: 0;
    right: 0;
    width: 2.25rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b { display: none; }

.select2-container--default .select2-selection--single .select2-selection__arrow::after {
    font-family: "tabler-icons";
    content: "\ea5f";
    font-size: 16px;
    color: #8A94A6;
    transition: transform .15s ease;
}

.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow::after { transform: rotate(180deg); }

.select2-container--default .select2-selection--single .select2-selection__clear {
    height: 36px;
    margin-right: 1.75rem;
    color: #98A2B3;
    font-weight: 400;
}

/* ---- Multi-select: chips reuse the badge palette ---- */
.select2-container--default .select2-selection--multiple .select2-selection__rendered {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    padding: .25rem .5rem;
    margin: 0;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    margin: 0;
    padding: .125rem .5rem;
    border: 0;
    border-radius: 999px;
    background: #EEF2F8;
    color: var(--tdms-navy);
    font-size: .75rem;
    font-weight: 600;
    line-height: 1.5;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    order: 2;
    margin: 0 -.125rem 0 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--tdms-navy);
    font-size: 0;
    opacity: .55;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove::before {
    font-family: "tabler-icons";
    content: "\eb55";
    font-size: 13px;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    background: transparent;
    color: var(--tdms-navy);
    opacity: 1;
}

.select2-container--default .select2-selection--multiple .select2-search__field {
    margin: 0;
    height: 26px;
    font-size: .875rem;
    color: #101828;
}

/* ---- Dropdown ---- */
.select2-container--default .select2-dropdown {
    padding: 4px;
    border: 1px solid #EAECF0;
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(16, 24, 40, .12);
}

.select2-container--default .select2-search--dropdown { padding: 2px 2px 6px; }

.select2-container--default .select2-search--dropdown .select2-search__field {
    height: 34px;
    padding: 0 .625rem;
    border: 1px solid #D0D5DD;
    border-radius: 6px;
    font-size: .875rem;
    color: #101828;
}

.select2-container--default .select2-search--dropdown .select2-search__field:focus {
    outline: 0;
    border-color: #123B84;
    box-shadow: 0 0 0 3px rgba(18, 59, 132, .12);
}

.select2-container--default .select2-results__options { max-height: 260px; }

.select2-container--default .select2-results__option {
    padding: .4375rem .625rem;
    border-radius: 6px;
    font-size: .84375rem;
    color: #344054;
}

/* The vendor ships the purple highlight with !important, so this must match it. */
.select2-container--default .select2-results__option--highlighted:not([aria-selected=true]),
.select2-results__option--highlighted:not([aria-selected=true]) {
    background-color: #F2F4F7 !important;
    color: #101828 !important;
}

.select2-container--default .select2-results__option[aria-selected=true],
.select2-results__option[aria-selected=true] {
    background-color: #EEF2F8;
    color: var(--tdms-navy);
    font-weight: 600;
}

.select2-container--default .select2-results__option[aria-disabled=true] { color: #98A2B3; }

.select2-container--default .select2-results__group {
    display: block;
    padding: .5rem .625rem .25rem;
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #98A2B3;
}

.select2-container--default .select2-results__message { padding: .5rem .625rem; font-size: .84375rem; color: #8A94A6; }

/* Invalid control keeps the red border of the field it replaces. */
.is-invalid + .select2-container--default .select2-selection--single,
.is-invalid + .select2-container--default .select2-selection--multiple,
.tdms-form .has-error + .select2-container .select2-selection { border-color: #D6001C; }

/* Dropdowns opened from inside a modal have to clear it. */
.select2-container--open { z-index: 99999 !important; }
