/**
 * International Phone Field for Gravity Forms — Styles v1.1.0
 */

/* ── CDN flag sprite URLs ────────────────────────────────────────────────── */
:root {
    --iti-path-flags-1x: url("https://cdn.jsdelivr.net/npm/intl-tel-input@23.1.1/build/img/flags.png");
    --iti-path-flags-2x: url("https://cdn.jsdelivr.net/npm/intl-tel-input@23.1.1/build/img/flags@2x.png");
}

/* ── Flag sprite ─────────────────────────────────────────────────────────── */
.gfield--type-phone .iti .iti__flag,
.gfield_type_phone  .iti .iti__flag {
    background-image:    url("https://cdn.jsdelivr.net/npm/intl-tel-input@23.1.1/build/img/flags.png") !important;
    background-position: var(--iti-flag-offset) 0 !important;
    background-size:     var(--iti-flag-sprite-width) var(--iti-flag-sprite-height) !important;
    background-repeat:   no-repeat !important;
    width:  20px !important;
    height: 14px !important;
    display: inline-block !important;
}

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 2dppx) {
    .gfield--type-phone .iti .iti__flag,
    .gfield_type_phone  .iti .iti__flag {
        background-image: url("https://cdn.jsdelivr.net/npm/intl-tel-input@23.1.1/build/img/flags@2x.png") !important;
    }
}

/* ── A11y span ───────────────────────────────────────────────────────────── */
.gfield--type-phone .iti .iti__a11y-text,
.gfield_type_phone  .iti .iti__a11y-text {
    position: absolute !important; width: 1px !important; height: 1px !important;
    padding: 0 !important; margin: -1px !important; overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important;
}

/* ── Wrapper: unified single-field look ─────────────────────────────────── */
/*
 * The .iti wrapper now carries the single border + border-radius.
 * overflow:hidden clips the children so corners look clean.
 * The input and flag button have no individual outer borders — only the
 * internal divider line between flag and text field remains.
 */
.gfield--type-phone .iti,
.gfield_type_phone  .iti {
    width: 100%;
    display: flex !important;
    align-items: stretch;
    border: 1px solid #d0d0d0 !important;
    border-radius: 4px !important;
    overflow: hidden;
    background: #fff;
}

/* Input: no border, no outline, left-aligned text */
.gfield--type-phone .iti input[type="tel"],
.gfield--type-phone .iti input[type="text"],
.gfield_type_phone  .iti input[type="tel"],
.gfield_type_phone  .iti input[type="text"] {
    width: 100% !important;
    box-sizing: border-box;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    text-align: left !important;
    background: transparent !important;
    padding-left: 10px !important;
}

/* Flag + dial-code button: no outer border, just the right-side divider */
.gfield--type-phone .iti--separate-dial-code .iti__selected-flag,
.gfield_type_phone  .iti--separate-dial-code .iti__selected-flag {
    background-color: transparent !important;
    border: none !important;
    border-right: 1px solid #d0d0d0 !important;
    border-radius: 0 !important;
    padding: 0 8px;
    margin: 0;
}

/* Focus ring on the wrapper instead of the input */
.gfield--type-phone .iti:focus-within,
.gfield_type_phone  .iti:focus-within {
    border-color: #4a90e2 !important;
    box-shadow: 0 0 0 2px rgba(74,144,226,.2) !important;
}

.gfield--type-phone .iti--separate-dial-code .iti__selected-dial-code,
.gfield_type_phone  .iti--separate-dial-code .iti__selected-dial-code {
    font-size: 14px;
    color: #444;
    margin-left: 4px;
}

/* ── Dropdown visibility ─────────────────────────────────────────────────── */
.gfield--type-phone .iti .iti__dropdown-content,
.gfield_type_phone  .iti .iti__dropdown-content,
.gfield--type-phone .iti .iti__country-list,
.gfield_type_phone  .iti .iti__country-list {
    display: none !important;
}

.gfield--type-phone .iti .iti__dropdown-content:not(.iti__hide),
.gfield--type-phone .iti.iti--open .iti__dropdown-content,
.gfield_type_phone  .iti.iti--open .iti__dropdown-content {
    display: block !important;
    z-index: 99999 !important;
    background: #fff !important;
    border: 1px solid #d0d0d0 !important;
    border-radius: 4px !important;
    box-shadow: 0 4px 16px rgba(0,0,0,.12) !important;
    min-width: 260px;
}

.gfield--type-phone .iti .iti__dropdown-content:not(.iti__hide) .iti__country-list,
.gfield_type_phone .iti .iti__dropdown-content:not(.iti__hide) .iti__country-list,
.gfield--type-phone .iti.iti--open .iti__country-list,
.gfield_type_phone .iti.iti--open .iti__country-list {
    display: block !important;
    max-height: 200px;
    overflow-y: auto;
}

/* ── Country list items ──────────────────────────────────────────────────── */
.iti__country {
    display:        flex !important;
    flex-direction: row !important;
    align-items:    center !important;
    padding:        6px 10px !important;
    gap:            8px !important;
    cursor:         pointer !important;
    white-space:    nowrap;
}

.iti__flag-box {
    display:     flex !important;
    align-items: center !important;
    flex-shrink: 0 !important;
    width:       auto !important;
    min-width:   20px !important;
}

.iti__country-name {
    flex:          1 !important;
    white-space:   nowrap !important;
    overflow:      hidden !important;
    text-overflow: ellipsis !important;
}

.iti__dial-code {
    flex-shrink: 0 !important;
    margin-left: 4px !important;
    color:       #888 !important;
    font-size:   13px !important;
}

/* ── Search input ────────────────────────────────────────────────────────── */
.iti__search-input {
    display:        block !important;
    width:          100% !important;
    min-height:     36px !important;
    box-sizing:     border-box !important;
    padding:        8px 10px !important;
    border:         none !important;
    border-bottom:  1px solid #eee !important;
    outline:        none !important;
    font-size:      14px !important;
    background:     #fff !important;
    pointer-events: auto !important;
    cursor:         text !important;
}

/* ── Hover / active highlight ────────────────────────────────────────────── */
.iti__country.iti__highlight,
.iti__country:hover {
    background-color: #f0f4ff !important;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .gfield--type-phone .iti .iti__dropdown-content:not(.iti__hide),
.gfield--type-phone .iti.iti--open .iti__dropdown-content,
    .gfield_type_phone  .iti.iti--open .iti__dropdown-content,
    .gfield--type-phone .iti.iti--open .iti__country-list,
    .gfield_type_phone  .iti.iti--open .iti__country-list {
        min-width: 220px;
    }
}
