/**
 * Select2 Custom Styles for Propidata Plugin
 * Senior WordPress Developer Implementation
 */

/* Ensure Select2 works in all contexts */
.select2-container {
    width: 100% !important;
    font-family: inherit;
    box-sizing: border-box;
}

/* Main Select2 container */
.select2-container--default .select2-selection--single {
    height: auto;
    min-height: 38px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    background-color: #fff;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

/* Focus state */
.select2-container--default.select2-container--focus .select2-selection--single {
    border-color: var(--rh-global-color-primary, #007cba);
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
    outline: none;
}

/* Selection display */
.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #333;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    padding: 8px 12px;
    padding-right: 30px;
}

/* Placeholder */
.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #adb5bd;
    font-weight: 400;
}

/* Arrow */
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 100%;
    width: 30px;
    position: absolute;
    right: 0;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: #6c757d transparent transparent transparent;
    border-style: solid;
    border-width: 5px 4px 0 4px;
    height: 0;
    left: 50%;
    margin-left: -4px;
    margin-top: -2px;
    position: absolute;
    top: 50%;
    width: 0;
    transition: transform 0.2s ease;
}

/* Dropdown */
.select2-dropdown {
    border: 1px solid #e9ecef;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    background-color: #fff;
    z-index: 9999;
}

/* Search box */
.select2-container--default .select2-search--dropdown .select2-search__field {
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
    outline: none;
}

.select2-container--default .select2-search--dropdown .select2-search__field:focus {
    border-color: var(--rh-global-color-primary, #007cba);
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
}

/* Options */
.select2-container--default .select2-results__option {
    padding: 10px 12px;
    font-size: 14px;
    color: #333;
    border-bottom: 1px solid #f8f9fa;
    transition: all 0.2s ease;
}

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

/* Hover state */
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--rh-global-color-primary, #007cba);
    color: #fff;
}

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

/* Loading state */
.select2-container--default .select2-results__option--loading {
    color: #6c757d;
    font-style: italic;
}

/* No results */
.select2-container--default .select2-results__option--no-results {
    color: #6c757d;
    font-style: italic;
    padding: 10px 12px;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .select2-container--default .select2-selection--single {
        min-height: 36px;
    }
    
    .select2-container--default .select2-selection--single .select2-selection__rendered {
        font-size: 13px;
        padding: 6px 10px;
        padding-right: 28px;
    }
    
    .select2-container--default .select2-results__option {
        padding: 8px 10px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .select2-container--default .select2-selection--single {
        min-height: 34px;
    }
    
    .select2-container--default .select2-selection--single .select2-selection__rendered {
        font-size: 12px;
        padding: 5px 8px;
        padding-right: 26px;
    }
    
    .select2-container--default .select2-results__option {
        padding: 6px 8px;
        font-size: 12px;
    }
}

/* Widget/Sidebar compatibility */
.widget .select2-container {
    width: 100% !important;
}

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

/* Ensure proper z-index in modals */
.modal .select2-container {
    z-index: 9999;
}

/* Dark theme compatibility */
@media (prefers-color-scheme: dark) {
    .select2-container--default .select2-selection--single {
        background-color: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .select2-container--default .select2-selection--single .select2-selection__rendered {
        color: #e2e8f0;
    }
    
    .select2-dropdown {
        background-color: #2d3748;
        border-color: #4a5568;
    }
    
    .select2-container--default .select2-results__option {
        color: #e2e8f0;
        border-bottom-color: #4a5568;
    }
    
    .select2-container--default .select2-results__option[aria-selected=true] {
        background-color: #4a5568;
        color: #e2e8f0;
    }
} 