/* Shared Select2 Bootstrap 5 overrides (visitor + blank-b5 + app BS5) */

.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
    border-color: var(--bs-primary);
    box-shadow: none !important;
}

.select2-container--bootstrap-5 .select2-selection {
    height: 38px !important;
    min-height: 38px !important;
    padding: 0.375rem 0.75rem !important;
    font-size: 1rem !important;
    line-height: 1.5 !important;
    border-radius: var(--bs-border-radius) !important;
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    line-height: calc(38px - (0.375rem * 2)) !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow {
    height: 38px !important;
}

.select2-selection[aria-expanded="true"] {
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

.select2-container--bootstrap-5 .select2-dropdown {
    border-color: var(--bs-primary);
    border-bottom-left-radius: var(--bs-border-radius) !important;
    border-bottom-right-radius: var(--bs-border-radius) !important;
}

.select2-container--bootstrap-5 .select2-dropdown .select2-search .select2-search__field {
    border-radius: var(--bs-border-radius) !important;
}

.select2-container--bootstrap-5 .select2-dropdown .select2-search .select2-search__field:focus {
    border-color: var(--bs-primary);
    border-radius: var(--bs-border-radius);
}

.select2-container--bootstrap-5 .select2-results__options .select2-results__option.select2-results__option--highlighted,
.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option.select2-results__option--highlighted {
    background-color: #e9ecef !important;
    color: var(--bs-dark) !important;
}

.select2-container--bootstrap-5:not(.select2-dropdown--multiple) .select2-results__options .select2-results__option.select2-results__option--selected,
.select2-container--bootstrap-5:not(.select2-dropdown--multiple) .select2-results__options .select2-results__option[aria-selected=true]:not(.select2-results__option--highlighted),
.select2-container--bootstrap-5 .select2-dropdown:not(.select2-dropdown--multiple) .select2-results__options .select2-results__option.select2-results__option--selected,
.select2-container--bootstrap-5 .select2-dropdown:not(.select2-dropdown--multiple) .select2-results__options .select2-results__option[aria-selected=true]:not(.select2-results__option--highlighted) {
    background-color: transparent !important;
    color: var(--bs-body-color, #212529) !important;
}

.select2-container--bootstrap-5.select2-dropdown--multiple .select2-results__options .select2-results__option.select2-results__option--selected,
.select2-container--bootstrap-5.select2-dropdown--multiple .select2-results__options .select2-results__option[aria-selected=true]:not(.select2-results__option--highlighted),
.select2-container--bootstrap-5 .select2-dropdown.select2-dropdown--multiple .select2-results__options .select2-results__option.select2-results__option--selected,
.select2-container--bootstrap-5 .select2-dropdown.select2-dropdown--multiple .select2-results__options .select2-results__option[aria-selected=true]:not(.select2-results__option--highlighted) {
    background-color: #e9ecef !important;
    color: var(--bs-body-color, #212529) !important;
}

/* Multi-select dropdown only: reserve space + primary check for selected options. */
.select2-container--bootstrap-5.select2-dropdown--multiple .select2-results__options .select2-results__option:not(.select2-results__message):not([role=group]),
.select2-container--bootstrap-5 .select2-dropdown.select2-dropdown--multiple .select2-results__options .select2-results__option:not(.select2-results__message):not([role=group]) {
    position: relative;
    padding-left: 2.25rem !important;
}

.select2-container--bootstrap-5.select2-dropdown--multiple .select2-results__options .select2-results__option:not(.select2-results__message):not([role=group])::before,
.select2-container--bootstrap-5 .select2-dropdown.select2-dropdown--multiple .select2-results__options .select2-results__option:not(.select2-results__message):not([role=group])::before {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    text-align: center;
    font-size: 0.875rem;
    line-height: 1;
    content: "";
    color: transparent;
}

.select2-container--bootstrap-5.select2-dropdown--multiple .select2-results__options .select2-results__option[aria-selected]:not(.select2-results__message):not([role=group])::before,
.select2-container--bootstrap-5 .select2-dropdown.select2-dropdown--multiple .select2-results__options .select2-results__option[aria-selected]:not(.select2-results__message):not([role=group])::before {
    content: "\f00c";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    -webkit-font-smoothing: antialiased;
    display: inline-block;
    font-style: normal;
}

.select2-container--bootstrap-5.select2-dropdown--multiple .select2-results__options .select2-results__option[aria-selected="true"]:not(.select2-results__message):not([role=group])::before,
.select2-container--bootstrap-5 .select2-dropdown.select2-dropdown--multiple .select2-results__options .select2-results__option[aria-selected="true"]:not(.select2-results__message):not([role=group])::before {
    color: var(--bs-primary) !important;
}

.select2-container--bootstrap-5.select2-dropdown--multiple .select2-results__options .select2-results__option[aria-selected="true"].select2-results__option--highlighted:not(.select2-results__message):not([role=group])::before,
.select2-container--bootstrap-5 .select2-dropdown.select2-dropdown--multiple .select2-results__options .select2-results__option[aria-selected="true"].select2-results__option--highlighted:not(.select2-results__message):not([role=group])::before {
    color: var(--bs-primary) !important;
}

/* "Pridať …" row: reuse checkmark column for the plus icon (no double left gutter). */
.select2-container--bootstrap-5.select2-dropdown--multiple .select2-results__options .select2-results__option:has(.select2-new-tag)::before,
.select2-container--bootstrap-5 .select2-dropdown.select2-dropdown--multiple .select2-results__options .select2-results__option:has(.select2-new-tag)::before {
    content: none;
    display: none;
}

.select2-container--bootstrap-5.select2-dropdown--multiple .select2-results__options .select2-results__option:has(.select2-new-tag) .select2-new-tag__plus,
.select2-container--bootstrap-5 .select2-dropdown.select2-dropdown--multiple .select2-results__options .select2-results__option:has(.select2-new-tag) .select2-new-tag__plus {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    margin-right: 0;
    text-align: center;
    font-size: 0.875rem;
    line-height: 1;
}

.select2-new-tag__plus {
    color: var(--bs-primary);
    font-size: 0.85em;
}

.select2-new-tag__term {
    font-weight: 500;
}

.select2-results__option:empty {
    height: 36px;
}

/* Compact multi-select with count summary (data-sel2-multi-count on select). */
.select2-container--bootstrap-5.select2-container--multi-count .select2-selection--multiple {
    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
    display: flex !important;
    align-items: center !important;
    padding: 0 0.55rem !important;
    overflow: hidden;
}

.select2-container--bootstrap-5.select2-container--multi-count .select2-selection--multiple .select2-selection__rendered {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* When 2+ selected: hide individual chips, show count summary only. */
.select2-container--bootstrap-5.select2-container--multi-count[data-selected-count]:not([data-selected-count="0"]):not([data-selected-count="1"]) .select2-selection--multiple .select2-selection__rendered > .select2-selection__choice:not(.select2-selection-count-summary),
.select2-container--bootstrap-5.select2-container--multi-count .select2-selection--multiple .select2-selection__rendered > .select2-selection__choice.select2-selection__choice--hidden {
    display: none !important;
}

.select2-container--bootstrap-5.select2-container--multi-count .select2-selection--multiple .select2-selection-count-summary {
    display: flex !important;
    align-items: center !important;
    flex-shrink: 0;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding: 0.125rem 0.5rem !important;
    font-size: 0.875rem;
    line-height: 1.25;
}

.select2-container--bootstrap-5.select2-container--multi-count .select2-selection--multiple .select2-selection__rendered > .select2-selection__choice:not(.select2-selection-count-summary):not(.select2-selection__choice--hidden) {
    display: flex !important;
    align-items: center !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding: 0.125rem 0.5rem !important;
    font-size: 0.875rem;
    line-height: 1.25;
    background-color: #eee !important;
    border-color: #eee !important;
}

.select2-container--bootstrap-5.select2-container--multi-count .select2-selection--multiple .select2-selection__rendered > .select2-selection__choice:not(.select2-selection-count-summary):not(.select2-selection__choice--hidden) .select2-selection__choice__remove {
    flex-shrink: 0;
    padding: 0 !important;
    margin-right: 0.25rem !important;
    font-size: 0 !important;
    line-height: 0 !important;
    color: transparent !important;
}

.select2-container--bootstrap-5.select2-container--multi-count .select2-selection--multiple .select2-selection-count-summary {
    background-color: #eee !important;
    border: 1px solid #eee !important;
    border-radius: 0.25rem;
}

.select2-container--bootstrap-5.select2-container--multi-count .select2-selection--multiple .select2-search.select2-search--inline {
    display: flex !important;
    align-items: center !important;
    align-self: center !important;
    height: 100% !important;
    min-height: 0 !important;
    width: auto !important;
    flex: 1 1 auto;
    margin: 0 !important;
    padding: 0 !important;
}

.select2-container--bootstrap-5.select2-container--multi-count .select2-selection--multiple .select2-search--inline .select2-search__field {
    display: block;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0;
    line-height: 1.5 !important;
    font-size: 1rem;
    background: transparent;
    vertical-align: middle;
}
