/* 🌑 Donker thema voor Select2 (Bootstrap 5) */

/* Algemene stijl voor de selectieknop */
.select2-container--bootstrap-5 .select2-selection {
    background-color: #343a40 !important; /* Donkere achtergrond */
    border: 1px solid #495057 !important; /* Bootstrap dark border */
    color: #ffffff !important; /* Witte tekst */
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    border-radius: 0.375rem; /* Bootstrap 5 standaard */
}

/* Tekst in de geselecteerde optie */
.select2-container--bootstrap-5 .select2-selection__rendered {
    color: #ffffff !important;
    line-height: 1.5;
}

/* Pijl-icoon aanpassen */
.select2-container--bootstrap-5 .select2-selection__arrow b {
    border-color: #ffffff transparent transparent transparent !important;
}

/* 🌙 Donkere dropdown */
.select2-container--bootstrap-5 .select2-dropdown {
    background-color: #212529 !important; /* Donkere dropdown achtergrond */
    border: 1px solid #495057 !important;
    color: #ffffff !important;
}

/* Opties in de dropdown */
.select2-container--bootstrap-5 .select2-results__option {
    background-color: #212529 !important;
    color: #ffffff !important;
    padding: 10px;
    font-size: 1rem;
}

/* Hover effect op opties */
.select2-container--bootstrap-5 .select2-results__option--highlighted {
    background-color: #495057 !important;
    color: #ffffff !important;
}

/* Zoekveld binnen de dropdown */
.select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field {
    background-color: #343a40 !important; /* Donkere zoekbalk */
    border: 1px solid #6c757d !important;
    color: #ffffff !important;
    padding: 0.5rem;
    border-radius: 0.375rem;
}

/* Placeholder voor zoekveld */
.select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field::placeholder {
    color: #b1b1b1 !important;
}

/* Disabled Select2 veld */
.select2-container--bootstrap-5.select2-container--disabled .select2-selection {
    background-color: #212529 !important;
    color: #6c757d !important;
    border-color: #6c757d !important;
}

/* ===========================
   SELECT2 DARK THEME FIX
   =========================== */

/* Container */
.select2-container--default .select2-selection--single {
    background-color: #1e1e1e;
    border: 1px solid #444;
    color: #fff;
    height: 38px;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #fff;
    line-height: 36px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: #ccc transparent transparent transparent;
}

/* Dropdown */
.select2-dropdown {
    background-color: #1e1e1e;
    border: 1px solid #444;
}

/* Result items */
.select2-results__option {
    background-color: #1e1e1e;
    color: #ddd;
}

/* Hover */
.select2-results__option--highlighted {
    background-color: #2a6df4 !important;
    color: #fff !important;
}

/* Selected */
.select2-results__option[aria-selected="true"] {
    background-color: #333;
    color: #fff;
}

/* Search field */
.select2-search--dropdown .select2-search__field {
    background-color: #121212;
    color: #fff;
    border: 1px solid #444;
}

/* Placeholder */
.select2-container--default .select2-selection__placeholder {
    color: #aaa;
}

/* Altijd 100% breed in bootstrap kolommen */
.select2-container { width: 100% !important; display: block; }

/* Hoogte gelijk aan bootstrap inputs */
.select2-container--default .select2-selection--single {
    height: 38px;
    display: flex;
    align-items: center;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 36px;
    width: 100%;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 36px;
}

.select2-container .searchable-select-selection {
    min-height: 44px;
}

.searchable-select-dropdown .select2-results__option {
    min-height: 44px;
    overflow-wrap: anywhere;
}

.searchable-select-dropdown .select2-search__field {
    min-height: 44px;
}

/* Shared readable results for choices with identifying details. */
.searchable-select-option__title,
.searchable-select-option__details {
    display: block;
    white-space: normal;
    overflow-wrap: anywhere;
}

.searchable-select-option__title {
    font-weight: 600;
}

.searchable-select-option__details {
    font-size: 0.875rem;
    opacity: 0.85;
    margin-top: 0.25rem;
}

.select2-container {
    max-width: 100%;
    min-width: 0;
}

.select2-result-product {
    line-height: 1.2;
}

.select2-result-product .badge {
    font-size: 0.7rem;
    vertical-align: middle;
}

/* Searchable dashboard selects: shared sizing, text alignment and focus states. */
.select2-container--bootstrap-5 .searchable-select-selection.select2-selection--single {
    display: flex;
    align-items: center;
    height: 44px;
    min-height: 44px;
    padding: 0 2.5rem 0 .75rem;
    background-color: #0f172a !important;
    border-color: rgba(148, 163, 184, .3) !important;
    border-radius: .5rem;
    font-size: .9375rem;
    position: relative;
}
.select2-container--bootstrap-5 .searchable-select-selection .select2-selection__rendered {
    display: block;
    width: 100%;
    padding: 0;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.select2-container--bootstrap-5 .searchable-select-selection .select2-selection__placeholder {
    color: var(--app-muted, #94a3b8);
}
.select2-container--bootstrap-5 .searchable-select-selection .select2-selection__arrow {
    top: 0;
    right: .75rem;
    height: 100%;
    width: 1rem;
}
.select2-container--bootstrap-5.select2-container--focus .searchable-select-selection,
.select2-container--bootstrap-5.select2-container--open .searchable-select-selection {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 .2rem rgba(59, 130, 246, .18);
}
.select2-container--bootstrap-5 .searchable-select-dropdown {
    background-color: #0f172a !important;
    border-color: rgba(148, 163, 184, .3) !important;
    border-radius: .5rem;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .4);
    overflow: hidden;
}
.select2-container--bootstrap-5 .searchable-select-dropdown .select2-search--dropdown {
    padding: .5rem;
}
.select2-container--bootstrap-5 .searchable-select-dropdown .select2-search__field {
    box-sizing: border-box;
    height: 44px;
    min-height: 44px;
    margin: 0;
    padding: .5rem .75rem;
    background-color: #111c30 !important;
    border-color: rgba(148, 163, 184, .3) !important;
    border-radius: .375rem;
    font-family: inherit;
    font-size: .9375rem;
    line-height: 1.5;
}
.select2-container--bootstrap-5 .searchable-select-dropdown .select2-results__option {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: .625rem .75rem;
    background-color: transparent !important;
    color: var(--app-text, #f8fafc) !important;
    font-size: .9375rem;
    line-height: 1.5;
    white-space: normal;
}
.select2-container--bootstrap-5 .searchable-select-dropdown .select2-results__option--selected,
.select2-container--bootstrap-5 .searchable-select-dropdown .select2-results__option[aria-selected="true"] {
    background-color: #1e293b !important;
}
.select2-container--bootstrap-5 .searchable-select-dropdown .select2-results__option--highlighted {
    background-color: #1d4ed8 !important;
}
.searchable-select-option { min-width: 0; width: 100%; }
.select2-container--bootstrap-5.select2-container--disabled .searchable-select-selection {
    opacity: .6;
    cursor: not-allowed;
}

/* Select2 appends an absolutely positioned dropdown wrapper to dropdownParent.
   A 100%-wide wrapper extends beyond the viewport by its left offset, even when
   the visible menu itself fits. Keep the controller's measured menu width. */
.select2-container--bootstrap-5:has(> .searchable-select-dropdown) {
    width: auto !important;
    max-width: calc(100vw - 1rem);
}
