/* Country Select CSS - Always Visible Dropdown */
.select2-container--default .select2-selection--single {
    border: 1px solid #ccc;
    border-radius: 4px;
    height: 40px;
    padding: 6px 12px;
    background-color: #fff;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    cursor: pointer;
}

.select2-container--default .select2-selection--single:hover {
    border-color: #999;
    background-color: #f8f9fa;
}

.select2-container--default.select2-container--open .select2-selection--single {
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.2);
    background-color: #fff;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #333;
    line-height: 26px;
    padding-left: 0;
    font-size: 14px;
    font-weight: 500;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #6c757d;
    font-weight: normal;
}

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

.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: #666 transparent transparent transparent;
    transition: transform 0.2s ease;
}

.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
    border-color: transparent transparent #666 transparent;
    transform: rotate(180deg);
}

/* Always Visible Dropdown Styles */
.select2-container--default .select2-dropdown {
    border: 1px solid #007cba;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 400px !important;
    overflow-y: auto;
}

.select2-container--open .select2-dropdown {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
}

/* Search Box Styles */
.select2-container--default .select2-search--dropdown {
    padding: 12px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    border: 2px solid #e9ecef;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    width: 100%;
    background-color: #fff;
    transition: all 0.2s ease;
}

.select2-container--default .select2-search--dropdown .select2-search__field:focus {
    border-color: #007cba;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
    background-color: #fff;
}

/* Results List Styles */
.select2-container--default .select2-results {
    max-height: 300px;
    overflow-y: auto;
}

.select2-container--default .select2-results > .select2-results__options {
    max-height: none;
}

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

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

.select2-container--default .select2-results__option:hover {
    background-color: #e7f3ff;
    color: #007cba;
}

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

.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: #f8f9fa;
    color: #333;
    font-weight: 600;
}

.select2-container--default .select2-results__option[aria-selected=true]:hover {
    background-color: #e7f3ff;
    color: #007cba;
}

/* Group Headers */
.select2-container--default .select2-results__group {
    padding: 8px 12px;
    font-weight: 600;
    color: #495057;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

/* No Results Message */
.select2-container--default .select2-results__option--load-more,
.select2-container--default .select2-results__message {
    padding: 12px;
    text-align: center;
    color: #6c757d;
    font-style: italic;
    background-color: #f8f9fa;
}

/* CF7 Validation Styles */
.select2-container.wpcf7-not-valid .select2-selection--single {
    border-color: #dc3232;
    background-color: #fff5f5;
}

.select2-container.wpcf7-not-valid.select2-container--open .select2-selection--single {
    border-color: #dc3232;
    box-shadow: 0 0 0 2px rgba(220, 50, 50, 0.2);
}

.wpcf7-form-control-wrap.country .wpcf7-not-valid-tip {
    display: block;
    color: #dc3232;
    font-size: 12px;
    margin-top: 4px;
    font-weight: 500;
}

/* Loading State */
.select2-container--default .select2-selection--single .select2-selection__rendered .select2-selection__placeholder {
    color: #999;
}

/* Responsive Design */
@media (max-width: 768px) {
    .select2-container--default .select2-selection--single {
        height: 44px;
        padding: 10px 12px;
    }
    
    .select2-container--default .select2-selection--single .select2-selection__rendered {
        line-height: 24px;
        font-size: 16px;
    }
    
    .select2-container--default .select2-selection--single .select2-selection__arrow {
        height: 42px;
    }
    
    .select2-container--default .select2-dropdown {
        max-height: 350px !important;
    }
    
    .select2-container--default .select2-results__option {
        padding: 12px;
        font-size: 16px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .select2-container--default .select2-selection--single {
        background-color: #2c3338;
        border-color: #3c434a;
        color: #f0f0f1;
    }
    
    .select2-container--default .select2-selection--single:hover {
        background-color: #373e45;
    }
    
    .select2-container--default .select2-selection--single .select2-selection__rendered {
        color: #f0f0f1;
    }
    
    .select2-container--default .select2-dropdown {
        background-color: #2c3338;
        border-color: #007cba;
    }
    
    .select2-container--default .select2-search--dropdown {
        background-color: #373e45;
        border-bottom-color: #3c434a;
    }
    
    .select2-container--default .select2-search--dropdown .select2-search__field {
        background-color: #2c3338;
        border-color: #3c434a;
        color: #f0f0f1;
    }
    
    .select2-container--default .select2-results__option {
        color: #f0f0f1;
        border-bottom-color: #3c434a;
    }
    
    .select2-container--default .select2-results__option:hover {
        background-color: #373e45;
        color: #007cba;
    }
    
    .select2-container--default .select2-results__option[aria-selected=true] {
        background-color: #373e45;
        color: #f0f0f1;
    }
    
    .select2-container--default .select2-selection--single .select2-selection__placeholder {
        color: #a7aaad;
    }
}

/* Custom animations for dropdown */
.select2-container--open .select2-dropdown {
    animation: slideDownFade 0.3s ease-out;
}

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

/* Ensure dropdown stays above other elements */
.select2-container--open {
    z-index: 9999;
}

.select2-dropdown {
    z-index: 10000;
}