:root {
    --tabbo-country-key-width: 110px;
    --tabbo-country-key-height: 40px;
    --tabbo-country-key-radius: 5px;
    --tabbo-country-key-bg: #f3f3f3;
    --tabbo-country-key-color: #002f47;
    --tabbo-country-key-flag-size: 18px;
}

/*
 * Shared country calling-code control.
 *
 * The visual order is deliberately fixed to flag, code, chevron from right
 * to left so the control stays identical in Arabic and English interfaces.
 */
.tabbo-country-key-control {
    position: relative;
    display: flex;
    box-sizing: border-box;
    width: var(--tabbo-country-key-width);
    max-width: var(--tabbo-country-key-width);
    min-width: var(--tabbo-country-key-width);
    max-height: var(--tabbo-country-key-height);
    height: var(--tabbo-country-key-height) !important;
    flex: 0 0 var(--tabbo-country-key-width);
    align-items: center;
    justify-content: space-evenly;
    gap: 0;
    padding: 0 !important;
    border: 0 !important;
    border-radius: var(--tabbo-country-key-radius) !important;
    outline: 0;
    background: var(--tabbo-country-key-bg) !important;
    box-shadow: none !important;
    color: var(--tabbo-country-key-color) !important;
    direction: rtl;
    font-family: Arial, Vazirmatn, Cairo, "Segoe UI", sans-serif;
    font-size: 18px !important;
    font-weight: 400 !important;
    line-height: 1;
}

.tabbo-country-key-control:focus-within {
    box-shadow: 0 0 0 2px rgba(21, 155, 215, 0.18) !important;
}

.tabbo-auth-country select.select2-hidden-accessible {
    position: absolute !important;
    inset: auto !important;
    z-index: auto !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    border: 0 !important;
    opacity: 0;
    white-space: nowrap !important;
}

.tabbo-country-key-control img,
.tabbo-country-key-flag {
    display: block;
    box-sizing: border-box;
    width: var(--tabbo-country-key-flag-size) !important;
    height: var(--tabbo-country-key-flag-size) !important;
    min-width: var(--tabbo-country-key-flag-size);
    flex: 0 0 var(--tabbo-country-key-flag-size);
    margin: 0 !important;
    padding: 0;
    overflow: hidden;
    border-radius: 50%;
    background: transparent;
    object-fit: contain;
    object-position: center;
}

.tabbo-country-key-control [data-auth-country-code],
.tabbo-country-key-control [data-auth-phone-country],
.tabbo-country-key-code {
    color: var(--tabbo-country-key-color) !important;
    direction: ltr;
    font: 400 18px/1 Arial, Vazirmatn, Cairo, "Segoe UI", sans-serif !important;
    unicode-bidi: isolate;
    white-space: nowrap;
}

.tabbo-country-key-control .tabbo-auth-select-chevron,
.tabbo-country-key-chevron {
    position: static !important;
    top: auto !important;
    right: auto !important;
    left: auto !important;
    width: 8px !important;
    height: 8px !important;
    flex: 0 0 8px;
    margin: 0;
    border: 0;
    border-right: 1.8px solid var(--tabbo-country-key-color);
    border-bottom: 1.8px solid var(--tabbo-country-key-color);
    transform: translateY(-2px) rotate(45deg);
    pointer-events: none;
}

.tabbo-auth-phone-field {
    grid-template-columns: var(--tabbo-country-key-width) minmax(0, 1fr) !important;
    gap: 8px !important;
}

.tabbo-auth-phone-field > input {
    height: var(--tabbo-country-key-height) !important;
}

/*
 * Select2 adds its generated container immediately after the original select.
 * The JavaScript companion also adds the explicit class for dynamically
 * created rows and for Select2 instances with custom templates.
 */
select.country_code + .select2-container,
select.MobileCountryCode + .select2-container,
.select2-container.tabbo-country-key-select2 {
    box-sizing: border-box;
    width: var(--tabbo-country-key-width) !important;
    max-width: var(--tabbo-country-key-width) !important;
    min-width: var(--tabbo-country-key-width) !important;
    max-height: var(--tabbo-country-key-height) !important;
    height: var(--tabbo-country-key-height) !important;
    flex: 0 0 var(--tabbo-country-key-width) !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: var(--tabbo-country-key-radius) !important;
    background: transparent !important;
    box-shadow: none !important;
    direction: rtl;
}

select.country_code + .select2-container .selection,
select.MobileCountryCode + .select2-container .selection,
.select2-container.tabbo-country-key-select2 .selection {
    display: block;
    width: 100%;
    height: 100%;
    border: 0 !important;
    border-radius: inherit !important;
    background: transparent !important;
}

select.country_code + .select2-container .select2-selection--single,
select.MobileCountryCode + .select2-container .select2-selection--single,
.select2-container.tabbo-country-key-select2 .select2-selection--single {
    position: relative;
    display: block;
    box-sizing: border-box;
    width: 100%;
    height: 100% !important;
    min-height: var(--tabbo-country-key-height);
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden;
    border: 0 !important;
    border-radius: var(--tabbo-country-key-radius) !important;
    outline: 0 !important;
    background: var(--tabbo-country-key-bg) !important;
    box-shadow: none !important;
}

