/* Поле телефона: кнопка страны слева внутри поля, серая маска поверх текста, подсказка под полем. */
.tbphone {
    position: relative;
    display: block;
}

/* Кнопка страны. Сброс оформления кнопок темы. */
.tbphone .tbphone-cc {
    position: absolute;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 0;
    margin: 0;
    padding: 0 8px 0 14px;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    color: inherit;
    font: inherit;
    line-height: 1;
    text-transform: none;
    cursor: pointer;
}

.tbphone .tbphone-cc:hover,
.tbphone .tbphone-cc:focus {
    background: none;
    color: inherit;
}

.tbphone .tbphone-cc:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: -6px;
    border-radius: 8px;
}

.tbphone-flag {
    display: block;
    flex: 0 0 auto;
    width: 22px;
    height: 16px;
    border-radius: 3px;
    object-fit: cover;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .08);
}

/* Уголок-стрелка */
.tbphone-caret {
    width: 6px;
    height: 6px;
    margin-top: -3px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    opacity: .5;
    transform: rotate(45deg);
    transition: transform .15s;
}

.tbphone-cc[aria-expanded="true"] .tbphone-caret {
    margin-top: 3px;
    transform: rotate(-135deg);
}

.tbphone-ghost {
    position: absolute;
    z-index: 1;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    padding-top: 0;
    padding-bottom: 0;
    border-color: transparent !important;
    background: none !important;
    color: #9aa0a6;
    white-space: pre;
    overflow: hidden;
    pointer-events: none;
}

.tbphone-ghost b {
    visibility: hidden;
    font-weight: inherit;
}

/* Всплывает под полем и не сдвигает форму: иначе при уходе из поля кнопка «Отправить» уезжает из-под курсора. */
.tbphone-hint {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 3;
    display: none;
    margin-top: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    background: #333;
    color: #fff;
    font-size: 12px;
    line-height: 1.3;
    white-space: nowrap;
    pointer-events: none;
}

.tbphone.is-focused .tbphone-hint {
    display: block;
}

/* Пока под полем текст ошибки, подсказка его не закрывает. */
.tbphone.is-focused .wpcf7-not-valid ~ .tbphone-hint {
    display: none;
}

/* ---------- Список стран ---------- */

.tbphone-panel {
    position: fixed;
    z-index: 2147483000; /* выше попапов Popup Maker */
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .16), 0 2px 6px rgba(0, 0, 0, .06);
    color: #1f2937;
    font-family: inherit;
    font-size: 15px;
    text-align: left;
}

.tbphone-panel[hidden] {
    display: none;
}

.tbphone-panel .tbphone-search {
    flex: 0 0 auto;
    box-sizing: border-box;
    width: auto;
    height: 40px;
    margin: 8px 8px 4px;
    padding: 0 12px 0 36px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%239ca3af' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 12px center;
    color: inherit;
    font: inherit;
    font-size: 16px; /* иначе iOS увеличивает страницу при фокусе */
    box-shadow: none;
    outline: none;
}

.tbphone-panel .tbphone-search:focus {
    border-color: #93c5fd;
    background-color: #fff;
}

.tbphone-list {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    margin: 0;
    padding: 4px 0 6px;
    overflow-y: auto;
    overscroll-behavior: contain;
    list-style: none;
}

.tbphone-option {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 6px;
    padding: 8px 10px;
    border-radius: 8px;
    line-height: 1.3;
    cursor: pointer;
}

.tbphone-option[hidden],
.tbphone-sep[hidden],
.tbphone-empty[hidden] {
    display: none;
}

.tbphone-option.is-active {
    background: #f1f5f9;
}

.tbphone-option[aria-selected="true"] {
    font-weight: 600;
}

.tbphone-option[aria-selected="true"]::after {
    content: "";
    flex: 0 0 auto;
    width: 5px;
    height: 10px;
    margin: -3px 4px 0 2px;
    border-right: 2px solid #2563eb;
    border-bottom: 2px solid #2563eb;
    transform: rotate(45deg);
}

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

.tbphone-code {
    flex: 0 0 auto;
    color: #6b7280;
    font-weight: 400;
    font-variant-numeric: tabular-nums;
}

.tbphone-sep {
    height: 1px;
    margin: 6px 16px;
    background: #e5e7eb;
}

.tbphone-empty {
    padding: 16px;
    color: #6b7280;
    text-align: center;
}

@media (hover: hover) {
    .tbphone-option:hover {
        background: #f1f5f9;
    }
}
