/* Select2 Multi Checkboxes Styles */
.select2-container--default .select2-selection--multiple {
    border: 1px solid #ddd;
    min-height: 38px;
    padding: 2px 5px;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: #007cba;
    border: 1px solid #007cba;
    border-radius: 3px;
    color: #fff;
    margin: 2px;
    padding: 3px 8px;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: #fff;
    margin-right: 5px;
    font-weight: bold;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.2);
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #00bada;
    color: #fff;
}

.select2-result-repository {
    display: flex;
    align-items: center;
    font-size: 12px;
}

.select2-result-repository__meta {
    flex: 1;
}

.select2-result-repository__title {
    display: flex;
    align-items: center;
}

.select2-result-repository__checkbox {
    margin: 0;
    cursor: pointer;
}

.select2-result-repository__text {
    flex: 1;
    cursor: pointer;
    margin: 3px 0 0 0;
}

/*.select2-result-repository__checkbox:checked + .select2-result-repository__text {
    font-weight: bold;
}*/

/* Custom styles for our search form */
.search-form .select2-container {
    width: 100% !important;
}

.search-form .select2-container--default .select2-selection--multiple {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    min-height: 35px;
    border-radius: 0;
}

/*.search-form .select2-container--default .select2-selection--multiple:focus {
    border-color: #007cba;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.2);
}*/

.search-form .select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: #007cba;
    border: 1px solid #007cba;
    border-radius: 3px;
    color: #fff;
    margin: 2px;
    padding: 4px 8px;
    font-size: 12px;
}

.search-form .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: #fff;
    margin-right: 5px;
    font-weight: bold;
    font-size: 13px;
}

.search-form .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.search-form .select2-container--default .select2-results__option {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
}

.search-form .select2-container--default .select2-results__option:last-child {
    border-bottom: none;
}

.search-form .select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #007cba;
    color: #fff;
}

.search-form .select2-result-repository {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    min-height: 20px;
}

.search-form .select2-result-repository__checkbox {
    margin: 0;
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: #007cba;
}

.search-form .select2-result-repository__text {
    flex: 1;
    cursor: pointer;
    margin-left: 8px;
    font-size: 13px;
}

.search-form .select2-result-repository__checkbox:checked + .select2-result-repository__text {
    font-weight: 600;
    color: #007cba;
}

/* Placeholder styles */
.search-form .select2-container--default .select2-selection--multiple .select2-selection__placeholder {
    color: #999;
    font-style: italic;
}

/* Selection text styles */
.search-form .select2-container--default .select2-selection--multiple .select2-selection__rendered {
    padding: 0;
    margin: 0;
    line-height: 1.4;
}

.search-form .select2-container--default .select2-selection--multiple .select2-selection__choice__text {
    color: #333;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* New format styles */
.search-form .select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: transparent;
    border: none;
    border-radius: 0;
    color: #333;
    margin: 0;
    padding: 0;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
}

.search-form .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    display: none;
}

.search-form .select-box-enable {
    color: #007cba;
    font-weight: 500;
    font-size: 13px;
}

.search-form .select-box-enable-num {
    color: #666;
    font-weight: 400;
    font-size: 13px;
    margin-left: 2px;
    margin-top: 3px;
}

.search-form .select-box-enable__title {
    display: flex;
    align-items: center;
    gap: 2px;
}

/* Ensure proper spacing and alignment */
.search-form .select2-container--default .select2-selection--multiple .select2-selection__rendered {
    padding: 1px 1px;
    margin: 0;
    line-height: 1.4;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    min-height: 30px;
}

/* Style for the count in parentheses */
.search-form .select2-container--default .select2-selection--multiple .select2-selection__choice__text {
    position: relative;
}

.search-form .select2-container--default .select2-selection--multiple .select2-selection__choice__text::after {
    content: '';
    display: none;
}

/* When there are multiple selections, style the count */
.search-form .select2-container--default .select2-selection--multiple .select2-selection__choice__text:contains('(+') {
    color: #007cba;
}

/* Clear button styles */
.search-form .select2-container--default .select2-selection--multiple .select2-selection__clear {
    color: #999;
    font-weight: bold;
    margin-right: 2px;
    margin-top: 7px;
}

.search-form .select2-container--default .select2-selection--multiple .select2-selection__clear:hover {
    color: #666;
}

/* Dropdown styles */
.search-form .select2-dropdown {
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.search-form .select2-search--dropdown .select2-search__field {
    border: 1px solid #e0e0e0;
    padding: 8px 12px;
}

/*.search-form .select2-search--dropdown .select2-search__field:focus {
    border-color: #007cba;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.2);
}*/

/* Focus state */
/*.search-form .select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.2);
}*/

/* Hover state */
.search-form .select2-container--default .select2-selection--multiple:hover {
    border-color: #007cba;
}

/* Selected options in dropdown */
.search-form .select2-container--default .select2-results__option[aria-selected=true] {
    background-color: #f8f9fa;
    color: #333;
}

.search-form .select2-container--default .select2-results__option[aria-selected=true]:hover {
    background-color: #e9ecef;
}

.search-form .select2-result-repository__checkbox:hover {
    border-color: #007cba;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .search-form .select2-container {
        font-size: 14px;
    }
    
    .search-form .select2-container--default .select2-selection--multiple {
        min-height: 36px;
    }
    
    .search-form .select2-container--default .select2-selection--multiple .select2-selection__choice {
        font-size: 11px;
        padding: 3px 6px;
    }
    
    .search-form .select2-result-repository {
        padding: 8px 10px;
    }
    
    .search-form .select2-result-repository__text {
        font-size: 13px;
    }
}

/* Animation for dropdown */
.search-form .select2-dropdown {
    animation: select2DropdownFadeIn 0.2s ease-out;
}

@keyframes select2DropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Custom scrollbar for dropdown */
.search-form .select2-results__options {
    max-height: 200px;
    overflow-y: auto;
}

.search-form .select2-results__options::-webkit-scrollbar {
    width: 6px;
}

.search-form .select2-results__options::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.search-form .select2-results__options::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.search-form .select2-results__options::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
} 

/* Hide remove button when only "All" is selected */
.search-form .select2-container--default .select2-selection--multiple .select2-selection__choice:only-child .select2-selection__choice__remove {
    display: none;
}

/* Hide remove button when "All" text is displayed */
.search-form .select2-container--default .select2-selection--multiple .select2-selection__choice:has(.select2-selection__choice__text:contains("All")) .select2-selection__choice__remove {
    display: none;
}

/* Alternative approach - hide remove button when only one choice exists and it's "All" */
.search-form .select2-container--default .select2-selection--multiple .select2-selection__choice:only-child:has(.select2-selection__choice__text:contains("All")) .select2-selection__choice__remove {
    display: none !important;
} 

/* Hide clear button when only "All" is selected */
.search-form .select2-container--default .select2-selection--multiple .select2-selection__clear {
    display: none;
}

/* Show clear button only when real options are selected */
.search-form .select2-container--default .select2-selection--multiple:has(.select2-selection__choice:not(:only-child)) .select2-selection__clear,
.search-form .select2-container--default .select2-selection--multiple:has(.select2-selection__choice:not(:has(.select2-selection__choice__text:contains("All")))) .select2-selection__clear {
    display: inline-block;
}

/* Ensure only one choice is visible */
.search-form .select2-container--default .select2-selection--multiple .select2-selection__rendered {
    display: flex;
    align-items: center;
}
