.rv-phone-contact {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.rv-phone-contact .visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.rv-phone-contact-row {
    display: grid;
    grid-template-columns: minmax(180px, 0.9fr) minmax(0, 1.2fr);
    gap: 12px;
    align-items: start;
    width: 100%;
    max-width: 100%;
}

.rv-phone-country,
.rv-phone-number {
    min-width: 0;
    position: relative;
}

.rv-phone-country-native,
.rv-phone-country-btn,
.rv-phone-country-search,
.rv-phone-number input {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.rv-phone-country-native {
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid var(--border, #d7dde5);
    border-radius: 8px;
    background: #fff;
    color: inherit;
}

.rv-phone-contact.is-enhanced .rv-phone-country-native {
    display: none !important;
}

.rv-phone-contact:not(.is-enhanced) .rv-phone-country-btn,
.rv-phone-contact:not(.is-enhanced) .rv-phone-country-panel {
    display: none !important;
}

.rv-phone-country-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid var(--border, #d7dde5);
    border-radius: 8px;
    background: #fff;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.rv-phone-country-btn span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rv-phone-country-btn::after {
    content: '▾';
    color: #6b7280;
    flex: 0 0 auto;
}

.rv-phone-country-panel {
    position: absolute;
    z-index: 40;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    max-height: min(320px, 60vh);
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--border, #d7dde5);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
}

.rv-phone-country-panel[hidden] {
    display: none !important;
}

.rv-phone-country-search {
    min-height: 38px;
    padding: 0 10px;
    border: 1px solid var(--border, #d7dde5);
    border-radius: 6px;
}

.rv-phone-country-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow: auto;
    max-height: 240px;
}

.rv-phone-country-option,
.rv-phone-country-empty {
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
}

.rv-phone-country-option:hover,
.rv-phone-country-option:focus,
.rv-phone-country-option.is-active {
    background: #eef3ff;
    outline: none;
}

.rv-phone-country-option[aria-selected="true"],
.rv-phone-country-option.is-current {
    background: #e8eefc;
    font-weight: 600;
}

.rv-phone-number-wrap {
    display: flex;
    align-items: stretch;
    gap: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    border: 1px solid var(--border, #d7dde5);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.rv-phone-prefix {
    display: inline-flex;
    align-items: center;
    padding: 0 10px;
    color: #6b7280;
    background: #f7f8fa;
    border-right: 1px solid var(--border, #d7dde5);
    white-space: nowrap;
}

.rv-phone-prefix:empty {
    display: none;
}

.rv-phone-number-wrap input {
    border: 0 !important;
    border-radius: 0 !important;
    min-height: 42px;
    padding: 0 12px;
    background: transparent;
}

.rv-master-admin .rv-phone-country-native,
.rv-master-admin .rv-phone-country-btn,
.rv-master-admin .rv-phone-country-panel,
.rv-master-admin .rv-phone-country-search,
.rv-master-admin .rv-phone-number-wrap {
    background: var(--rv-ma-input, #22252a);
    border-color: var(--rv-ma-border, #2a2d33);
    color: var(--rv-ma-text, #f2f3f5);
}

.rv-master-admin .rv-phone-prefix {
    background: var(--rv-ma-panel-2, #1b1d20);
    border-right-color: var(--rv-ma-border, #2a2d33);
    color: var(--rv-ma-muted, #9aa0a8);
}

.rv-master-admin .rv-phone-country-option:hover,
.rv-master-admin .rv-phone-country-option:focus,
.rv-master-admin .rv-phone-country-option.is-active,
.rv-master-admin .rv-phone-country-option[aria-selected="true"] {
    background: #2a3140;
}

@media (max-width: 768px) {
    .rv-phone-contact-row {
        grid-template-columns: 1fr;
    }

    .rv-phone-country-panel {
        max-height: min(280px, 55vh);
    }
}
