/**
 * Searchable country dropdown (progressive enhancement).
 *
 * Upgrades any <select class="evt-country-select"> into a searchable,
 * scrollable combobox while keeping the native <select> in the DOM as the
 * value holder (so existing currency/submit logic keeps working).
 *
 * Uses CSS variables with fallbacks so it looks consistent on both the public
 * forms and the wp-admin forms.
 */

/* Native select kept accessible/focusable but visually hidden (NOT display:none
   so HTML5 "required" validation can still focus it). */
.evt-cs-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    border: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    white-space: nowrap !important;
}

.evt-cs {
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

.evt-cs-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    margin: 0;
    padding: 10px 14px;
    border: 1px solid var(--evt-gray-300, #d1d5db);
    border-radius: var(--evt-radius-sm, 8px);
    background: #fff;
    font-size: 1rem;
    line-height: 1.4;
    color: var(--evt-gray-900, #111827);
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
    transition: border-color .2s, box-shadow .2s;
}

.evt-cs-trigger:hover {
    border-color: var(--evt-gray-400, #9ca3af);
}

.evt-cs.evt-cs-open .evt-cs-trigger,
.evt-cs-trigger:focus {
    outline: none;
    border-color: var(--evt-primary, #438959);
    box-shadow: 0 0 0 3px rgba(67, 137, 89, .12);
}

.evt-cs-label {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.evt-cs-label.evt-cs-placeholder {
    color: var(--evt-gray-500, #9ca3af);
}

.evt-cs-caret {
    flex: 0 0 auto;
    font-size: .8em;
    line-height: 1;
    color: var(--evt-gray-500, #6b7280);
    transition: transform .2s;
}

.evt-cs.evt-cs-open .evt-cs-caret {
    transform: rotate(180deg);
}

.evt-cs-panel {
    position: absolute;
    z-index: 9999;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--evt-gray-300, #d1d5db);
    border-radius: var(--evt-radius-sm, 8px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .12);
    overflow: hidden;
}

.evt-cs-search-wrap {
    padding: 8px;
    border-bottom: 1px solid var(--evt-gray-200, #e5e7eb);
    background: #fff;
}

.evt-cs-search {
    width: 100%;
    height: auto;
    margin: 0;
    padding: 8px 10px;
    border: 1px solid var(--evt-gray-300, #d1d5db);
    border-radius: 6px;
    font-size: .95rem;
    box-sizing: border-box;
}

.evt-cs-search:focus {
    outline: none;
    border-color: var(--evt-primary, #438959);
    box-shadow: 0 0 0 3px rgba(67, 137, 89, .12);
}

.evt-cs-list {
    margin: 0;
    padding: 4px;
    list-style: none;
    max-height: 260px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.evt-cs-option {
    padding: 9px 12px;
    border-radius: 6px;
    font-size: .95rem;
    line-height: 1.3;
    color: var(--evt-gray-900, #111827);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.evt-cs-option:hover,
.evt-cs-option.evt-cs-active {
    background: var(--evt-primary, #438959);
    color: #fff;
}

.evt-cs-empty {
    padding: 16px 12px;
    text-align: center;
    color: var(--evt-gray-500, #6b7280);
    font-size: .9rem;
}

.evt-cs-list::-webkit-scrollbar {
    width: 10px;
}

.evt-cs-list::-webkit-scrollbar-thumb {
    background: var(--evt-gray-300, #d1d5db);
    border-radius: 6px;
    border: 2px solid #fff;
}
