/**
 * YOMBAL YOON - OpenStreetMap Autocomplete Styles
 * Design moderne et responsive pour l'autocomplétion OSM
 */

/* Conteneur des résultats */
.osm-autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: -1px;
    display: none;
}

/* Scrollbar personnalisée */
.osm-autocomplete-results::-webkit-scrollbar {
    width: 8px;
}

.osm-autocomplete-results::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 0 0 12px 0;
}

.osm-autocomplete-results::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
}

.osm-autocomplete-results::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Item de résultat */
.osm-result-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
    gap: 12px;
}

.osm-result-item:last-child {
    border-bottom: none;
    border-radius: 0 0 12px 12px;
}

.osm-result-item:hover,
.osm-result-item.selected {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05), rgba(5, 150, 105, 0.05));
    border-left: 3px solid #10b981;
    padding-left: 13px;
}

/* Icône du résultat */
.osm-result-icon {
    font-size: 24px;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 8px;
}

/* Contenu du résultat */
.osm-result-content {
    flex: 1;
    min-width: 0;
}

.osm-result-name {
    font-size: 15px;
    font-weight: 600;
    color: #1a202c;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.osm-result-name strong {
    color: #10b981;
    font-weight: 700;
}

.osm-result-type {
    font-size: 12px;
    color: #10b981;
    font-weight: 500;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.osm-result-address {
    font-size: 13px;
    color: #718096;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Coordonnées GPS */
.osm-result-coords {
    flex-shrink: 0;
    text-align: right;
    color: #a0aec0;
    font-size: 11px;
    font-family: 'Courier New', monospace;
}

/* États spéciaux */
.osm-loading,
.osm-no-results,
.osm-error {
    padding: 20px;
    text-align: center;
    color: #718096;
    font-size: 14px;
}

.osm-loading i {
    color: #10b981;
    font-size: 18px;
    margin-right: 8px;
}

.osm-no-results i {
    color: #cbd5e0;
    font-size: 18px;
    margin-right: 8px;
}

.osm-error {
    color: #f56565;
}

.osm-error i {
    font-size: 18px;
    margin-right: 8px;
}

/* Animation d'apparition */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.osm-autocomplete-results[style*="display: block"] {
    animation: slideDown 0.2s ease;
}

/* Style de l'input avec autocomplétion active */
input.osm-autocomplete-active {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom-color: #10b981;
}

/* Badge indicateur de lieu sélectionné */
.osm-selected-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
    animation: fadeIn 0.3s ease;
}

.osm-selected-badge i {
    font-size: 14px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .osm-autocomplete-results {
        max-height: 300px;
    }

    .osm-result-item {
        padding: 10px 12px;
        gap: 10px;
    }

    .osm-result-icon {
        font-size: 20px;
        width: 28px;
        height: 28px;
    }

    .osm-result-name {
        font-size: 14px;
    }

    .osm-result-type {
        font-size: 11px;
    }

    .osm-result-address {
        font-size: 12px;
    }

    .osm-result-coords {
        display: none; /* Masquer les coordonnées sur mobile */
    }
}

/* Style pour l'input parent */
.form-group {
    position: relative;
}

/* Indicateur de chargement dans l'input */
.osm-input-loading {
    position: relative;
}

.osm-input-loading::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #10b981;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

/* Badge de type de lieu */
.place-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Message d'info sous l'input */
.osm-input-help {
    font-size: 12px;
    color: #718096;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.osm-input-help i {
    color: #10b981;
}

/* Highlight pour recherche */
.osm-highlight {
    background: rgba(16, 185, 129, 0.2);
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 600;
}
