/**
 * Phone attribute widget — self-contained, theme-portable styling.
 *
 * Everything is scoped under .phone-attribute-wrapper so it renders
 * consistently on any storefront theme and in the admin, with no external
 * dependency (replaces the old select2 + CDN approach). The country flag is
 * drawn inside the field on the left; JS (phone-attribute.js) keeps it in
 * sync with the native <select> and serializes the value.
 */

.phone-attribute-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.phone-attribute-wrapper .phone-country-wrapper {
    position: relative;
    flex: 0 0 46%;
    min-width: 0;
}

.phone-attribute-wrapper .phone-number-wrapper {
    flex: 1 1 auto;
    min-width: 0;
}

/* Flag chip inside the country field */
.phone-attribute-wrapper .phone-flag {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 16px;
    display: inline-flex;
    border-radius: 3px;
    overflow: hidden;
    pointer-events: none;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, .1);
    background: #eef2f7;
}
.phone-attribute-wrapper .phone-flag img {
    width: 22px;
    height: 16px;
    display: block;
    object-fit: cover;
}
.phone-attribute-wrapper .phone-flag img[src=""],
.phone-attribute-wrapper .phone-flag img:not([src]) { display: none; }

/* Fields (specificity kept high enough to win over generic theme/.form-control rules) */
.phone-attribute-wrapper .phone-country-wrapper .phone-country-select,
.phone-attribute-wrapper .phone-number-wrapper .phone-number-input {
    display: block;
    width: 100%;
    height: auto;
    min-height: 48px;
    margin: 0;
    padding: 12px 14px;
    font-size: 15px;
    line-height: 1.4;
    color: #0f172a;
    background-color: #fff;
    border: 1px solid #d9e0ea;
    border-radius: 11px;
    box-shadow: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.phone-attribute-wrapper .phone-country-wrapper .phone-country-select {
    padding-right: 38px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 13px center;
}
.phone-attribute-wrapper .phone-country-wrapper.has-flag .phone-country-select {
    padding-left: 44px;
}

.phone-attribute-wrapper .phone-country-select:focus,
.phone-attribute-wrapper .phone-number-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}

.phone-attribute-wrapper .phone-country-select::-ms-expand { display: none; }
.phone-attribute-wrapper .phone-number-input::placeholder { color: #9aa6b6; }

.phone-attribute-wrapper .phone-number-input.is-invalid,
.phone-attribute-wrapper .phone-country-select.is-invalid {
    border-color: #e2574c;
    box-shadow: 0 0 0 3px rgba(226, 87, 76, .14);
}

@media (max-width: 560px) {
    .phone-attribute-wrapper {
        flex-direction: column;
        gap: 8px;
    }
    .phone-attribute-wrapper .phone-country-wrapper {
        flex-basis: auto;
        width: 100%;
    }
}
