/*!
 * Select2 Arrow Overlap Fix
 * Comprehensive solution for Select2 dropdown arrow overlapping text
 * Works with all Select2 themes (default, bootstrap4, bootstrap5)
 */

/* FORCE PROPER CONTAINER SIZING */
.select2-container .select2-selection--single,
.select2-container--default .select2-selection--single,
.select2-container--bootstrap4 .select2-selection--single,
.select2-container--bootstrap-5 .select2-selection--single {
    height: calc(2.25rem + 2px) !important;
    min-height: 38px !important;
    position: relative !important;
    border: 1px solid #ced4da !important;
    border-radius: 0.375rem !important;
}

/* PREVENT TEXT OVERLAP WITH ARROW - AGGRESSIVE PADDING */
.select2-container .select2-selection--single .select2-selection__rendered,
.select2-container--default .select2-selection--single .select2-selection__rendered,
.select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered,
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    padding: 0.375rem 50px 0.375rem 12px !important;
    line-height: calc(2.25rem - 0.75rem) !important;
    color: #495057 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: block !important;
    box-sizing: border-box !important;
    width: calc(100% - 50px) !important;
}

/* FORCE ARROW TO RIGHT SIDE - NO OVERLAP */
.select2-container .select2-selection--single .select2-selection__arrow,
.select2-container--default .select2-selection--single .select2-selection__arrow,
.select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow,
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow {
    position: absolute !important;
    right: 12px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 24px !important;
    height: 24px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    pointer-events: none !important;
    z-index: 10 !important;
}

/* ARROW STYLING */
.select2-container .select2-selection--single .select2-selection__arrow b,
.select2-container--default .select2-selection--single .select2-selection__arrow b,
.select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow b,
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow b {
    border-color: #6c757d transparent transparent transparent !important;
    border-style: solid !important;
    border-width: 6px 5px 0 5px !important;
    height: 0 !important;
    width: 0 !important;
    position: relative !important;
    top: 0 !important;
    left: 0 !important;
    margin: 0 !important;
}

/* DROPDOWN STYLING */
.select2-container .select2-dropdown,
.select2-container--default .select2-dropdown,
.select2-container--bootstrap4 .select2-dropdown,
.select2-container--bootstrap-5 .select2-dropdown {
    border: 1px solid #ced4da !important;
    border-radius: 0.375rem !important;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
    z-index: 9999 !important;
}

.select2-container .select2-results__option,
.select2-container--default .select2-results__option,
.select2-container--bootstrap4 .select2-results__option,
.select2-container--bootstrap-5 .select2-results__option {
    padding: 0.5rem 0.75rem !important;
}

.select2-container .select2-results__option--highlighted,
.select2-container--default .select2-results__option--highlighted,
.select2-container--bootstrap4 .select2-results__option--highlighted,
.select2-container--bootstrap-5 .select2-results__option--highlighted {
    background-color: #0d6efd !important;
    color: white !important;
}

/* FOCUS STATES */
.select2-container .select2-selection--single:focus,
.select2-container--default .select2-selection--single:focus,
.select2-container--bootstrap4 .select2-selection--single:focus,
.select2-container--bootstrap-5 .select2-selection--single:focus {
    border-color: #86b7fe !important;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
    outline: none !important;
}

/* MODAL SPECIFIC FIXES */
.modal .select2-container {
    z-index: 1060 !important;
}

/* RESPONSIVE DESIGN */
@media (max-width: 576px) {
    .select2-container .select2-selection--single .select2-selection__rendered,
    .select2-container--default .select2-selection--single .select2-selection__rendered,
    .select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered,
    .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
        padding: 0.375rem 40px 0.375rem 10px !important;
        width: calc(100% - 40px) !important;
    }

    .select2-container .select2-selection--single .select2-selection__arrow,
    .select2-container--default .select2-selection--single .select2-selection__arrow,
    .select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow,
    .select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow {
        right: 8px !important;
        width: 20px !important;
    }
}

/* ADDITIONAL SAFETY FIXES */
.select2-container * {
    box-sizing: border-box !important;
}

.select2-container .select2-selection__placeholder {
    color: #6c757d !important;
}

.select2-container .select2-selection__clear {
    right: 35px !important;
}