/**
 * Gravity Forms + intl-tel-input v17 layout hardening.
 *
 * Goal: one visual input. The country selector (flag + dial code + arrow)
 * stays inside the field on the left, and the typed national number starts
 * after it. A small JS helper sets --wg-iti-left-pad to the measured selector
 * width so theme/GF input padding cannot make the two overlap.
 */

.ginput_container_intl_phone {
    width: 100%;
}

.ginput_container_intl_phone .iti {
    --wg-iti-left-pad: 112px;
    position: relative !important;
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
}

.ginput_container_intl_phone .iti *,
.ginput_container_intl_phone .iti *::before,
.ginput_container_intl_phone .iti *::after {
    box-sizing: border-box !important;
}

/* Visible phone input. Keep the theme's border/radius, but reserve the
 * selector's measured width on the left. */
.ginput_container_intl_phone .iti input[type="tel"].gf-intl-phone-input {
    position: relative !important;
    z-index: 0 !important;
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding-left: var(--wg-iti-left-pad) !important;
    padding-inline-start: var(--wg-iti-left-pad) !important;
    text-indent: 0 !important;
    background-image: none !important;
}

/* Country selector inside the left side of the input. */
.ginput_container_intl_phone .iti--allow-dropdown .iti__flag-container,
.ginput_container_intl_phone .iti--separate-dial-code .iti__flag-container {
    position: absolute !important;
    z-index: 3 !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    right: auto !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

.ginput_container_intl_phone .iti__selected-flag,
.ginput_container_intl_phone .iti--separate-dial-code .iti__selected-flag {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 0 !important;
    width: auto !important;
    height: 100% !important;
    min-height: 100% !important;
    margin: 0 !important;
    padding: 0 12px !important;
    background: transparent !important;
    border: 0 !important;
    border-right: 1px solid rgba(0, 0, 0, 0.12) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    white-space: nowrap !important;
}

.ginput_container_intl_phone .iti--allow-dropdown .iti__flag-container:hover .iti__selected-flag,
.ginput_container_intl_phone .iti--separate-dial-code .iti__flag-container:hover .iti__selected-flag {
    background-color: rgba(0, 0, 0, 0.035) !important;
}

/* Flag sprite. The actual image URL is also injected inline by PHP with an
 * absolute plugin URL, so CSS optimisers/CDNs cannot break the relative URL. */
.ginput_container_intl_phone .iti__selected-flag .iti__flag,
.ginput_container_intl_phone .iti__country .iti__flag {
    position: relative !important;
    display: block !important;
    flex: 0 0 auto !important;
    min-width: 20px !important;
    max-width: 20px !important;
    height: 15px;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: 0 0 1px 0 #888 !important;
    background-repeat: no-repeat !important;
}

.ginput_container_intl_phone .iti__selected-dial-code {
    position: static !important;
    display: inline-block !important;
    flex: 0 0 auto !important;
    width: auto !important;
    margin: 0 0 0 8px !important;
    padding: 0 !important;
    color: inherit !important;
    line-height: 1 !important;
    white-space: nowrap !important;
}

.ginput_container_intl_phone .iti__arrow {
    position: static !important;
    display: block !important;
    flex: 0 0 auto !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 0 0 9px !important;
    padding: 0 !important;
    border-left: 4px solid transparent !important;
    border-right: 4px solid transparent !important;
    border-top: 5px solid currentColor !important;
    border-bottom: 0 !important;
    opacity: .65;
}

.ginput_container_intl_phone .iti__arrow.iti__arrow--up {
    border-top: 0 !important;
    border-bottom: 5px solid currentColor !important;
}

/* intl-tel-input menu visibility. */
.ginput_container_intl_phone .iti__hide,
.ginput_container_intl_phone .iti__country-list.iti__hide {
    display: none !important;
}

.ginput_container_intl_phone .iti__country-list {
    position: absolute !important;
    z-index: 999999 !important;
    left: 0 !important;
    right: auto !important;
    width: max-content !important;
    min-width: 280px !important;
    max-width: min(440px, calc(100vw - 30px)) !important;
    max-height: 260px !important;
    margin: 0 0 0 -1px !important;
    padding: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    list-style: none !important;
    text-align: left !important;
    white-space: nowrap !important;
    background: #fff !important;
    border: 1px solid #ccc !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .14) !important;
}

.ginput_container_intl_phone .iti__country {
    display: flex !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 8px 10px !important;
    list-style: none !important;
    line-height: 1.35 !important;
    cursor: pointer !important;
}

.ginput_container_intl_phone .iti__country.iti__highlight {
    background-color: rgba(0, 0, 0, .05) !important;
}

.ginput_container_intl_phone .iti__flag-box {
    display: inline-flex !important;
    align-items: center !important;
    width: 20px !important;
    min-width: 20px !important;
    margin: 0 8px 0 0 !important;
}

.ginput_container_intl_phone .iti__country-name,
.ginput_container_intl_phone .iti__dial-code {
    display: inline-block !important;
    vertical-align: middle !important;
}

.ginput_container_intl_phone .iti__country-name {
    margin-right: 6px !important;
}

.ginput_container_intl_phone .iti__dial-code {
    color: #777 !important;
}

@media (max-width: 500px) {
    .ginput_container_intl_phone .iti__country-list {
        min-width: min(300px, calc(100vw - 30px)) !important;
        white-space: normal !important;
    }
}

/* -------------------------------------------------------------------------
 * Site-matched, understated country selector skin.
 * Keep typography neutral instead of inheriting theme link/accent colours.
 * ---------------------------------------------------------------------- */
.ginput_container_intl_phone .iti__selected-dial-code {
    color: #4f4f4f !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    letter-spacing: 0 !important;
}

.ginput_container_intl_phone .iti__arrow {
    color: #8d837a !important;
    opacity: .75 !important;
}

.ginput_container_intl_phone .iti__selected-flag,
.ginput_container_intl_phone .iti--separate-dial-code .iti__selected-flag {
    border-right-color: #e5d9cd !important;
}

.ginput_container_intl_phone .iti__country-list {
    background: #fffdfb !important;
    border-color: #dfd5cb !important;
    border-radius: 0 0 4px 4px !important;
    box-shadow: 0 5px 16px rgba(52, 42, 33, .10) !important;
    color: #464646 !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    letter-spacing: 0 !important;
}

.ginput_container_intl_phone .iti__country {
    min-height: 42px !important;
    padding: 9px 12px !important;
    color: #464646 !important;
    font-size: 15px !important;
    font-weight: 400 !important;
    line-height: 1.35 !important;
    text-decoration: none !important;
}

.ginput_container_intl_phone .iti__country-name {
    color: #464646 !important;
    font-size: 15px !important;
    font-weight: 400 !important;
    text-decoration: none !important;
}

.ginput_container_intl_phone .iti__dial-code {
    color: #85817d !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    text-decoration: none !important;
}

.ginput_container_intl_phone .iti__country.iti__highlight,
.ginput_container_intl_phone .iti__country:hover {
    background: #f7f3ef !important;
    color: #333 !important;
}

.ginput_container_intl_phone .iti__country.iti__active {
    background: #f4efea !important;
}

.ginput_container_intl_phone .iti__divider {
    margin: 4px 0 !important;
    border-bottom-color: #ece4dc !important;
}
