/* Select2 Touch Device Improvements */

/* Make Select2 touch targets larger for better touch interaction */
.select2-container--bootstrap-5 .select2-selection--single {
    min-height: 44px !important; /* iOS recommended touch target size */
    padding: 8px 12px !important;
}

.select2-container--bootstrap-5 .select2-selection__rendered {
    line-height: 28px !important;
}

.select2-container--bootstrap-5 .select2-selection__arrow {
    height: 42px !important;
    right: 12px !important;
}

/* Make dropdown options larger for touch */
.select2-results__option {
    padding: 12px 16px !important;
    min-height: 44px !important;
    display: flex !important;
    align-items: center !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

/* Improve touch feedback */
.select2-results__option--highlighted {
    background-color: #0d6efd !important;
    color: white !important;
}

/* Prevent text selection on touch */
.select2-container--bootstrap-5 .select2-selection,
.select2-results__option {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Fix for iOS bounce and scroll issues */
.select2-container--open .select2-dropdown {
    -webkit-overflow-scrolling: touch;
}

.select2-results__options {
    -webkit-overflow-scrolling: touch;
    max-height: 300px !important;
}

/* Ensure proper z-index for touch devices */
.select2-container--open .select2-dropdown {
    z-index: 9999 !important;
}

/* Touch-friendly search box */
.select2-search--dropdown .select2-search__field {
    min-height: 44px !important;
    padding: 10px 16px !important;
    font-size: 16px !important; /* Prevents zoom on iOS */
}

/* Improve visibility of selected option */
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    color: #212529 !important;
    font-size: 16px !important;
}

/* Add visual feedback for touch */
.select2-selection:active,
.select2-results__option:active {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Fix for specific touch issues on iOS Safari */
@supports (-webkit-touch-callout: none) {
    .select2-container--bootstrap-5 .select2-selection {
        cursor: pointer !important;
    }
    
    .select2-dropdown {
        position: fixed !important;
    }
}

/* RTL support for Hebrew */
html[dir="rtl"] .select2-container--bootstrap-5 .select2-selection__arrow {
    left: 12px !important;
    right: auto !important;
}

/* Responsive improvements for mobile devices */
@media (max-width: 768px) {
    .select2-container--open .select2-dropdown {
        /* left: 0 !important; */
        /* right: 0 !important; */
        width: 100% !important;
    }
    
    .select2-results__options {
        max-height: 50vh !important;
    }
}