.phone-country-field {
    position: relative;
    display: flex;
    align-items: stretch;
    width: 100%;
    direction: ltr;
}

.phone-country-field .portal-input-premium,
.phone-country-field .form-control,
.phone-country-field input[type="tel"],
.phone-country-field input[type="text"] {
    direction: ltr;
    text-align: left;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.phone-country-trigger {
    min-width: 112px;
    border: 1px solid var(--border, #d9e2ec);
    border-right: 0;
    border-radius: 12px 0 0 12px;
    background: var(--surface, #fff);
    color: var(--text-main, #142433);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0 0.65rem;
}

.phone-country-trigger:focus {
    outline: 2px solid rgba(var(--primary-rgb, 13, 18, 31), 0.22);
    outline-offset: 2px;
}

.phone-country-flag {
    width: 24px;
    min-width: 24px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    line-height: 1;
    overflow: hidden;
    border-radius: 3px;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.phone-country-flag-img {
    display: block;
    width: 24px;
    height: 18px;
    object-fit: cover;
}

.phone-country-code {
    direction: ltr;
    unicode-bidi: isolate;
}

.phone-country-menu {
    position: absolute;
    z-index: 2400;
    top: calc(100% + 8px);
    left: 0;
    width: min(340px, 100%);
    max-height: 320px;
    overflow: hidden;
    display: none;
    border: 1px solid var(--border, #d9e2ec);
    border-radius: 16px;
    background: var(--surface, #fff);
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.16);
    direction: rtl;
}

.phone-country-field.is-open .phone-country-menu {
    display: block;
}

.phone-country-search {
    width: calc(100% - 1rem);
    margin: 0.5rem;
    border: 1px solid var(--border, #d9e2ec);
    border-radius: 12px;
    padding: 0.65rem 0.8rem;
    color: var(--text-main, #142433);
    background: var(--bg-soft, #f8fafc);
    font: inherit;
}

.phone-country-options {
    max-height: 248px;
    overflow-y: auto;
    padding: 0.3rem;
}

.phone-country-option {
    width: 100%;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-main, #142433);
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.58rem 0.65rem;
    cursor: pointer;
    text-align: right;
    font: inherit;
}

.phone-country-option:hover,
.phone-country-option.is-active {
    background: rgba(var(--primary-rgb, 13, 18, 31), 0.08);
}

.phone-country-option.is-filtered-out {
    display: none;
}

.phone-country-option-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.phone-country-option-code {
    direction: ltr;
    unicode-bidi: isolate;
    color: var(--text-muted, #6b7280);
    font-weight: 700;
}

@media (max-width: 575.98px) {
    .phone-country-field {
        flex-wrap: nowrap;
    }

    .phone-country-trigger {
        min-width: 96px;
    }

    .phone-country-menu {
        width: 100%;
    }
}
