.xpag-locale-trigger {
    display: grid;
    place-items: center;
    flex: 0 0 34px;
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
    margin-inline-end: 8px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 50%;
    background: rgba(18, 20, 21, .86);
    color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .3);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.xpag-locale-trigger-flag {
    position: relative;
    display: block;
    width: 25px;
    height: 25px;
    overflow: hidden;
    border-radius: 50%;
    background: rgba(0, 0, 0, .2);
    font: 22px/1 system-ui, sans-serif;
}

.xpag-locale-trigger:focus-visible {
    outline: 2px solid #7bf043;
    outline-offset: 2px;
}

.xpag-locale-trigger--floating {
    position: fixed;
    z-index: 9500;
    left: 12px;
    bottom: calc(82px + env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    gap: 7px;
    width: auto;
    min-width: 0;
    min-height: 39px;
    height: 39px;
    margin: 0;
    padding: 0 12px;
    border: 1px solid #3e5146;
    border-radius: 999px;
    background: #151c18;
    color: #effaf3;
    font: 700 12px/1 system-ui, sans-serif;
}

.xpag-locale-trigger--floating .xpag-locale-trigger-flag {
    font-size: 18px;
}

.xpag-locale-backdrop {
    position: fixed;
    z-index: 99990;
    inset: 0;
    display: grid;
    place-items: center;
    box-sizing: border-box;
    padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
    background: rgba(0, 0, 0, .78);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.xpag-locale-open {
    overflow: hidden;
}

.xpag-locale-dialog {
    position: relative;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    width: min(100%, 400px);
    max-height: min(86vh, 720px);
    max-height: min(86dvh, 720px);
    overflow: hidden;
    padding: 20px 20px 18px;
    border: 1px solid rgba(255, 255, 255, .13);
    border-radius: 24px;
    background:
        radial-gradient(rgba(255, 255, 255, .035) .8px, transparent .9px) 0 0 / 9px 9px,
        linear-gradient(145deg, #242424 0%, #1a1a1a 54%, #171717 100%);
    color: #f8f8f8;
    box-shadow: 0 24px 78px rgba(0, 0, 0, .72), inset 0 1px 0 rgba(255, 255, 255, .035);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.xpag-locale-greeting {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 4px;
    margin: 0 0 1px;
    color: #ffb52e;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    text-align: center;
}

.xpag-locale-brand {
    font-weight: 600;
}

.xpag-locale-title {
    margin: 0 0 20px;
    color: #fbfbfb;
    font-size: clamp(24px, 6vw, 30px);
    font-weight: 760;
    letter-spacing: -.035em;
    line-height: 1.12;
    text-align: center;
}

.xpag-country-list {
    display: grid;
    gap: 10px;
    max-height: min(43vh, 380px);
    max-height: min(43dvh, 380px);
    overflow: auto;
    padding: 2px 2px 4px;
    overscroll-behavior: contain;
    scrollbar-color: rgba(255, 255, 255, .25) transparent;
    scrollbar-width: thin;
}

.xpag-country-card {
    position: relative;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    width: 100%;
    min-height: 64px;
    padding: 10px 112px 10px 13px;
    border: 1px solid transparent;
    border-radius: 15px;
    background: linear-gradient(105deg, #2a2a2a, #242424);
    color: #aeb0b2;
    cursor: pointer;
    text-align: left;
    transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease, color .16s ease;
    -webkit-tap-highlight-color: transparent;
}

.xpag-country-card:hover {
    background: linear-gradient(105deg, #303030, #292929);
    color: #f2f2f2;
}

.xpag-country-card:focus-visible {
    outline: 2px solid #7bf043;
    outline-offset: 2px;
}

.xpag-country-card.is-selected {
    border-color: #75f13e;
    background: linear-gradient(105deg, #37834d 0%, #328b48 46%, #16813c 100%);
    color: #fff;
    box-shadow: 0 0 0 1px rgba(117, 241, 62, .22), 0 0 17px rgba(80, 255, 50, .58), inset 0 1px 0 rgba(255, 255, 255, .12);
}

.xpag-country-main {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 11px;
}

.xpag-country-flag {
    position: relative;
    display: grid;
    flex: 0 0 38px;
    place-items: center;
    width: 38px;
    height: 38px;
    overflow: hidden;
    border-radius: 50%;
    background: rgba(0, 0, 0, .2);
    font: 27px/1 system-ui, sans-serif;
}

.xpag-country-flag::before,
.xpag-country-flag::after,
.xpag-locale-trigger-flag::before,
.xpag-locale-trigger-flag::after {
    position: absolute;
    display: block;
    content: "";
}

.xpag-country-flag[data-image-flag="true"]::before,
.xpag-country-flag[data-image-flag="true"]::after,
.xpag-locale-trigger-flag[data-image-flag="true"]::before,
.xpag-locale-trigger-flag[data-image-flag="true"]::after {
    display: none;
}

.xpag-flag-image {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    object-fit: cover;
}

.xpag-country-flag[data-country="BR"],
.xpag-locale-trigger-flag[data-country="BR"] {
    background: #009739;
}

.xpag-country-flag[data-country="BR"]::before,
.xpag-locale-trigger-flag[data-country="BR"]::before {
    top: 27%;
    left: 18%;
    width: 64%;
    height: 46%;
    background: #ffdf00;
    clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

.xpag-country-flag[data-country="BR"]::after,
.xpag-locale-trigger-flag[data-country="BR"]::after {
    top: 39%;
    left: 39%;
    width: 22%;
    height: 22%;
    border-radius: 50%;
    background: #002776;
}

.xpag-country-flag[data-country="MX"],
.xpag-locale-trigger-flag[data-country="MX"] {
    background: linear-gradient(90deg, #006847 0 33.3%, #fff 33.3% 66.6%, #ce1126 66.6% 100%);
}

.xpag-country-flag[data-country="MX"]::after,
.xpag-locale-trigger-flag[data-country="MX"]::after {
    top: 43%;
    left: 46%;
    width: 8%;
    height: 13%;
    border-radius: 50%;
    background: #a78342;
}

.xpag-country-flag[data-country="CO"],
.xpag-locale-trigger-flag[data-country="CO"] {
    background: linear-gradient(#fcd116 0 50%, #003893 50% 75%, #ce1126 75% 100%);
}

.xpag-country-flag[data-country="CL"],
.xpag-locale-trigger-flag[data-country="CL"] {
    background: linear-gradient(#fff 0 50%, #d52b1e 50% 100%);
}

.xpag-country-flag[data-country="CL"]::before,
.xpag-locale-trigger-flag[data-country="CL"]::before {
    top: 0;
    left: 0;
    width: 50%;
    height: 50%;
    background: #0039a6;
}

.xpag-country-flag[data-country="CL"]::after,
.xpag-locale-trigger-flag[data-country="CL"]::after {
    top: 5%;
    left: 7%;
    display: grid;
    width: 35%;
    height: 40%;
    color: #fff;
    content: "★";
    font-size: 9px;
    line-height: 1;
    place-items: center;
}

.xpag-country-flag[data-country="PE"],
.xpag-locale-trigger-flag[data-country="PE"] {
    background: linear-gradient(90deg, #d91023 0 33.3%, #fff 33.3% 66.6%, #d91023 66.6% 100%);
}

.xpag-country-flag[data-country="AR"],
.xpag-locale-trigger-flag[data-country="AR"] {
    background: linear-gradient(#74acdf 0 33.3%, #fff 33.3% 66.6%, #74acdf 66.6% 100%);
}

.xpag-country-flag[data-country="AR"]::after,
.xpag-locale-trigger-flag[data-country="AR"]::after {
    top: 43%;
    left: 43%;
    width: 14%;
    height: 14%;
    border-radius: 50%;
    background: #f6b40e;
}

.xpag-country-name {
    display: block;
    overflow: hidden;
    color: inherit;
    font-size: 16px;
    font-weight: 650;
    letter-spacing: -.015em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.xpag-country-currency {
    position: absolute;
    top: 7px;
    right: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 24px;
    padding: 2px 10px;
    border: 1px solid rgba(196, 255, 162, .64);
    border-radius: 999px;
    background: linear-gradient(100deg, #28382b, #3b6135);
    color: #f5f5f5;
    box-shadow: 0 0 12px rgba(96, 255, 63, .42);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.xpag-country-currency-symbol {
    font-size: 14px;
    font-weight: 750;
}

.xpag-country-currency-code {
    font-size: 11px;
    font-style: italic;
    font-weight: 750;
    letter-spacing: .015em;
}

.xpag-country-check {
    position: absolute;
    right: 20px;
    bottom: 9px;
    display: grid;
    place-items: center;
    width: 19px;
    height: 19px;
    color: transparent;
    font-size: 20px;
    font-weight: 800;
    line-height: 1;
}

.xpag-country-card.is-selected .xpag-country-check {
    color: #fff;
}

.xpag-country-empty {
    margin: 8px 0;
    color: #bababa;
    font-size: 14px;
    text-align: center;
}

.xpag-locale-error {
    margin: 8px 0 0;
    color: #ff9b9b;
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
}

.xpag-locale-actions {
    display: flex;
    margin-top: 14px;
}

.xpag-locale-confirm {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    padding: 10px 16px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(105deg, #079a73 0%, #19ae59 100%);
    color: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14);
    cursor: pointer;
    font: 700 16px/1.1 system-ui, sans-serif;
    transition: filter .15s ease, transform .15s ease;
}

.xpag-locale-confirm:hover:not(:disabled) {
    filter: brightness(1.08);
}

.xpag-locale-confirm:active:not(:disabled) {
    transform: scale(.99);
}

.xpag-locale-confirm:focus-visible {
    outline: 2px solid #b4ff83;
    outline-offset: 3px;
}

.xpag-locale-confirm:disabled {
    cursor: wait;
    opacity: .72;
}

@media (max-width: 420px) {
    .xpag-locale-dialog {
        padding: 18px 16px 16px;
        border-radius: 21px;
    }

    .xpag-locale-title {
        margin-bottom: 16px;
    }

    .xpag-country-card {
        min-height: 60px;
        padding-right: 105px;
    }

    .xpag-country-main {
        gap: 9px;
    }

    .xpag-country-flag {
        flex-basis: 35px;
        width: 35px;
        height: 35px;
        font-size: 25px;
    }

    .xpag-country-name {
        font-size: 15px;
    }
}

@media (max-height: 700px) {
    .xpag-locale-dialog {
        max-height: calc(100vh - 24px);
        max-height: calc(100dvh - 24px);
        padding-top: 15px;
        padding-bottom: 14px;
    }

    .xpag-locale-title {
        margin-bottom: 12px;
    }

    .xpag-country-list {
        max-height: 34vh;
        max-height: 34dvh;
        gap: 7px;
    }

    .xpag-country-card {
        min-height: 54px;
    }

    .xpag-locale-confirm {
        min-height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .xpag-country-card,
    .xpag-locale-confirm {
        transition: none;
    }
}

/* Reserve the country control in the toolbar flow, including Ionic slots. */
ion-toolbar.xpag-country-header .xpag-country-actions {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    flex-shrink: 0;
    gap: 6px;
}
ion-toolbar.xpag-country-header .xpag-country-actions > .xpag-locale-trigger {
    flex: 0 0 30px;
    width: 30px;
    min-width: 30px;
    height: 30px;
    min-height: 30px;
    margin-inline-end: 0;
}
ion-toolbar.xpag-country-header .logo-wrap {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    margin-inline-end: 8px;
}
#app ion-toolbar.xpag-country-header .logo-wrap .logo.good-img {
    width: 100%;
    max-width: 7.5rem;
    object-fit: contain;
    object-position: left center;
    transform: none;
}
ion-toolbar.xpag-country-header > ion-img[slot=secondary] {
    flex: 1 1 0;
    min-width: 0;
    padding-inline-end: 8px;
    object-fit: contain;
    object-position: left center;
}