select.country_code + .select2-container.select2-container--focus .select2-selection--single,
select.country_code + .select2-container.select2-container--open .select2-selection--single,
select.MobileCountryCode + .select2-container.select2-container--focus .select2-selection--single,
select.MobileCountryCode + .select2-container.select2-container--open .select2-selection--single,
.select2-container.tabbo-country-key-select2.select2-container--focus .select2-selection--single,
.select2-container.tabbo-country-key-select2.select2-container--open .select2-selection--single {
    box-shadow: 0 0 0 2px rgba(21, 155, 215, 0.18) !important;
}

select.country_code + .select2-container .select2-selection__rendered,
select.MobileCountryCode + .select2-container .select2-selection__rendered,
.select2-container.tabbo-country-key-select2 .select2-selection__rendered {
    display: flex !important;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    align-items: center;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden;
    background: transparent !important;
    color: var(--tabbo-country-key-color) !important;
    direction: rtl;
    font: 400 18px/1 Arial, Vazirmatn, Cairo, "Segoe UI", sans-serif !important;
    text-align: right;
    text-overflow: clip;
    white-space: nowrap;
}

.tabbo-country-key-value {
    display: flex;
    width: 100%;
    min-width: 0;
    align-items: center;
    justify-content: space-evenly;
    gap: 0;
    direction: rtl;
}

.select2-container.tabbo-country-key-select2 .select2-selection__arrow {
    display: none !important;
}

.select2-container.tabbo-country-key-select2.select2-container--open
    .tabbo-country-key-chevron {
    transform: translateY(2px) rotate(225deg);
}

.select2-dropdown.tabbo-country-key-dropdown {
    z-index: 1110;
    min-width: 110px;
    overflow: hidden;
    border: 1px solid #e2e6e8;
    border-radius: 5px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(0, 47, 71, 0.12);
}

.tabbo-country-key-dropdown .select2-results__options {
    max-height: 240px;
}

.tabbo-country-key-dropdown .select2-results__option {
    padding: 8px 10px;
    color: var(--tabbo-country-key-color);
    font: 400 18px/1.25 Arial, Vazirmatn, Cairo, "Segoe UI", sans-serif;
}

.tabbo-country-key-dropdown
    .select2-results__option--highlighted[aria-selected] {
    background: #eef8fc;
    color: var(--tabbo-country-key-color);
}

.tabbo-country-key-option {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 9px;
    direction: rtl;
}

.tabbo-country-key-option-code {
    direction: ltr;
    unicode-bidi: isolate;
}

select.country_code + .select2-container .select2-selection__arrow,
select.MobileCountryCode + .select2-container .select2-selection__arrow,
.select2-container.tabbo-country-key-select2 .select2-selection__arrow {
    position: absolute !important;
    top: 0 !important;
    right: auto !important;
    bottom: auto !important;
    left: 0 !important;
    width: 22px !important;
    height: 100% !important;
    margin: 0 !important;
}

select.country_code + .select2-container .select2-selection__arrow b,
select.MobileCountryCode + .select2-container .select2-selection__arrow b,
.select2-container.tabbo-country-key-select2 .select2-selection__arrow b {
    position: absolute !important;
    top: 50% !important;
    right: auto !important;
    left: 6px !important;
    width: 8px !important;
    height: 8px !important;
    margin: 0 !important;
    border: 0 !important;
    border-right: 1.8px solid var(--tabbo-country-key-color) !important;
    border-bottom: 1.8px solid var(--tabbo-country-key-color) !important;
    transform: translateY(-72%) rotate(45deg);
}

select.country_code + .select2-container.select2-container--open .select2-selection__arrow b,
select.MobileCountryCode + .select2-container.select2-container--open .select2-selection__arrow b,
.select2-container.tabbo-country-key-select2.select2-container--open .select2-selection__arrow b {
    transform: translateY(-28%) rotate(225deg);
}

/*
 * Native fallback: this keeps dimensions and colors consistent on a page
 * where Select2 is intentionally unavailable. Select2-enhanced fields use
 * the richer circular flag treatment above.
 */
select.country_code:not(.select2-hidden-accessible),
select.MobileCountryCode:not(.select2-hidden-accessible) {
    box-sizing: border-box;
    width: var(--tabbo-country-key-width) !important;
    max-width: var(--tabbo-country-key-width) !important;
    min-width: var(--tabbo-country-key-width);
    max-height: var(--tabbo-country-key-height);
    height: var(--tabbo-country-key-height) !important;
    padding: 0 6px !important;
    border: 0 !important;
    border-radius: var(--tabbo-country-key-radius) !important;
    outline: 0;
    background-color: var(--tabbo-country-key-bg) !important;
    color: var(--tabbo-country-key-color) !important;
    direction: ltr;
    font: 400 18px/1 Arial, Vazirmatn, Cairo, "Segoe UI", sans-serif !important;
}

.mobile_country_div,
.newMobileCountryCode,
.mobile_and_country_code {
    align-items: stretch;
    gap: 8px !important;
}
