/**
 * Country Select with Select2 - Custom Styles
 * Enhances the display of country flags and codes
 */

/* Country option in dropdown */
.country-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

.country-flag {
    font-size: 20px;
    min-width: 28px;
    display: inline-block;
}

.country-name {
    flex: 1;
    font-size: 14px;
    color: #374151;
    font-weight: 500;
}

.country-code {
    font-size: 13px;
    color: #6B7280;
    font-weight: 400;
}

/* Selected country display */
.country-selection {
    display: flex;
    align-items: center;
    gap: 8px;
}

.country-flag-selected {
    font-size: 20px;
    display: inline-block;
}

.country-code-selected {
    font-size: 14px;
    color: #1F2937;
    font-weight: 500;
}

/* Select2 container customization */
.select2-container--default .select2-selection--single {
    border: 2px solid #D1D5DB;
    border-radius: 0.5rem;
    height: 48px;
    padding: 8px 12px;
    transition: all 0.2s;
}

.select2-container--default .select2-selection--single:hover {
    border-color: #9CA3AF;
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: #6366F1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    outline: none;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 30px;
    padding-left: 0;
    color: #1F2937;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 46px;
    right: 8px;
}

/* Dropdown customization */
.select2-container--default .select2-dropdown {
    border: 2px solid #6366F1;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    margin-top: 4px;
}

.select2-container--default .select2-search--dropdown {
    padding: 12px;
    background-color: #F9FAFB;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    border: 2px solid #D1D5DB;
    border-radius: 0.5rem;
    padding: 8px 12px;
    font-size: 14px;
    transition: all 0.2s;
}

.select2-container--default .select2-search--dropdown .select2-search__field:focus {
    border-color: #6366F1;
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.select2-container--default .select2-results__option {
    padding: 10px 16px;
    transition: background-color 0.15s;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #EEF2FF;
    color: #1F2937;
}

.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: #6366F1;
    color: white;
}

.select2-container--default .select2-results__option[aria-selected=true] .country-name,
.select2-container--default .select2-results__option[aria-selected=true] .country-code {
    color: white;
}

.select2-results__options {
    max-height: 300px;
}

/* Placeholder styling */
.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #9CA3AF;
    font-size: 14px;
}

/* Loading state */
.select2-container--default .select2-results__option--loading {
    padding: 12px;
    text-align: center;
    color: #6B7280;
}

/* No results */
.select2-results__option--no-results {
    padding: 16px;
    text-align: center;
    color: #6B7280;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 640px) {
    .country-name {
        font-size: 13px;
    }
    
    .country-code {
        font-size: 12px;
    }
    
    .select2-results__options {
        max-height: 250px;
    }
}

/* Animation for opening */
.select2-container--open .select2-dropdown {
    animation: slideDown 0.2s ease-out;
}

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

/* Visual feedback for valid selection */
.select2-selection.has-value {
    border-color: #10B981;
    background-color: #F0FDF4;
}

/* Required field indicator */
.country-select-wrapper.required .select2-selection--single {
    border-left: 3px solid #EF4444;
}

.country-select-wrapper.required.has-value .select2-selection--single {
    border-left: 3px solid #10B981;
}

