/**
 * Styles pour l'autocomplétion intelligente de la navbar
 * 
 * Design moderne, responsive et accessible
 * Support thème light/dark
 */

/* === CONTENEUR PRINCIPAL === */
.navbar-autocomplete-container {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-width: 600px;
    max-height: 500px;
    margin-top: 8px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15),
                0 0 0 1px rgba(0, 0, 0, 0.05);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s 0.2s;
    z-index: 10000;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.navbar-autocomplete-container.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Ajustement pour le positionnement dans la navbar */
.searchBar {
    position: relative;
}

/* === LOADER === */
.navbar-autocomplete-loader {
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 14px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* === EN-TÊTE === */
.navbar-autocomplete-header {
    padding: 10px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

/* === LISTE DES RÉSULTATS === */
.navbar-autocomplete-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    flex: 1;
    max-height: 400px;
}

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

.navbar-autocomplete-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.navbar-autocomplete-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.navbar-autocomplete-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* === ITEM DE RÉSULTAT === */
.navbar-autocomplete-item {
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.15s ease;
}

.navbar-autocomplete-item:last-child {
    border-bottom: none;
}

.navbar-autocomplete-item.selected,
.navbar-autocomplete-item:hover {
    background: linear-gradient(90deg, #f8f9ff 0%, #ffffff 100%);
}

.navbar-autocomplete-link {
    display: block;
    padding: 12px 16px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.navbar-autocomplete-label {
    font-size: 15px;
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.navbar-autocomplete-address {
    font-size: 13px;
    color: #7f8c8d;
}

/* === FOOTER === */
.navbar-autocomplete-footer {
    padding: 8px 16px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    font-size: 12px;
    color: #6c757d;
    text-align: center;
    flex-shrink: 0;
}

/* === AUCUN RÉSULTAT === */
.navbar-autocomplete-no-results {
    padding: 40px 20px;
    text-align: center;
}

.navbar-autocomplete-no-results-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.3;
}

.navbar-autocomplete-no-results-text {
    font-size: 16px;
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 8px;
}

.navbar-autocomplete-no-results-hint {
    font-size: 13px;
    color: #7f8c8d;
}

/* === ERREUR === */
.navbar-autocomplete-error {
    padding: 30px 20px;
    text-align: center;
}

.navbar-autocomplete-error-icon {
    font-size: 36px;
    margin-bottom: 10px;
}

.navbar-autocomplete-error-text {
    font-size: 14px;
    color: #e74c3c;
    font-weight: 500;
}

/* === RESPONSIVE === */

/* Tablettes */
@media screen and (max-width: 768px) {
    .navbar-autocomplete-container {
        left: -20px;
        right: -20px;
        max-width: calc(100vw - 40px);
        border-radius: 0;
        margin-top: 5px;
    }
    
    .navbar-autocomplete-list {
        max-height: 300px;
    }
    
    .navbar-autocomplete-label {
        font-size: 14px;
    }
    
    .navbar-autocomplete-address {
        font-size: 12px;
    }
}

/* Mobile */
@media screen and (max-width: 480px) {
    .navbar-autocomplete-container {
        left: -10px;
        right: -10px;
        max-width: calc(100vw - 20px);
        max-height: 400px;
        border-radius: 0;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }
    
    .navbar-autocomplete-header {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .navbar-autocomplete-link {
        padding: 10px 12px;
    }
    
    .navbar-autocomplete-list {
        max-height: 250px;
    }
    
    .navbar-autocomplete-label {
        font-size: 13px;
    }
    
    .navbar-autocomplete-address {
        font-size: 11px;
    }
    
    .navbar-autocomplete-footer {
        padding: 6px 12px;
        font-size: 11px;
    }
    
    .navbar-autocomplete-no-results {
        padding: 30px 15px;
    }
    
    .navbar-autocomplete-no-results-icon {
        font-size: 36px;
    }
    
    .navbar-autocomplete-no-results-text {
        font-size: 14px;
    }
    
    .navbar-autocomplete-no-results-hint {
        font-size: 12px;
    }
}

/* === DARK MODE === */
@media (prefers-color-scheme: dark) {
    .navbar-autocomplete-container {
        background: #2c3e50;
        border-color: #34495e;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3),
                    0 0 0 1px rgba(0, 0, 0, 0.1);
    }
    
    .navbar-autocomplete-header {
        background: linear-gradient(135deg, #5f72bd 0%, #6b5b95 100%);
    }
    
    .navbar-autocomplete-item {
        border-bottom-color: #34495e;
    }
    
    .navbar-autocomplete-item.selected,
    .navbar-autocomplete-item:hover {
        background: linear-gradient(90deg, #34495e 0%, #2c3e50 100%);
    }
    
    .navbar-autocomplete-label {
        color: #ecf0f1;
    }
    
    .navbar-autocomplete-address {
        color: #95a5a6;
    }
    
    .navbar-autocomplete-footer {
        background: #34495e;
        border-top-color: #2c3e50;
        color: #95a5a6;
    }
    
    .navbar-autocomplete-list::-webkit-scrollbar-track {
        background: #34495e;
    }
    
    .navbar-autocomplete-list::-webkit-scrollbar-thumb {
        background: #7f8c8d;
    }
    
    .navbar-autocomplete-list::-webkit-scrollbar-thumb:hover {
        background: #95a5a6;
    }
    
    .navbar-autocomplete-no-results-text {
        color: #ecf0f1;
    }
    
    .navbar-autocomplete-no-results-hint {
        color: #95a5a6;
    }
    
    .navbar-autocomplete-error-text {
        color: #e74c3c;
    }
}

/* === ANIMATIONS === */
@keyframes slideDown {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.navbar-autocomplete-item {
    animation: slideDown 0.2s ease;
}

/* === ACCESSIBILITÉ === */
.navbar-autocomplete-item:focus-within {
    outline: 2px solid #667eea;
    outline-offset: -2px;
}

/* Meilleure visibilité du focus clavier */
.navbar-autocomplete-link:focus {
    outline: none;
}

.navbar-autocomplete-item.selected .navbar-autocomplete-link:focus {
    background: linear-gradient(90deg, #e8ebff 0%, #f8f9ff 100%);
}

/* === ICÔNES ET EMOJIS === */
.navbar-autocomplete-label::before {
    font-size: 18px;
    flex-shrink: 0;
}

/* === PERFORMANCES === */
.navbar-autocomplete-container,
.navbar-autocomplete-item,
.navbar-autocomplete-link {
    will-change: transform, opacity;
}

/* Optimisation pour les petits écrans */
@media screen and (max-width: 320px) {
    .navbar-autocomplete-container {
        max-height: 300px;
    }
    
    .navbar-autocomplete-list {
        max-height: 200px;
    }
}

/* === AJUSTEMENTS POUR LA NAVBAR === */
/* Assurer que le conteneur s'affiche au-dessus de tous les autres éléments */
nav .searchBar {
    z-index: 1000;
}

/* Responsive pour la navbar desktop */
@media screen and (min-width: 993px) {
    .navbar-autocomplete-container {
        min-width: 400px;
    }
}

/* === ÉTATS HOVER AMÉLIORÉS === */
.navbar-autocomplete-item.selected .navbar-autocomplete-label {
    color: #667eea;
}

.navbar-autocomplete-item:hover .navbar-autocomplete-label {
    color: #667eea;
}

/* === TRANSITIONS DOUCES === */
.navbar-autocomplete-item,
.navbar-autocomplete-label,
.navbar-autocomplete-address {
    transition: all 0.15s ease;
}
