/**
 * ppvalidatephone — phone country-prefix selector
 *
 * Theme-agnostic input-group that visually merges with the phone <input> next
 * to it. Hides the native <select> arrow and full text; an overlay span shows
 * a compact "🇱🇹 +370" label. The select stays interactive underneath
 * (clickable, keyboard-accessible, type-ahead) — only its rendered text and
 * arrow are hidden.
 */

.ppvalidatephone-input-group {
    position: relative;
    display: inline-flex;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    isolation: isolate;
}

/* Native select — visually hidden but functional. Sits on top of the display
 * overlay so clicks open the dropdown and keyboard focus works. */
.ppvalidatephone-input-group > .ppvalidatephone-prefix {
    position: absolute;
    inset: 0 auto 0 0;
    width: 6rem;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: transparent;
    font: inherit;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    z-index: 2;
}

/* Hide the native select's option text & arrow when closed. The dropdown panel
 * (when open) is browser-native and shows full option text via the overlay. */
.ppvalidatephone-input-group > .ppvalidatephone-prefix:focus {
    outline: 0;
}

/* Restore option text color in the open dropdown panel — the closed select uses
 * `color: transparent` to hide its own rendered text, which some browsers
 * inherit into the popup. */
.ppvalidatephone-input-group > .ppvalidatephone-prefix option {
    color: #1a1a1a;
    background-color: #fff;
}

/* Display overlay: shows the compact "flag + prefix" label. Pointer-events
 * disabled so clicks pass through to the native select underneath. */
.ppvalidatephone-prefix-display {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    flex: 0 0 auto;
    width: 6rem;
    height: 100%;
    padding: 0 0.65rem 0 0.85rem;
    font-size: 0.95em;
    font-weight: 500;
    color: #1a1a1a;
    background-color: #f3f5f7;
    border: 1px solid #d4d8dc;
    border-right: 0;
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
    pointer-events: none;
    user-select: none;
    box-sizing: border-box;
    /* Custom chevron */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%23667085' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    padding-right: 1.6rem;
}

.ppvalidatephone-prefix-display__flag {
    font-size: 1.1em;
    line-height: 1;
    /* Emoji flags use color fonts — keep them rendering full-color even inside
     * inputs that force `color: ...` on text. */
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol",
        "Noto Color Emoji", sans-serif;
}

.ppvalidatephone-prefix-display__code {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
}

/* The phone input on the right: kill the left border-radius so it visually
 * fuses with the prefix block. Theme-supplied border, height, padding all
 * remain untouched. */
.ppvalidatephone-input-group > input[type="text"],
.ppvalidatephone-input-group > input[type="tel"],
.ppvalidatephone-input-group > input:not([type]) {
    flex: 1 1 auto;
    min-width: 0;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    box-sizing: border-box;
}

/* Hover & focus polish on the prefix block */
.ppvalidatephone-input-group:hover .ppvalidatephone-prefix-display {
    background-color: #eceff3;
}

.ppvalidatephone-input-group:focus-within .ppvalidatephone-prefix-display {
    border-color: #1f7a73; /* matches typical theme primary; harmless fallback */
    box-shadow: 0 0 0 3px rgba(31, 122, 115, 0.12);
    z-index: 3;
}

/* When the phone input is focused, the wrapper :focus-within wins; nothing
 * else needed. */

/* Disabled state — propagate from the underlying select */
.ppvalidatephone-input-group > .ppvalidatephone-prefix:disabled
    ~ .ppvalidatephone-prefix-display {
    opacity: 0.6;
    cursor: not-allowed;
}
