.country-picker {
    position: relative;
    width: 100%;
}

.country-picker select.country-picker-native {
    width: 100%;
}

.country-picker select.country-picker-native.is-enhanced {
    display: none;
}

.country-picker__trigger {
    width: 100%;
    min-height: 56px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.96));
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03), inset 0 1px 0 rgba(255,255,255,0.72);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 14px;
    text-align: left;
    color: #0f172a;
    overflow: hidden;
    transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease, transform .18s ease;
}

.country-picker__trigger:focus-visible,
.country-picker__option:focus-visible {
    outline: none;
}

.country-picker__trigger:hover {
    border-color: rgba(148, 163, 184, 0.34);
    background: linear-gradient(180deg, rgba(255,255,255,1), rgba(248,250,252,0.98));
}

.country-picker__trigger:focus-visible,
.country-picker__trigger[aria-expanded="true"] {
    border-color: rgba(21, 128, 61, 0.24);
    box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.06), 0 8px 18px rgba(15, 23, 42, 0.05);
    background: #fff;
}

.country-picker__trigger-label {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 auto;
}

.country-picker__trigger-icon {
    width: 24px;
    height: 18px;
    border-radius: 4px;
    object-fit: cover;
    flex: 0 0 auto;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.12);
    background: #e2e8f0;
}

.country-picker__trigger-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.country-picker__trigger-title {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.2;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.country-picker__trigger-subtitle {
    font-size: 0.76rem;
    line-height: 1.1;
    color: #64748b;
}

.country-picker__trigger-caret {
    color: #64748b;
    flex: 0 0 auto;
    padding-left: 6px;
    font-size: 0.88rem;
}

.country-picker__sheet {
    position: fixed;
    inset: 0;
    background: rgba(9, 14, 28, 0.58);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 20000;
}

.country-picker__sheet.is-open {
    display: flex;
}

.country-picker__dialog {
    width: min(100%, 560px);
    max-height: min(82vh, 720px);
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 30px 70px rgba(15, 23, 42, 0.24);
    border: 1px solid rgba(148, 163, 184, 0.18);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.country-picker__sheet.is-dropdown {
    align-items: flex-start;
    justify-content: flex-start;
    padding: 0;
    background: transparent;
}

.country-picker__sheet.is-dropdown .country-picker__dialog {
    position: fixed;
    margin: 0;
    width: auto;
    max-width: calc(100vw - 24px);
    max-height: min(72vh, 560px);
    border-radius: 22px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
    background: #fff;
    overflow: hidden;
    isolation: isolate;
}

.country-picker__sheet.is-dropdown .country-picker__body {
    padding: 10px;
    gap: 8px;
    background: #fff;
}

.country-picker__sheet.is-dropdown .country-picker__header {
    display: none;
}

.country-picker__sheet.is-dropdown .country-picker__search-wrap {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #fff;
    padding-bottom: 2px;
}

.country-picker__sheet.is-dropdown .country-picker__options {
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    background: #fff;
}

.country-picker__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 18px 0;
}

.country-picker__title {
    margin: 0;
    font-size: 1rem;
    line-height: 1.2;
    color: #0f172a;
}

.country-picker__close {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.14);
    color: #0f172a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.country-picker__body {
    padding: 14px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}

.country-picker__search-wrap {
    position: relative;
}

.country-picker__search {
    width: 100%;
    min-height: 52px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.96));
    color: #0f172a;
    padding: 0 14px 0 44px;
    font-size: 0.94rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03), inset 0 1px 0 rgba(255,255,255,0.72);
    transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}

.country-picker__search:focus,
.country-picker__search:focus-visible {
    outline: none;
    border-color: rgba(21, 128, 61, 0.24);
    box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.06), 0 8px 18px rgba(15, 23, 42, 0.05);
    background: #fff;
}

.country-picker__search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    pointer-events: none;
}

.country-picker__options {
    min-height: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 2px;
}

.country-picker__option {
    width: 100%;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.96));
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    text-align: left;
    color: #0f172a;
    transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease, background-color .14s ease;
}

.country-picker__option:hover {
    transform: translateY(-1px);
    border-color: rgba(21, 128, 61, 0.22);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.07);
    background: #fbfffc;
}

.country-picker__option:focus-visible {
    border-color: rgba(21, 128, 61, 0.24);
    box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.06), 0 8px 18px rgba(15, 23, 42, 0.05);
    background: #fff;
}

.country-picker__option.is-selected {
    border-color: rgba(21, 128, 61, 0.28);
    background: linear-gradient(180deg, rgba(247,254,231,0.98), rgba(240,253,244,0.96));
}

.country-picker__option-flag {
    width: 30px;
    height: 22px;
    border-radius: 5px;
    object-fit: cover;
    flex: 0 0 auto;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.1);
    background: #e2e8f0;
}

.country-picker__option-copy {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.country-picker__option-name {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.2;
    color: #0f172a;
}

.country-picker__option-code {
    font-size: 0.76rem;
    line-height: 1.1;
    color: #64748b;
}

.country-picker__option-check {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: rgba(21, 128, 61, 0.12);
    color: #15803d;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    opacity: 0;
    flex: 0 0 auto;
}

.country-picker__option.is-selected .country-picker__option-check {
    opacity: 1;
}

.country-picker__empty {
    padding: 24px 18px;
    text-align: center;
    color: #64748b;
    font-size: 0.88rem;
    border-radius: 16px;
    background: #f8fafc;
    border: 1px dashed rgba(148, 163, 184, 0.34);
}

.country-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.country-inline__flag {
    width: 22px;
    height: 16px;
    border-radius: 4px;
    object-fit: cover;
    flex: 0 0 auto;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.1);
    background: #e2e8f0;
}

.country-inline__label {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 640px) {
    .country-picker__sheet {
        align-items: flex-end;
        padding: 0;
    }

    .country-picker__sheet.is-dropdown {
        align-items: flex-start;
        justify-content: flex-start;
        padding: 0;
        background: transparent;
    }

    .country-picker__dialog {
        width: 100%;
        max-height: 88vh;
        border-radius: 24px 24px 0 0;
    }

    .country-picker__sheet.is-dropdown .country-picker__dialog {
        position: fixed;
        left: auto !important;
        top: auto !important;
        bottom: auto !important;
        width: auto;
        max-width: calc(100vw - 24px);
        max-height: min(72vh, 560px);
        border-radius: 20px;
    }

    .country-picker__body {
        padding-bottom: max(18px, env(safe-area-inset-bottom));
    }
}
