/* ========== AUTOCOMPLETE CUSTOM DESIGN ========== */

/* Conteneur principal de l'autocomplete */
.ui-autocomplete {
    position: absolute;
    top: 0;
    left: 0;
    cursor: default;
    background: white;
    border: 2px solid #5CC9A7 !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 25px rgba(44, 95, 79, 0.15), 0 4px 10px rgba(92, 201, 167, 0.1) !important;
    font-family: inherit;
    z-index: 9999 !important;
    padding: 8px 0;
    max-height: 320px;
    overflow-y: auto;
    overflow-x: hidden;
    margin-top: 4px;
}

/* Scroll bar personnalisée */
.ui-autocomplete::-webkit-scrollbar {
    width: 8px;
}

.ui-autocomplete::-webkit-scrollbar-track {
    background: #f1f5f3;
    border-radius: 10px;
}

.ui-autocomplete::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #5CC9A7 0%, #2C5F4F 100%);
    border-radius: 10px;
}

.ui-autocomplete::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #4ab899 0%, #234d40 100%);
}

/* Items de la liste */
.ui-menu-item {
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
}

/* Liens dans les items */
.ui-menu-item-wrapper {
    display: block !important;
    padding: 12px 16px !important;
    margin: 2px 8px;
    color: #2C5F4F !important;
    text-decoration: none !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    border-radius: 8px !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    cursor: pointer;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

/* Effet de fond au survol */
.ui-menu-item-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(92, 201, 167, 0.1), transparent);
    transition: left 0.5s ease;
}

.ui-menu-item-wrapper:hover::before {
    left: 100%;
}

/* État hover */
.ui-menu-item-wrapper:hover,
.ui-state-focus {
    background: linear-gradient(135deg, rgba(92, 201, 167, 0.08) 0%, rgba(44, 95, 79, 0.05) 100%) !important;
    color: #2C5F4F !important;
    border-color: #5CC9A7 !important;
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(92, 201, 167, 0.15);
}

/* État actif/sélectionné */
.ui-state-active,
.ui-menu-item-wrapper.ui-state-active {
    background: linear-gradient(135deg, #5CC9A7 0%, #2C5F4F 100%) !important;
    color: white !important;
    border-color: #5CC9A7 !important;
    transform: translateX(6px);
    box-shadow: 0 4px 12px rgba(92, 201, 167, 0.3);
    font-weight: 500;
}

/* Icône de localisation pour les items */
.ui-menu-item-wrapper::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%235CC9A7'%3E%3Cpath d='M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.ui-menu-item-wrapper:hover::after,
.ui-state-active::after {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

.ui-state-active::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z'/%3E%3C/svg%3E");
}

/* Message "Aucun résultat" */
.ui-menu-item .ui-menu-item-wrapper.no-results {
    color: #9CA3AF !important;
    font-style: italic;
    text-align: center;
    cursor: default;
}

.ui-menu-item .ui-menu-item-wrapper.no-results:hover {
    background: transparent !important;
    transform: none;
    border-color: transparent !important;
}

/* Séparateur entre les items */
.ui-menu-item + .ui-menu-item {
    position: relative;
}

/* Animation d'apparition */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ui-autocomplete {
    animation: slideDown 0.2s ease-out;
}

/* Animation des items */
.ui-menu-item {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(-5px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .ui-autocomplete {
        max-height: 240px;
        border-radius: 10px !important;
    }

    .ui-menu-item-wrapper {
        padding: 10px 14px !important;
        font-size: 13px !important;
        margin: 2px 6px;
    }

    .ui-menu-item-wrapper::after {
        width: 14px;
        height: 14px;
        right: 10px;
    }
}

/* États de chargement (loading) */
.ui-autocomplete-loading {
    background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 50 50'%3E%3Cpath fill='%235CC9A7' d='M25,5A20.14,20.14,0,0,1,45,22.88a2.51,2.51,0,0,0,2.49,2.26h0A2.52,2.52,0,0,0,50,22.33a25.14,25.14,0,0,0-50,0,2.52,2.52,0,0,0,2.5,2.81h0A2.51,2.51,0,0,0,5,22.88,20.14,20.14,0,0,1,25,5Z'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 25 25' to='360 25 25' dur='0.6s' repeatCount='indefinite'/%3E%3C/path%3E%3C/svg%3E") right 12px center no-repeat;
    background-size: 20px 20px;
}

/* Helper classes */
.ui-helper-hidden {
    display: none;
}

.ui-helper-hidden-accessible {
    border: 0;
    clip: rect(0 0 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
}

/* Style pour le focus sur le champ de saisie quand l'autocomplete est ouvert */
input.ui-autocomplete-input:focus {
    border-color: #5CC9A7 !important;
    box-shadow: 0 0 0 3px rgba(92, 201, 167, 0.1) !important;
}
