/* ==========================================================================
   Composant Sélecteur de Pays & Villes Dynamiques - UPSA Polytech
   Design calqué sur le sélecteur téléphonique :
   - Conteneur blanc arrondi (border-radius: 14px)
   - Drapeau vectoriel SVG + Nom du pays + Chevron
   - Dropdown avec recherche et élément actif doré (#f5b61b) + coche '✓'
   - Synchronisation instantanée du champ Ville
   ========================================================================== */

.upsa-country-group {
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

.upsa-country-btn {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 48px;
    height: 48px;
    background: #ffffff;
    border: 1.5px solid #d1d5db;
    border-radius: 14px;
    padding: 0 14px;
    cursor: pointer;
    user-select: none;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.upsa-country-btn:hover {
    border-color: #94a3b8;
}

.upsa-country-group.dropdown-open .upsa-country-btn,
.upsa-country-btn:focus {
    border-color: #f5b61b;
    box-shadow: 0 0 0 3.5px rgba(245, 182, 27, 0.22);
}

.upsa-country-flag-slot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    flex-shrink: 0;
}

.upsa-country-flag-img {
    width: 24px;
    height: 16px;
    border-radius: 2px;
    object-fit: cover;
    box-shadow: 0 0 1px rgba(0, 0, 0, 0.4);
    display: inline-block;
    vertical-align: middle;
}

.upsa-country-name-text {
    flex: 1;
    font-size: 14.5px;
    font-weight: 500;
    color: #1e293b;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upsa-country-chevron {
    display: inline-flex;
    align-items: center;
    color: #64748b;
    font-size: 11px;
    margin-left: 8px;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.upsa-country-group.dropdown-open .upsa-country-chevron {
    transform: rotate(180deg);
}

/* Menu déroulant Pays */
.upsa-country-dropdown {
    position: absolute;
    z-index: 10500;
    left: 0;
    right: 0;
    width: 100%;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 14px 38px -4px rgba(0, 0, 0, 0.18), 0 4px 14px rgba(0, 0, 0, 0.08);
    padding: 10px 8px 8px 8px;
    display: none;
    box-sizing: border-box;
    animation: upsaCountryFade 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.upsa-country-dropdown.drop-down {
    top: calc(100% + 6px);
    bottom: auto;
}

.upsa-country-dropdown.drop-up {
    bottom: calc(100% + 6px);
    top: auto;
}

@keyframes upsaCountryFade {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.upsa-country-dropdown.show {
    display: flex;
    flex-direction: column;
}

.upsa-country-search-box {
    margin-bottom: 8px;
    padding: 0 2px;
}

.upsa-country-search-input {
    width: 100%;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 13.5px;
    color: #1e293b;
    outline: none;
    box-sizing: border-box;
    transition: all 0.15s ease;
}

.upsa-country-search-input:focus {
    background: #ffffff;
    border-color: #f5b61b;
    box-shadow: 0 0 0 2.5px rgba(245, 182, 27, 0.18);
}

.upsa-country-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 240px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f8fafc;
}

.upsa-country-list::-webkit-scrollbar {
    width: 6px;
}

.upsa-country-list::-webkit-scrollbar-track {
    background: #f8fafc;
    border-radius: 4px;
}

.upsa-country-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.upsa-country-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 9px;
    cursor: pointer;
    font-size: 14px;
    color: #1e293b;
    transition: background 0.15s ease, color 0.15s ease;
    user-select: none;
}

.upsa-country-item:hover {
    background: #f1f5f9;
}

/* État actif : fond doré + texte contrasté + coche */
.upsa-country-item.is-active {
    background: #f5b61b !important;
    color: #0f172a !important;
    font-weight: 600;
}

.upsa-country-item-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upsa-country-check {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    margin-left: auto;
}

/* Style du champ select Ville */
.upsa-city-select {
    width: 100%;
    min-height: 48px;
    height: 48px;
    background: #ffffff;
    border: 1.5px solid #d1d5db;
    border-radius: 14px;
    padding: 0 14px;
    font-size: 14.5px;
    font-weight: 500;
    color: #1e293b;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.upsa-city-select:focus {
    border-color: #f5b61b;
    box-shadow: 0 0 0 3.5px rgba(245, 182, 27, 0.22);
}

.upsa-custom-city-wrap {
    margin-top: 8px;
}

.upsa-custom-city-input {
    width: 100%;
    min-height: 42px;
    height: 42px;
    background: #f8fafc;
    border: 1.5px solid #d1d5db;
    border-radius: 12px;
    padding: 0 12px;
    font-size: 14px;
    color: #1e293b;
    outline: none;
    box-sizing: border-box;
    transition: all 0.2s;
}

.upsa-custom-city-input:focus {
    background: #ffffff;
    border-color: #f5b61b;
    box-shadow: 0 0 0 2.5px rgba(245, 182, 27, 0.18);
}
