/* Country Code Select2 Dropdown Styles */

.country-code-select+.select2-container {
    width: 100% !important;
}

.country-code-select+.select2-container .select2-selection--single {
    height: 38px;
    border: 1px solid var(--tblr-border-color, #d0d7de);
    border-radius: 6px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    background-color: var(--tblr-bg-surface, #fff);
    color: var(--tblr-body-color, #24292f);
    transition: all 0.2s ease;
}

.country-code-select+.select2-container .select2-selection--single:hover {
    border-color: var(--tblr-primary, #0969da);
}

.country-code-select+.select2-container.select2-container--focus .select2-selection--single {
    border-color: var(--tblr-primary, #0969da);
    box-shadow: 0 0 0 3px rgba(var(--tblr-primary-rgb, 9, 105, 218), 0.1);
    outline: none;
}

.country-code-select+.select2-container .select2-selection--single .select2-selection__rendered {
    line-height: 38px;
    padding-left: 0;
    color: var(--tblr-body-color, #24292f);
    font-size: 14px;
}

.country-code-select+.select2-container .select2-selection--single .select2-selection__arrow {
    height: 38px;
    right: 12px;
    top: 0;
}

.country-code-select+.select2-container .select2-selection--single .select2-selection__arrow b {
    border-color: var(--tblr-secondary, #656d76) transparent transparent transparent;
    border-width: 5px 4px 0 4px;
    margin-top: -2px;
}

.select2-dropdown.country-code-dropdown {
    border: 1px solid var(--tblr-border-color, #d0d7de);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    margin-top: 4px;
    padding: 4px;
    background-color: var(--tblr-bg-surface, #fff);
}

.select2-dropdown.country-code-dropdown .select2-search--dropdown {
    padding: 8px;
}

.select2-dropdown.country-code-dropdown .select2-search--dropdown .select2-search__field {
    border: 1px solid var(--tblr-border-color, #d0d7de);
    border-radius: 6px;
    height: 32px;
    padding: 0 12px;
    font-size: 14px;
    transition: all 0.2s ease;
    width: 100%;
    background-color: var(--tblr-bg-surface, #fff);
    color: var(--tblr-body-color, #24292f);
}

.select2-dropdown.country-code-dropdown .select2-search--dropdown .select2-search__field:focus {
    border-color: var(--tblr-primary, #0969da);
    box-shadow: 0 0 0 3px rgba(var(--tblr-primary-rgb, 9, 105, 218), 0.1);
    outline: none;
}

.select2-dropdown.country-code-dropdown .select2-results {
    max-height: 300px;
    overflow-y: auto;
}

.select2-dropdown.country-code-dropdown .select2-results__option {
    padding: 8px 12px;
    font-size: 14px;
    transition: all 0.15s ease;
    border-radius: 4px;
    margin: 2px 0;
    color: var(--tblr-body-color, #24292f);
}

.select2-dropdown.country-code-dropdown .select2-results__option--highlighted {
    background-color: var(--tblr-primary, #0969da);
    color: #fff;
}

.select2-dropdown.country-code-dropdown .select2-results__option[aria-selected=true] {
    background-color: var(--tblr-bg-surface-secondary, #f6f8fa);
    color: var(--tblr-primary, #0969da);
    font-weight: 500;
}

.select2-dropdown.country-code-dropdown .select2-results__option:hover {
    background-color: var(--tblr-bg-surface-secondary, #f6f8fa);
}

/* Dark mode specific styles */
[data-bs-theme="dark"] .country-code-select+.select2-container .select2-selection--single {
    background-color: var(--tblr-bg-surface, var(--tblr-gray-800));
    border-color: var(--tblr-border-color, var(--tblr-gray-700));
    color: var(--tblr-body-color, var(--tblr-gray-200));
}

[data-bs-theme="dark"] .country-code-select+.select2-container .select2-selection--single:hover {
    border-color: var(--tblr-primary, #6aa9e3);
}

[data-bs-theme="dark"] .country-code-select+.select2-container.select2-container--focus .select2-selection--single {
    border-color: var(--tblr-primary, #6aa9e3);
    box-shadow: 0 0 0 3px rgba(var(--tblr-primary-rgb, 106, 169, 227), 0.2);
}

[data-bs-theme="dark"] .country-code-select+.select2-container .select2-selection--single .select2-selection__rendered {
    color: var(--tblr-body-color, var(--tblr-gray-200));
}

[data-bs-theme="dark"] .country-code-select+.select2-container .select2-selection--single .select2-selection__arrow b {
    border-color: var(--tblr-secondary, var(--tblr-gray-400)) transparent transparent transparent;
}

[data-bs-theme="dark"] .select2-dropdown.country-code-dropdown {
    background-color: var(--tblr-bg-surface, var(--tblr-gray-800));
    border-color: var(--tblr-border-color, var(--tblr-gray-700));
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

[data-bs-theme="dark"] .select2-dropdown.country-code-dropdown .select2-search--dropdown .select2-search__field {
    background-color: var(--tblr-bg-surface, var(--tblr-gray-800));
    border-color: var(--tblr-border-color, var(--tblr-gray-700));
    color: var(--tblr-body-color, var(--tblr-gray-200));
}

[data-bs-theme="dark"] .select2-dropdown.country-code-dropdown .select2-search--dropdown .select2-search__field:focus {
    border-color: var(--tblr-primary, #6aa9e3);
    box-shadow: 0 0 0 3px rgba(var(--tblr-primary-rgb, 106, 169, 227), 0.2);
}

[data-bs-theme="dark"] .select2-dropdown.country-code-dropdown .select2-results__option {
    color: var(--tblr-body-color, var(--tblr-gray-200));
}

[data-bs-theme="dark"] .select2-dropdown.country-code-dropdown .select2-results__option--highlighted {
    background-color: var(--tblr-primary, #6aa9e3);
    color: #fff;
}

[data-bs-theme="dark"] .select2-dropdown.country-code-dropdown .select2-results__option[aria-selected=true] {
    background-color: var(--tblr-secondary-bg, var(--tblr-gray-700));
    color: var(--tblr-primary, #6aa9e3);
}

[data-bs-theme="dark"] .select2-dropdown.country-code-dropdown .select2-results__option:hover {
    background-color: var(--tblr-secondary-bg, var(--tblr-gray-700));
}

/* Frontend layout specific overrides - ensure light theme */
body:not([data-bs-theme="dark"]) .select2-dropdown.country-code-dropdown,
body:not([data-bs-theme]) .select2-dropdown.country-code-dropdown {
    background-color: #fff !important;
    border-color: #d0d7de !important;
}

body:not([data-bs-theme="dark"]) .select2-dropdown.country-code-dropdown .select2-search--dropdown .select2-search__field,
body:not([data-bs-theme]) .select2-dropdown.country-code-dropdown .select2-search--dropdown .select2-search__field {
    background-color: #fff !important;
    border-color: #d0d7de !important;
    color: #24292f !important;
}

body:not([data-bs-theme="dark"]) .select2-dropdown.country-code-dropdown .select2-results__option,
body:not([data-bs-theme]) .select2-dropdown.country-code-dropdown .select2-results__option {
    color: #24292f !important;
}

body:not([data-bs-theme="dark"]) .select2-dropdown.country-code-dropdown .select2-results__option--highlighted,
body:not([data-bs-theme]) .select2-dropdown.country-code-dropdown .select2-results__option--highlighted {
    background-color: #0969da !important;
    color: #fff !important;
}

body:not([data-bs-theme="dark"]) .select2-dropdown.country-code-dropdown .select2-results__option[aria-selected=true],
body:not([data-bs-theme]) .select2-dropdown.country-code-dropdown .select2-results__option[aria-selected=true] {
    background-color: #f6f8fa !important;
    color: #0969da !important;
}

body:not([data-bs-theme="dark"]) .select2-dropdown.country-code-dropdown .select2-results__option:hover,
body:not([data-bs-theme]) .select2-dropdown.country-code-dropdown .select2-results__option:hover {
    background-color: #f6f8fa !important;
}

