/* ==========================================================================
   Composant Téléphone International - UPSA Polytech
   Design fidèle à la capture d'écran : Sélecteur drapeau, indicatif, 
   dropdown jaune/doré avec coche '✓' et champ 'Numéro sans indicatif'
   ========================================================================== */

.upsa-phone-group {
    position: relative;
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1.5px solid #d1d5db;
    border-radius: 14px;
    padding: 3px 12px 3px 6px;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

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

.upsa-phone-group.is-invalid {
    border-color: #ef4444 !important;
}

/* Bouton sélecteur indicatif (gauche) */
.upsa-phone-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    outline: none;
    padding: 7px 10px;
    border-radius: 9px;
    cursor: pointer;
    user-select: none;
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    transition: background 0.15s ease;
    flex-shrink: 0;
}

.upsa-phone-btn:hover {
    background: #f1f5f9;
}

.upsa-phone-btn:active {
    background: #e2e8f0;
}

/* Drapeau drapeau SVG/Image */
.upsa-phone-flag-img {
    width: 24px;
    height: 16px;
    border-radius: 2px;
    object-fit: cover;
    display: inline-block;
    vertical-align: middle;
    box-shadow: 0 0 1px rgba(0, 0, 0, 0.4);
    flex-shrink: 0;
}

.upsa-phone-code-text {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    letter-spacing: -0.2px;
}

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

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

/* Séparateur vertical */
.upsa-phone-divider {
    width: 1px;
    height: 26px;
    background: #e2e8f0;
    margin: 0 6px;
    flex-shrink: 0;
}

/* Champ de saisie du numéro (droite) */
.upsa-phone-number-input {
    flex: 1;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 8px 6px !important;
    font-size: 15px !important;
    color: #0f172a !important;
    font-weight: 400;
    width: 100%;
    min-width: 0;
}

.upsa-phone-number-input::placeholder {
    color: #94a3b8 !important;
    font-size: 14.5px !important;
    font-weight: 400;
}

/* ==========================================================================
   Menu Déroulant (Dropdown) - Calqué sur l'image
   ========================================================================== */

.upsa-phone-dropdown {
    position: absolute;
    z-index: 10500;
    left: 0;
    width: 100%;
    min-width: 290px;
    max-width: 360px;
    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: upsaFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Positionnement au-dessus si l'espace en bas est restreint */
.upsa-phone-dropdown.drop-up {
    bottom: calc(100% + 8px);
    top: auto;
}

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

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

.upsa-phone-dropdown.show {
    display: block;
}

/* Barre de recherche dans le dropdown */
.upsa-phone-search-box {
    margin-bottom: 8px;
    padding: 0 2px;
}

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

.upsa-phone-search-input:focus {
    border-color: #f5b61b;
    background: #ffffff;
}

/* Liste des pays scrollable */
.upsa-phone-list {
    max-height: 285px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0;
    margin: 0;
    list-style: none;
}

/* Personnalisation de la barre de défilement */
.upsa-phone-list::-webkit-scrollbar {
    width: 5px;
}

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

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

.upsa-phone-list::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Élément de pays individuel */
.upsa-phone-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14.5px;
    color: #1e293b;
    transition: background 0.12s ease, color 0.12s ease;
    user-select: none;
    margin-bottom: 2px;
}

.upsa-phone-item:hover:not(.active) {
    background: #f8fafc;
}

/* --- Style EXACT de l'élément sélectionné dans la capture (fond doré + coche) --- */
.upsa-phone-item.active {
    background: #f5b61b !important; /* Jaune doré exact de l'image */
    color: #1c1917 !important;
    font-weight: 600;
}

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

.upsa-phone-item-code {
    font-size: 14px;
    color: #475569;
    font-weight: 500;
    flex-shrink: 0;
}

.upsa-phone-item.active .upsa-phone-item-code {
    color: #1c1917 !important;
    font-weight: 600;
}

/* Coche de validation '✓' */
.upsa-phone-item-check {
    display: none;
    flex-shrink: 0;
    color: #1c1917;
    font-weight: 700;
    margin-left: 6px;
}

.upsa-phone-item.active .upsa-phone-item-check {
    display: inline-flex;
    align-items: center;
}

/* Petite flèche en bas du dropdown comme sur la photo */
.upsa-phone-bottom-indicator {
    text-align: center;
    padding: 4px 0 0 0;
    color: #94a3b8;
    font-size: 11px;
    line-height: 1;
}

/* Ajustement responsive */
@media (max-width: 576px) {
    .upsa-phone-dropdown {
        min-width: 270px;
        max-width: 100%;
    }
}
