/* intl-tel-input integration for the sign up and profile phone fields. */

.phone-field {
    position: relative;
}

.phone-field .iti {
    display: block;
    width: 100%;
}

.phone-field .iti__country-list {
    z-index: 1055;
}

/* Sign up forms: keep the custom underlined floating label styling. */
.form-floating.phone-field .iti__tel-input {
    padding-top: 30px !important;
    padding-right: 0 !important;
    padding-bottom: 8px !important;
    padding-left: 95px !important;
}

.form-floating.phone-field > label {
    left: 95px;
    pointer-events: none;
}

/* The input is wrapped by intl-tel-input, so the default `input ~ label`
   selectors no longer match and we replicate them from the wrapper. */
.form-floating.phone-field .iti:has(.iti__tel-input:focus) + label,
.form-floating.phone-field .iti:has(.iti__tel-input:not(:placeholder-shown)) + label {
    padding: 15px 0 0;
    opacity: 1;
    border: none;
    left: -3px;
    color: #262627;
}

@media (max-width: 767px) {
    .form-floating.phone-field .iti:has(.iti__tel-input:focus) + label,
    .form-floating.phone-field .iti:has(.iti__tel-input:not(:placeholder-shown)) + label {
        height: 40px;
    }
}

/* Keep the flag aligned with the text line of the taller sign up fields. */
.form-floating.phone-field .iti__country-container {
    padding: 24px 6px 8px 0;
}

.form-floating.phone-field .iti__selected-country {
    font-size: 16px;
    color: #262627;
    padding-right: 6px;
}

.form-floating.phone-field .iti__selected-dial-code {
    margin-left: 6px;
    font-weight: 500;
}

.form-floating.phone-field .iti__arrow {
    margin-left: 4px;
}

/* Profile page field. */
.edit-profile-page .phone-field .iti__tel-input {
    border: 1px solid #c4c4c4;
    border-radius: 2px;
    padding: 8px 12px 8px 95px !important;
    font-size: 16px;
}

.edit-profile-page .phone-field .iti__selected-country {
    font-size: 14px;
}

.edit-profile-page .phone-field .iti__selected-dial-code {
    margin-left: 6px;
}

.edit-profile-page .phone-field .iti__country-container {
    padding-left: 4px;
}

/* Required/ invalid phone field styling (shared by sign up and profile). */
#error-contact_number {
    color: #ff5353;
}

.phone-field.has-error .iti__tel-input {
    border-color: #ff5353 !important;
}
