/* The number field of number_form, which adds this file with the picker's own stylesheet on the number step only
   (login.php, link.php). It does not go through RTLCSS: no left or right; the field is LTR in both languages. */

/* As wide as the code field (styles.css), with or without the picker. */
.auth_whatsapp-phone,
.auth_whatsapp-number .iti,
.auth_whatsapp-number .form-control[dir] {
    width: 100%;
    max-width: 20.5rem;
}

/* 16px at least, as the code field: iOS zooms into smaller text. */
.auth_whatsapp-number .form-control[dir] {
    font-size: max(16px, 1em); /* stylelint-disable-line csstree/validator */
}

/* Room for the picker's flag (amd/src/phone_input.js): 92px at a 15px root, 96px at 16px, with a 3-digit code, until
   it marks the field, 10 s at most. */
body.jsenabled input[data-auth-whatsapp-allowed]:not([data-auth-whatsapp-enhanced]) {
    animation: auth_whatsapp-flag 10s steps(1);
}

@keyframes auth_whatsapp-flag {
    from {
        padding-inline-start: calc(32px + 4rem);
    }
}

/* In that room, the picker's stand-in (number_form::display()) until phone_input removes it, 10 s at most. */
.auth_whatsapp-phone {
    position: relative;
    display: flex;
}

.auth_whatsapp-flag {
    display: none;
}

/* No box without JS, so its flag image is not fetched. Taps reach the field. */
body.jsenabled .auth_whatsapp-flag {
    display: block;
    visibility: hidden;
    pointer-events: none;
    animation: auth_whatsapp-shown 10s steps(1);
}

@keyframes auth_whatsapp-shown {
    from {
        visibility: visible;
    }
}

/* The select's row until phone_input marks the form (it hides the row itself once the picker works), 10 s at most.
   Where display cannot be animated, visibility and height still hide it. No :has() (Safari before 15.4). */
body.jsenabled .auth_whatsapp-number:not([data-auth-whatsapp-enhanced]) #fitem_id_region {
    animation: auth_whatsapp-hidden 10s steps(1);
}

@keyframes auth_whatsapp-hidden {
    from {
        display: none;
        visibility: hidden;
        height: 0;
    }
}

.auth_whatsapp-regionhint {
    width: 100%;
}

.auth_whatsapp-regionhint:empty {
    margin: 0;
}

/* RTL themes draw the invalid icon under the flag or its stand-in. */
body.jsenabled .auth_whatsapp-phone .is-invalid,
.auth_whatsapp-number .iti .is-invalid {
    background-image: none;
}

/* Focus on the flag button (mb2nl sets outline: none). */
.auth_whatsapp-number .iti__selected-country:focus-visible {
    outline: 2px solid var(--bs-primary, #0f6cbf);
    outline-offset: -2px;
}
