/*
 * VoVo country picker and phone field (public/js/vovo-phone.js).
 *
 * Windows has no flag pictures of its own, so flags come from the Twemoji
 * Country Flags font beside this file. It holds only the flag letters, so it
 * changes nothing else on the page.
 */
@font-face {
    font-family: 'Twemoji Country Flags';
    src: url('../fonts/vovo-flags/TwemojiCountryFlags.woff2') format('woff2');
    unicode-range: U+1F1E6-1F1FF;
    font-display: swap;
}

.vovo-flag {
    font-family: 'Twemoji Country Flags', 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
    font-style: normal;
    font-weight: 400;
    line-height: 1;
}

/* Phone field: the picker sits inside the left edge of the number box. */
.vovo-phone {
    position: relative;
    display: block;
    width: 100%;
}

.vovo-phone .vovo-phone__number {
    width: 100%;
    padding-left: calc(4.1em + var(--vovo-dial, 1) * 0.62em) !important;
}

.vovo-phone > .vovo-cp {
    position: absolute;
    inset: 0 auto 0 0;
    z-index: 2;
    display: flex;
}

.vovo-phone > .vovo-cp > .vovo-cp__button {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    height: 100%;
    margin: 0;
    padding: 0 0.5em 0 0.75em;
    border: 0;
    border-right: 1px solid color-mix(in srgb, currentColor 22%, transparent);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: inherit;
    font: inherit;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    cursor: pointer;
}

/* Country field: the button takes the look of the select it stands in for. */
.vovo-cp--name {
    position: relative;
    display: block;
    width: 100%;
}

.vovo-cp--name > .vovo-cp__button {
    display: flex;
    align-items: center;
    gap: 0.55em;
    width: 100%;
    margin: 0;
    text-align: left;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: none;
}

.vovo-cp--name > .vovo-cp__button .vovo-cp__label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vovo-cp__button .vovo-flag {
    font-size: 1.15em;
}

.vovo-cp__button .vovo-flag:empty {
    display: none;
}

.vovo-cp__button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.vovo-cp__button:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: -2px;
}

.vovo-cp__chevron {
    flex: 0 0 auto;
    width: 0.85em;
    height: 0.85em;
    opacity: 0.6;
}

/* For a page that already draws its own arrow beside the select. */
.vovo-cp--no-chevron > .vovo-cp__button .vovo-cp__chevron {
    display: none;
}

.vovo-cp--no-chevron > .vovo-cp__button {
    padding-right: 2.75rem;
}

/* The select stays in the form for its value and the browser's own checks, out of sight. */
.vovo-cp > select.vovo-cp__native {
    position: absolute !important;
    inset: auto auto 0 0 !important;
    width: 1px !important;
    height: 1px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.vovo-cp__panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 70;
    box-sizing: border-box;
    width: max(100%, 19rem);
    max-width: min(24rem, 92vw);
    padding: 0.4rem;
    border: 1px solid color-mix(in srgb, var(--vovo-cp-fg, #111827) 22%, transparent);
    border-radius: 0.6rem;
    background: var(--vovo-cp-bg, #ffffff);
    color: var(--vovo-cp-fg, #111827);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
    font-size: 0.9375rem;
    line-height: 1.3;
    text-align: left;
}

.vovo-cp__panel[hidden] {
    display: none;
}

.vovo-cp__panel--up {
    top: auto;
    bottom: calc(100% + 4px);
}

.vovo-cp__panel .vovo-cp__search {
    box-sizing: border-box;
    display: block;
    width: 100%;
    min-height: 2.5rem;
    margin: 0 0 0.35rem;
    padding: 0.45rem 0.65rem;
    border: 1px solid color-mix(in srgb, var(--vovo-cp-fg, #111827) 28%, transparent);
    border-radius: 0.45rem;
    background: transparent;
    box-shadow: none;
    color: inherit;
    font: inherit;
}

.vovo-cp__panel .vovo-cp__search:focus {
    outline: 2px solid color-mix(in srgb, var(--vovo-cp-fg, #111827) 55%, transparent);
    outline-offset: 0;
}

.vovo-cp__list {
    position: relative;
    max-height: 15rem;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
}

.vovo-cp__list > li {
    display: flex;
    align-items: center;
    gap: 0.6em;
    min-height: 2.5rem;
    margin: 0;
    padding: 0.3rem 0.6rem;
    border-radius: 0.4rem;
    cursor: pointer;
}

.vovo-cp__list > li .vovo-flag {
    flex: 0 0 auto;
    font-size: 1.2em;
}

.vovo-cp__list > li .vovo-cp__name {
    flex: 1 1 auto;
    min-width: 0;
}

.vovo-cp__list > li .vovo-cp__dial {
    flex: 0 0 auto;
    opacity: 0.7;
    font-variant-numeric: tabular-nums;
}

.vovo-cp__list > li:hover,
.vovo-cp__list > li.vovo-cp__option--active {
    background: color-mix(in srgb, var(--vovo-cp-fg, #111827) 12%, transparent);
}

.vovo-cp__list > li[aria-selected='true'] .vovo-cp__name {
    font-weight: 600;
}

.vovo-cp__empty {
    margin: 0;
    padding: 0.6rem;
    opacity: 0.75;
}
