/* Дропдаун выбора страны телефона (порт nutra-core phone-country.css для старого бандла) */
.hero__form-input-container,
.section__form-input-wrapper {
    position: relative;
}

/* Отступ под кнопку выбора страны — по .phone внутри обёртки, а не по классам
   инпута: классы поля на лендах разные, а кнопка позиционирована абсолютно и
   без этого отступа накрывает начало номера. */
.phone-input-wrapper .phone,
.phone-input-wrapper input[type="tel"] {
    padding-left: var(--phone-select-gap, 64px) !important;
}

.phone-layout-rtl .phone-input-wrapper .phone,
.phone-layout-rtl .phone-input-wrapper input[type="tel"] {
    padding-left: 0 !important;
    padding-right: var(--phone-select-gap, 64px) !important;
}

.phone-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    width: 100%;
}

.phone-country-select {
    position: absolute;
    top: 0;
    left: 0;
    border: none;
    padding: 0 0.75rem;
    height: 100%;
    min-width: 50px;
    background: transparent;
    color: #0a0a0a;
    transition: border-color 150ms ease, box-shadow 150ms ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    justify-content: space-between;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.phone-country-select[disabled] {
    opacity: 0.65;
    cursor: not-allowed;
    box-shadow: none;
}

.phone-country-select:focus-visible {
    outline: none;
    border-color: #7b47ff;
    box-shadow: 0 0 0 3px rgba(123, 71, 255, 0.25);
}

/* Попап: контейнер с полем поиска и прокручиваемым списком (позиционируется из JS, выносится в body) */
.phone-country-select-popup {
    position: absolute;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 0.75rem;
    border: 1px solid rgba(10, 10, 10, 0.15);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    max-height: min(60vh, 360px);
}

/* Закрытый попап должен быть реально скрыт: display:flex выше перебивает атрибут hidden */
.phone-country-select-popup[hidden] {
    display: none;
}

.phone-country-search-wrap {
    flex: 0 0 auto;
    padding: 0.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    background: #fff;
}

.phone-country-search {
    width: 100%;
    box-sizing: border-box;
    height: 40px;
    padding: 0 0.75rem;
    border: 1px solid rgba(10, 10, 10, 0.2);
    border-radius: 0.5rem;
    /* >=16px — чтобы iOS не зумил страницу при фокусе на поиск */
    font-size: 16px;
    line-height: 1.2;
    color: #0a0a0a;
    background: #fff;
    outline: none;
}

.phone-country-search:focus {
    border-color: var(--accent-green, #59b149);
    box-shadow: 0 0 0 2px rgba(89, 177, 73, 0.2);
}

.phone-country-select-list {
    flex: 1 1 auto;
    margin: 0;
    padding: 0.15rem 0;
    list-style: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.phone-country-noresults {
    padding: 1rem;
    text-align: center;
    color: #787878;
    font-size: 0.9rem;
}

.phone-country-select-item {
    cursor: pointer;
    padding: 0.6rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.phone-country-select-item+.phone-country-select-item {
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.phone-country-select-item:hover,
.phone-country-select-item.active {
    background: #f2efff;
}

/* Перебиваем display:flex у элемента, чтобы скрытые поиском пункты реально пропадали */
.phone-country-select-item[hidden] {
    display: none;
}

.phone-country-label {
    font-size: 0.95rem;
    font-weight: 600;
}

.phone-flag-img {
    width: 20px !important;
    min-width: 20px !important;
    max-width: 20px !important;
    height: 13px !important;
    min-height: 13px !important;
    max-height: 13px !important;
    /* прямые углы: перебиваем глобальные img-скругления лендов */
    border-radius: 0 !important;
    object-fit: cover;
    display: inline-flex;
}

.phone-flag-img-fallback {
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
}

/* Мобила: шире попап, крупнее поиск и пункты (удобнее тапать) */
@media (max-width: 600px) {
    .phone-country-select-popup {
        max-height: 55vh;
    }

    .phone-country-search {
        height: 44px;
    }

    .phone-country-select-item {
        padding: 0.8rem 1rem;
    }

    .phone-country-label {
        font-size: 1rem;
    }
}
