/*
 * #10002 - wyszukiwanie w selectach wyboru grupy (formularz rekrutacyjny).
 * Kolory, ramkę, zaokrąglenie i wysokość pole dostaje z oryginalnego selecta
 * (js/recruitment_group_select_search.js); tu jest tylko układ i lista wyników.
 *
 * Zamknięte pole wygląda zawsze jak natywny select (także w trybie ciemnym jest białe).
 * Rozwinięta lista naśladuje natywną listę systemu - w ciemnym motywie macOS jest ciemna.
 */
:root {
    --recruitment-select2-arrow: #333;
    --recruitment-select2-focus: rgba(60, 141, 188, 0.35);

    --recruitment-select2-list-bg: #fff;
    --recruitment-select2-list-text: #555;
    --recruitment-select2-list-muted: #999;
    --recruitment-select2-list-border: #ccc;
    --recruitment-select2-list-group: #555;
    --recruitment-select2-list-selected: #eee;
    --recruitment-select2-list-highlight: #3c8dbc;
    --recruitment-select2-list-highlight-text: #fff;
    --recruitment-select2-list-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
    --recruitment-select2-search-bg: #fff;
    --recruitment-select2-search-text: #555;
    --recruitment-select2-search-border: #ccc;
    --recruitment-select2-radius: 10px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --recruitment-select2-list-bg: #2c2c2e;
        --recruitment-select2-list-text: #f2f2f7;
        --recruitment-select2-list-muted: #8e8e93;
        --recruitment-select2-list-border: #48484a;
        --recruitment-select2-list-group: #aeaeb2;
        --recruitment-select2-list-selected: rgba(255, 255, 255, 0.08);
        --recruitment-select2-list-highlight: #0a84ff;
        --recruitment-select2-list-highlight-text: #fff;
        --recruitment-select2-list-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
        --recruitment-select2-search-bg: #1c1c1e;
        --recruitment-select2-search-text: #f2f2f7;
        --recruitment-select2-search-border: #48484a;
    }
}

/* lista jest osadzona w bloku wyboru grupy - przewija się razem ze stroną */
.recruitment-select2-scope {
    position: relative;
}

/* natywny .form-control jest blokiem - inline-block z select2 dokładał odstęp pod polem */
.recruitment-select2 {
    display: block;
}

.recruitment-select2 .select2-selection--single {
    position: relative;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    outline: none;
}

/* formularz ma text-align: center, natywny select go ignoruje */
.recruitment-select2 .select2-selection--single .select2-selection__rendered {
    flex: 1;
    text-align: left;
    /* wcięcie tekstu, które natywny select dodaje do paddingu */
    padding-left: 4px;
    padding-right: 24px;
    color: inherit;
    line-height: normal;
}

/* strzałka jak w natywnym selecie */
.recruitment-select2 .select2-selection--single .select2-selection__arrow {
    top: 0;
    right: 6px;
    height: 100%;
    width: 10px;
}

.recruitment-select2 .select2-selection--single .select2-selection__arrow b,
.recruitment-select2.select2-container--open .select2-selection--single .select2-selection__arrow b {
    top: 50%;
    left: 0;
    width: 6px;
    height: 6px;
    margin: -5px 0 0 0;
    border-style: solid;
    border-color: var(--recruitment-select2-arrow);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    transition: transform 150ms ease-out;
}

.recruitment-select2.select2-container--open .select2-selection--single .select2-selection__arrow b {
    margin-top: -1px;
    transform: rotate(-135deg);
}

/* widoczny fokus przy obsłudze klawiaturą */
.recruitment-select2.select2-container--focus .select2-selection--single {
    outline: 2px solid var(--recruitment-select2-focus);
    outline-offset: 1px;
}

/*
 * lista wyników - klasa .recruitment-select2-dropdown siedzi na zewnętrznym kontenerze
 * select2 (span o zerowym rozmiarze), dlatego wygląd dostaje wewnętrzny .select2-dropdown
 */
.recruitment-select2-dropdown .select2-dropdown {
    background-color: var(--recruitment-select2-list-bg);
    border-color: var(--recruitment-select2-list-border);
    border-radius: var(--recruitment-select2-radius);
    overflow: hidden;
    box-shadow: var(--recruitment-select2-list-shadow);
    font-size: 14px;
    color: var(--recruitment-select2-list-text);
    text-align: left;
}

/* lista odsunięta od pola, więc pełna ramka zamiast "doklejonej" z select2 */
.recruitment-select2-dropdown .select2-dropdown--below,
.recruitment-select2-dropdown .select2-dropdown--above {
    border: 1px solid var(--recruitment-select2-list-border);
    border-radius: var(--recruitment-select2-radius);
}

.recruitment-select2-dropdown .select2-dropdown--below {
    margin-top: 4px;
}

.recruitment-select2-dropdown .select2-dropdown--above {
    margin-top: -4px;
}

.recruitment-select2-dropdown .select2-search--dropdown {
    padding: 8px;
}

/* 16px - iOS nie przybliża strony po kliknięciu w pole */
.recruitment-select2-dropdown .select2-search--dropdown .select2-search__field {
    padding: 6px 10px;
    background-color: var(--recruitment-select2-search-bg);
    color: var(--recruitment-select2-search-text);
    border: 1px solid var(--recruitment-select2-search-border);
    border-radius: 6px;
    font-size: 16px;
    outline: none;
}

.recruitment-select2-dropdown .select2-search--dropdown .select2-search__field:focus {
    border-color: var(--recruitment-select2-list-highlight);
}

.recruitment-select2-dropdown .select2-search--dropdown .select2-search__field::placeholder {
    color: var(--recruitment-select2-list-muted);
}

.recruitment-select2-dropdown .select2-results > .select2-results__options {
    max-height: 280px;
}

.recruitment-select2-dropdown .select2-results__option {
    padding: 7px 12px;
}

.recruitment-select2-dropdown .select2-results__option[aria-selected=true] {
    background-color: var(--recruitment-select2-list-selected);
}

.recruitment-select2-dropdown .select2-results__option[aria-disabled=true] {
    color: var(--recruitment-select2-list-muted);
}

.recruitment-select2-dropdown .select2-results__option--highlighted[aria-selected] {
    background-color: var(--recruitment-select2-list-highlight);
    color: var(--recruitment-select2-list-highlight-text);
}

.recruitment-select2-dropdown .select2-results__group {
    padding: 8px 12px 4px;
    font-weight: bold;
    color: var(--recruitment-select2-list-group);
}

.recruitment-select2-dropdown .select2-results__message {
    color: var(--recruitment-select2-list-muted);
}

/* lista rezerwowa - odpowiednik select.waiting-list-selected z index_new_2.php */
.recruitment-select2.waiting-list-selected .select2-selection--single {
    background-color: #f2dede !important;
    border-color: #d9534f !important;
    color: #a94442 !important;
    font-weight: bold !important;
}
