/* Chosen.js Bootstrap Integration Styles */

/* Container styling */
.chosen-container {
    font-size: 16px !important;
}

/* Single select styling */
.chosen-container-single .chosen-single {
    height: 38px !important;
    line-height: 36px !important;
    border: 1px solid #ced4da !important;
    border-radius: 0.375rem !important;
    background: linear-gradient(to bottom, #ffffff 0%, #ffffff 100%) !important;
    box-shadow: none !important;
    padding: 0 38px 0 8px !important;
}

.chosen-container-single .chosen-single:focus,
.chosen-container-active .chosen-single {
    border-color: #80bdff !important;
    outline: 0 !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25) !important;
}

/* Dropdown arrow */
.chosen-container-single .chosen-single div {
    top: 0 !important;
    right: 0 !important;
    width: 38px !important;
    height: 36px !important;
}

.chosen-container-single .chosen-single div b {
    background-position-y: 4px !important;
}

/* Dropdown menu */
.chosen-drop {
    border: 1px solid #ced4da !important;
    border-radius: 0.375rem !important;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
    margin-top: 2px !important;
}

/* Search input */
.chosen-search input[type="text"] {
    height: 36px !important;
    border: 1px solid #ced4da !important;
    border-radius: 0.25rem !important;
    padding: 4px 8px !important;
    font-size: 14px !important;
    margin: 8px !important;
    width: calc(100% - 16px) !important;
}

.chosen-search input[type="text"]:focus {
    border-color: #80bdff !important;
    outline: 0 !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25) !important;
}

/* Options */
.chosen-results {
    max-height: 240px !important;
    margin: 0 !important;
    padding: 0 !important;
}

.chosen-results li {
    padding: 8px 12px !important;
    line-height: 1.42857143 !important;
    border-bottom: 1px solid #f8f9fa !important;
}

.chosen-results li:last-child {
    border-bottom: none !important;
}

.chosen-results li.highlighted {
    background-color: #007bff !important;
    color: #ffffff !important;
}

.chosen-results li.no-results {
    background-color: #f8f9fa !important;
    color: #6c757d !important;
    font-style: italic !important;
}

/* Multi-select styling */
.chosen-container-multi .chosen-choices {
    border: 1px solid #ced4da !important;
    border-radius: 0.375rem !important;
    background: #ffffff !important;
    min-height: 38px !important;
    padding: 4px !important;
}

.chosen-container-multi .chosen-choices:focus-within {
    border-color: #80bdff !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25) !important;
}

.chosen-container-multi .chosen-choices li.search-field input[type="text"] {
    height: 26px !important;
    line-height: 26px !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.chosen-container-multi .chosen-choices li.search-choice {
    background: #007bff !important;
    border: 1px solid #0056b3 !important;
    border-radius: 0.25rem !important;
    color: #ffffff !important;
    line-height: 20px !important;
    padding: 2px 8px 2px 20px !important;
    margin: 2px !important;
}

.chosen-container-multi .chosen-choices li.search-choice .search-choice-close {
    top: 3px !important;
    left: 4px !important;
    background-position: -42px 1px !important;
}

.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover {
    background-position: -42px -10px !important;
}

/* Disabled state */
.chosen-container-single.chosen-disabled .chosen-single,
.chosen-container-multi.chosen-disabled .chosen-choices {
    background-color: #e9ecef !important;
    color: #6c757d !important;
    cursor: not-allowed !important;
    opacity: 1 !important;
}

/* Auto-assignment feedback */
.chosen-container.auto-selected .chosen-single {
    border: 2px solid #0dcaf0 !important;
    background: linear-gradient(45deg, #e7f3ff, #ffffff) !important;
    box-shadow: 0 0 10px rgba(13, 202, 240, 0.3) !important;
    animation: auto-assignment-pulse 2s ease-in-out;
}

@keyframes auto-assignment-pulse {
    0% {
        box-shadow: 0 0 10px rgba(13, 202, 240, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(13, 202, 240, 0.6);
    }
    100% {
        box-shadow: 0 0 10px rgba(13, 202, 240, 0.3);
    }
}

/* Success and error states */
.chosen-container.is-valid .chosen-single {
    border-color: #198754 !important;
}

.chosen-container.is-invalid .chosen-single {
    border-color: #dc3545 !important;
}

/* Auto-assignment notification override */
.auto-assignment-notification.alert-info {
    background-color: rgba(242, 139, 130, 0.9) !important;
    border-color: #DF2C21 !important;
    color: #1A1A1A !important;
    opacity: 1 !important;
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .chosen-container {
        font-size: 16px !important; /* Prevent zoom on iOS */
    }
    
    .chosen-drop {
        max-height: 200px !important;
    }
    
    .chosen-results {
        max-height: 150px !important;
    }
}