/* Country dropdown with flags (scripts/country-picker.js). */

.country-picker {
    position: relative;
    font-family: "Poppins", sans-serif;
}

.cp-button {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: 100%;
    height: 48px;
    padding: 0 1rem 0 0.85rem;
    border: 1px solid #dfe5ec;
    border-radius: 10px;
    background: #fff;
    font: inherit;
    font-size: 0.95rem;
    color: #111827;
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.cp-button:hover,
.cp-button[aria-expanded="true"] {
    border-color: #34a9ff;
}

.cp-button:focus-visible {
    outline: none;
    border-color: #34a9ff;
    box-shadow: 0 0 0 3px rgba(52, 169, 255, 0.2);
}

.cp-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.cp-caret {
    flex: none;
    color: #6b7280;
}

.cp-flag {
    flex: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
}

.cp-globe {
    display: inline-flex;
    color: #0b74d1;
}

.cp-globe svg {
    width: 22px;
    height: 22px;
}

.cp-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 20;
    width: 100%;
    min-width: 260px;
    padding: 0.5rem;
    border: 1px solid #dfe5ec;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
    box-sizing: border-box;
}

.cp-panel[hidden] {
    display: none;
}

.cp-search {
    width: 100%;
    height: 40px;
    margin: 0 0 0.4rem;
    padding: 0 0.75rem;
    border: 1px solid #dfe5ec;
    border-radius: 8px;
    font: inherit;
    font-size: 0.9rem;
    box-sizing: border-box;
}

.cp-search:focus {
    outline: none;
    border-color: #34a9ff;
}

.cp-empty {
    margin: 0.2rem 0.6rem 0.5rem;
    font-size: 0.8rem;
    line-height: 1.5;
    color: #6b7280;
    text-align: left;
}

.cp-empty[hidden] {
    display: none;
}

.cp-list {
    max-height: 288px;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
}

.cp-list li {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 0.6rem;
    border-radius: 8px;
    font-size: 0.92rem;
    color: #111827;
    text-align: left;
    cursor: pointer;
}

.cp-list li[hidden] {
    display: none;
}

.cp-list li:hover,
.cp-list li.cp-active {
    background: #f3f9ff;
}

.cp-list li[aria-selected="true"] {
    font-weight: 600;
    color: #0b74d1;
}

/* the first "Rest of" region starts the regions group */
.cp-list li:not(.cp-region) + li.cp-region {
    margin-top: 0.35rem;
    border-top: 1px solid #eef1f5;
    border-radius: 0 0 8px 8px;
    padding-top: 0.8rem;
}

/* in the calculator form it sits where a select would */
#form-container .country-picker {
    margin-bottom: 1.1rem;
}

/* the open list must sit above the currency field next to or below it */
#form-container .dropdown-container:has(.country-picker) {
    z-index: 3;
}

/* country names are longer than currency names */
@media (min-width: 421px) {
    #form-container .select-row {
        grid-template-columns: 3fr 2fr;
    }
}
