/* Select2 Bootstrap 5.3.3 Global Compatibility CSS */
/* Author: Laravel ERP Team */
/* Version: 1.0 - Auto Bootstrap Styling */

/* Main Selection Box - Default & Bootstrap4 Theme */
.select2-container .select2-selection--single,
.select2-container--bootstrap4 .select2-selection--single {
    height: 34px !important;
    border: 2px solid #e9ecef !important;
    border-radius: 0.75rem !important;
    padding: 0.375rem 0.75rem !important;
    font-size: 1rem !important;
    line-height: 1.5 !important;
    background-color: #fff !important;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out !important;
    display: flex !important;
    align-items: center !important;
}

/* Focus States - Default & Bootstrap4 */
.select2-container .select2-selection--single:focus,
.select2-container.select2-container--focus .select2-selection--single,
.select2-container--bootstrap4 .select2-selection--single:focus,
.select2-container--bootstrap4.select2-container--focus .select2-selection--single {
    border-color: #0d6efd !important;
    outline: 0 !important;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15) !important;
}

/* Rendered Text - Default & Bootstrap4 */
.select2-container .select2-selection__rendered,
.select2-container--bootstrap4 .select2-selection__rendered {
    line-height: 1.5 !important;
    padding-left: 0 !important;
    color: #212529 !important;
    display: flex !important;
    align-items: center !important;
    height: 100% !important;
}

/* Dropdown Arrow - Default & Bootstrap4 */
.select2-container .select2-selection__arrow,
.select2-container--bootstrap4 .select2-selection__arrow {
    height: 32px !important;
    right: 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.select2-container .select2-selection__arrow b,
.select2-container--bootstrap4 .select2-selection__arrow b {
    border-color: #6c757d transparent transparent transparent !important;
    border-style: solid !important;
    border-width: 5px 4px 0 4px !important;
    height: 0 !important;
    left: 50% !important;
    margin-left: -4px !important;
    margin-top: -2px !important;
    position: absolute !important;
    top: 50% !important;
    width: 0 !important;
}

/* Dropdown Menu - Universal */
.select2-dropdown {
    border: 2px solid #0d6efd !important;
    border-radius: 0.75rem !important;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* Dropdown Options - Default & Bootstrap4 */
.select2-container .select2-results__option,
.select2-container--bootstrap4 .select2-results__option {
    padding: 0.5rem 0.75rem !important;
    font-size: 1rem !important;
    line-height: 1.5 !important;
    border-radius: 0.5rem !important;
    margin: 2px !important;
}

/* Highlighted Option - Default & Bootstrap4 */
.select2-container .select2-results__option--highlighted,
.select2-container--bootstrap4 .select2-results__option--highlighted {
    background-color: #0d6efd !important;
    color: #fff !important;
}

/* Selected Option - Default & Bootstrap4 */
.select2-container .select2-results__option[aria-selected="true"],
.select2-container--bootstrap4 .select2-results__option[aria-selected="true"] {
    background-color: #e9ecef !important;
    color: #212529 !important;
}

/* Search Field in Dropdown - Default & Bootstrap4 */
.select2-container .select2-search--dropdown .select2-search__field,
.select2-container--bootstrap4 .select2-search--dropdown .select2-search__field {
    border: 2px solid #e9ecef !important;
    border-radius: 0.75rem !important;
    padding: 0.375rem 0.75rem !important;
    font-size: 1rem !important;
    line-height: 1.5 !important;
    height: 34px !important;
}

/* Search Field Focus - Default & Bootstrap4 */
.select2-container .select2-search--dropdown .select2-search__field:focus,
.select2-container--bootstrap4 .select2-search--dropdown .select2-search__field:focus {
    border-color: #0d6efd !important;
    outline: 0 !important;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15) !important;
}

/* Layout & Spacing - Universal */
.form-label + .select2-container {
    margin-top: 0 !important;
}

.select2-container {
    width: 100% !important;
}

/* Multiple Selection Support - Default & Bootstrap4 */
.select2-container .select2-selection--multiple,
.select2-container--bootstrap4 .select2-selection--multiple {
    min-height: 34px !important;
    max-height: 120px !important;
    border: 2px solid #e9ecef !important;
    border-radius: 0.75rem !important;
    padding: 0.25rem 0.5rem !important;
    display: flex !important;
    align-items: flex-start !important;
    flex-wrap: wrap !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    word-wrap: break-word !important;
    word-break: break-word !important;
}

/* Force line breaks for multiple selection choices */
.select2-container .select2-selection--multiple .select2-selection__rendered,
.select2-container--bootstrap4 .select2-selection--multiple .select2-selection__rendered {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: flex-start !important;
    gap: 2px !important;
    width: 100% !important;
}

/* Individual Choice Items - Enhanced Styling */
.select2-container .select2-selection--multiple .select2-selection__choice,
.select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice {
    background-color: #0d6efd !important;
    border: 1px solid #0d6efd !important;
    border-radius: 0.5rem !important;
    color: #fff !important;
    padding: 0.125rem 0.375rem !important;
    margin: 1px !important;
    font-size: 0.875rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    min-width: 0 !important;
    max-width: 100% !important;
    position: relative !important;
}

/* Choice Text Content */
.select2-container .select2-selection--multiple .select2-selection__choice__display,
.select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice__display {
    flex: 1 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    margin-right: 4px !important;
    min-width: 0 !important;
}

/* Cross Icon (Remove Button) - Enhanced Positioning */
.select2-container .select2-selection--multiple .select2-selection__choice__remove,
.select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice__remove {
    color: #fff !important;
    background: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    font-weight: bold !important;
    font-size: 1.1em !important;
    line-height: 1 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 16px !important;
    height: 16px !important;
    border-radius: 50% !important;
    transition: background-color 0.15s ease-in-out !important;
    flex-shrink: 0 !important;
    order: 2 !important;
    position: relative !important;
    right: 0 !important;
}

/* Cross Icon Hover Effect */
.select2-container .select2-selection--multiple .select2-selection__choice__remove:hover,
.select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: #fff !important;
    background-color: rgba(255, 255, 255, 0.2) !important;
    transform: scale(1.1) !important;
}

/* Cross Icon Focus State */
.select2-container .select2-selection--multiple .select2-selection__choice__remove:focus,
.select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice__remove:focus {
    outline: none !important;
    background-color: rgba(255, 255, 255, 0.3) !important;
}

/* Ensure cross icon is always visible and properly positioned */
.select2-container .select2-selection--multiple .select2-selection__choice:has(.select2-selection__choice__remove),
.select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice:has(.select2-selection__choice__remove) {
    padding-right: 0.5rem !important;
}

/* Fallback for browsers that don't support :has() */
.select2-container .select2-selection--multiple .select2-selection__choice,
.select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice {
    padding-right: 0.5rem !important;
} 