@import url('https://cdn.jsdelivr.net/npm/flag-icons@7.3.2/css/flag-icons.min.css');

/* Shared searchable country selector. The native select stays in the DOM for
   PHP form posts; JavaScript adds .country-picker-native only after enhancement.
   Flag Icons supplies SVG flags through ISO classes such as .fi-bg. */
.country-picker-ui {
    position: relative;
    width: 100%;
    min-width: 0;
}

.country-picker-ui select.country-picker-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.country-picker__trigger {
    display: flex !important;
    align-items: center;
    width: 100% !important;
    min-height: 46px;
    padding: 10px 12px !important;
    gap: 10px;
    color: #24364b !important;
    font: inherit;
    font-weight: 400 !important;
    line-height: 1.35;
    text-align: left !important;
    cursor: pointer;
    border: 1px solid #b7c7d9 !important;
    border-radius: 8px !important;
    background: #fff !important;
    box-shadow: inset 1px 1px 3px #00000005;
    transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}

.country-picker__trigger:hover:not(:disabled) {
    border-color: #7293b7 !important;
    background: #fbfdff !important;
}

.country-picker__trigger:focus-visible {
    outline: 3px solid rgba(2, 192, 223, .28) !important;
    outline-offset: 1px;
    border-color: var(--secondary, #02c0df) !important;
    box-shadow: 0 0 0 2px rgba(2, 192, 223, .18) !important;
}

.country-picker__trigger:disabled {
    cursor: not-allowed;
    opacity: .65;
    background: #f3f6f8 !important;
}

.country-picker__flag {
    flex: 0 0 auto;
    width: 1.35em;
    height: 1em;
    border: 1px solid #c9d7e4;
    border-radius: 2px;
    background-color: #edf4f8;
    font-size: 1.18em;
    line-height: 1;
    text-align: center;
}

/* Let Flag Icons own the SVG background while retaining a small neutral mark
   if a stylesheet is unavailable. Country names remain the text alternative. */
.country-picker__flag.fi {
    border: 0;
    border-radius: 0;
    background-color: transparent;
}

.country-picker__flag--placeholder {
    position: relative;
    border-radius: 50%;
}

.country-picker__flag--placeholder::before,
.country-picker__flag--placeholder::after {
    position: absolute;
    top: 50%;
    left: 50%;
    content: '';
    background: #8295a9;
    transform: translate(-50%, -50%);
}

.country-picker__flag--placeholder::before { width: 65%; height: 1px; }
.country-picker__flag--placeholder::after { width: 1px; height: 65%; }

.country-picker__selected {
    min-width: 0;
    overflow: hidden;
    color: #657285;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.country-picker__trigger--selected .country-picker__selected { color: #24364b; }

.country-picker__chevron {
    flex: 0 0 auto;
    margin-left: auto;
    color: #5c7087;
    font-size: 1rem;
    transition: transform .18s ease;
}

.country-picker-ui--open .country-picker__trigger {
    border-color: var(--secondary, #02c0df) !important;
    box-shadow: 0 0 0 2px rgba(2, 192, 223, .18) !important;
}

.country-picker-ui--open .country-picker__chevron { transform: rotate(180deg); }

.country-picker__panel {
    position: absolute;
    z-index: 30;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    min-width: 235px;
    padding: 10px;
    border: 1px solid #bfd1e2;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 13px 28px rgba(21, 53, 84, .18);
}

.country-picker__panel[hidden] { display: none; }

.country-picker__search-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.country-picker__search {
    display: block !important;
    width: 100% !important;
    min-height: 40px;
    margin: 0 !important;
    padding: 9px 11px !important;
    color: #24364b;
    font: inherit;
    line-height: 1.35;
    border: 1px solid #b7c7d9 !important;
    border-radius: 7px !important;
    background: #fff !important;
}

.country-picker__search:focus {
    outline: 3px solid rgba(2, 192, 223, .22) !important;
    outline-offset: 0;
    border-color: var(--secondary, #02c0df) !important;
}

.country-picker__status {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.country-picker__list {
    max-height: min(250px, 42vh);
    margin: 8px -3px -2px !important;
    padding: 2px 3px !important;
    overflow-y: auto;
    list-style: none;
    scrollbar-color: #a4bacf transparent;
    scrollbar-width: thin;
}

.country-picker__option {
    display: flex;
    align-items: center;
    min-height: 39px;
    padding: 8px;
    gap: 9px;
    color: #263d56;
    font-size: .94rem;
    line-height: 1.25;
    cursor: pointer;
    border-radius: 6px;
}

.country-picker__option:hover,
.country-picker__option.is-active {
    background: #eaf8fc;
}

.country-picker__option[aria-selected="true"] {
    color: #0d527c;
    font-weight: 700;
    background: #edf5fc;
}

.country-picker__option-name { min-width: 0; }

.country-picker__option-code {
    margin-left: auto;
    color: #71839a;
    font-size: .73rem;
    font-weight: 700;
    letter-spacing: .05em;
}

.country-picker__empty {
    margin: 12px 4px 5px !important;
    color: #65758a;
    font-size: .9rem;
    line-height: 1.4;
    text-align: center;
}

.country-picker-ui--invalid .country-picker__trigger {
    border-color: #c9415f !important;
}

.country-picker__error {
    margin: 6px 0 0 !important;
    color: #a8071a;
    font-size: .82rem;
    line-height: 1.35;
    text-align: left;
}

@media (max-width: 420px) {
    .country-picker__panel { min-width: 0; }
    .country-picker__option { font-size: .9rem; }
}
