/* ═══════════════════════════════════════════════════════════════
   Phoenix ERP — Select2 Bootstrap 5 Theme Override
   Select2'yi Bootstrap 5 form-select görünümüne uyumlu hale getirir.
   Include: <link rel="stylesheet" href="~/assets/css/vendors/select2-bs5.css" />
═══════════════════════════════════════════════════════════════ */

/* ── Tek Seçim ─────────────────────────────────────────────── */
.select2-container--bootstrap-5 .select2-selection--single {
    display: flex;
    align-items: center;
    height: calc(1.5em + 0.75rem + 2px);
    padding: 0.375rem 2.25rem 0.375rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    background-color: #fff;
    background-image: none;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}
/* sm boyut */
.select2-container--bootstrap-5.select2-sm .select2-selection--single,
.form-select-sm + .select2-container--bootstrap-5 .select2-selection--single,
.input-group-sm .select2-container--bootstrap-5 .select2-selection--single {
    height: calc(1.5em + 0.5rem + 2px);
    padding: 0.25rem 2rem 0.25rem 0.5rem;
    font-size: 0.8125rem;
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    padding: 0;
    color: #212529;
    line-height: inherit;
}
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__placeholder {
    color: #6c757d;
}
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__clear {
    position: absolute;
    right: 1.75rem;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    padding: 0;
    margin: 0;
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1;
    color: #6c757d;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    transition: color .15s ease-in-out, background-color .15s ease-in-out;
    z-index: 1;
}
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__clear:hover {
    color: #dc3545;
    background-color: rgba(220, 53, 69, .1);
}
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__clear:active {
    color: #fff;
    background-color: rgba(220, 53, 69, .7);
}
/* Çoklu seçim clear butonu */
.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__clear {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    padding: 0;
    margin: 0;
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1;
    color: #6c757d;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    transition: color .15s ease-in-out, background-color .15s ease-in-out;
    z-index: 1;
}
.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__clear:hover {
    color: #dc3545;
    background-color: rgba(220, 53, 69, .1);
}
.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__clear:active {
    color: #fff;
    background-color: rgba(220, 53, 69, .7);
}
/* Çoklu seçim — choice kaldır butonu */
.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__choice__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0 4px 0 0;
    font-size: 0.75rem;
    font-weight: 700;
    color: #6c757d;
    background: transparent;
    border: none;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    transition: color .15s ease-in-out;
}
.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: #dc3545;
}
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: auto;
    height: auto;
}
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow b {
    display: none;
}

/* ── Focus ─────────────────────────────────────────────────── */
.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, .15);
}

/* ── Disabled ──────────────────────────────────────────────── */
.select2-container--bootstrap-5 .select2-selection--single[aria-disabled="true"],
.select2-container--bootstrap-5.select2-container--disabled .select2-selection {
    background-color: #e9ecef;
    opacity: 1;
}

/* ── Dropdown ──────────────────────────────────────────────── */
.select2-container--bootstrap-5 .select2-dropdown {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .1);
    z-index: 9999;
}
.select2-container--bootstrap-5 .select2-dropdown--below {
    border-top: none;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}
.select2-container--bootstrap-5 .select2-dropdown--above {
    border-bottom: none;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

/* ── Search Box ────────────────────────────────────────────── */
.select2-container--bootstrap-5 .select2-search--dropdown {
    padding: 6px 8px;
}
.select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field {
    display: block;
    width: 100%;
    padding: 0.25rem 0.5rem;
    font-size: 0.8125rem;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    outline: none;
}
.select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.15rem rgba(13, 110, 253, .15);
}

/* ── Results ───────────────────────────────────────────────── */
.select2-container--bootstrap-5 .select2-results__option {
    padding: 6px 10px;
    font-size: 0.84rem;
    transition: background-color .1s;
}
.select2-container--bootstrap-5 .select2-results__option--highlighted[aria-selected] {
    background-color: #0d6efd;
    color: #fff;
}
.select2-container--bootstrap-5 .select2-results__option[aria-selected="true"] {
    background-color: #e7f1ff;
    color: #0a58ca;
}
.select2-container--bootstrap-5 .select2-results__option--disabled {
    color: #adb5bd;
}

/* ── Çoklu Seçim (multi) ──────────────────────────────────── */
.select2-container--bootstrap-5 .select2-selection--multiple {
    min-height: calc(1.5em + 0.75rem + 2px);
    padding: 3px 6px;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    background-color: #fff;
}
.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__choice {
    background-color: #e7f1ff;
    border: 1px solid #b6d4fe;
    border-radius: 0.25rem;
    padding: 1px 6px;
    font-size: 0.8rem;
    color: #0a58ca;
    margin: 2px;
}
/* choice__remove stili yukarıda clear buton bloğunda tanımlı */

/* ── Loading ───────────────────────────────────────────────── */
.select2-container--bootstrap-5 .select2-results__option--load-more,
.select2-container--bootstrap-5 .select2-results__message {
    text-align: center;
    color: #6c757d;
    font-size: 0.82rem;
    padding: 8px;
}

/* ── is-invalid entegrasyonu ───────────────────────────────── */
.is-invalid + .select2-container--bootstrap-5 .select2-selection {
    border-color: #dc3545;
}
.is-invalid + .select2-container--bootstrap-5.select2-container--focus .select2-selection,
.is-invalid + .select2-container--bootstrap-5.select2-container--open .select2-selection {
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, .15);
}
