/**
 * ================================================
 * AUTOCOMPLETE.CSS - Estilos do dropdown de sugestões
 * ================================================
 * Caminho: frontend/css/autocomplete.css
 * Versão: v1.1.0
 * Data: 01/12/2025
 * 
 * v1.1.0: Fix overflow + cores ajustadas
 * ================================================
 */

/* ==================== DROPDOWN CONTAINER ==================== */
.autocomplete-dropdown {
    position: fixed !important; /* 🆕 v1.1.0: Fixed para escapar do overflow */
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: var(--z-critico) !important; /* 🆕 v1.1.1: Acima do histórico de pesquisa */
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    min-width: 280px;
    width: auto;
}

/* Tema escuro */
[data-theme="dark"] .autocomplete-dropdown,
.dark-mode .autocomplete-dropdown {
    background: rgba(30, 41, 59, 0.98);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* ==================== ITEM DE SUGESTÃO ==================== */
.autocomplete-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.autocomplete-item:first-child {
    border-radius: 12px 12px 0 0;
}

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

.autocomplete-item:only-child {
    border-radius: 12px;
}

.autocomplete-item:hover,
.autocomplete-item.highlighted {
    background: rgba(232, 83, 31, 0.08);
}

/* Tema escuro - hover */
[data-theme="dark"] .autocomplete-item:hover,
[data-theme="dark"] .autocomplete-item.highlighted,
.dark-mode .autocomplete-item:hover,
.dark-mode .autocomplete-item.highlighted {
    background: rgba(232, 83, 31, 0.2);
}

/* ==================== ÍCONE DO ITEM ==================== */
.autocomplete-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(232, 83, 31, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.autocomplete-item-icon i {
    color: #E8531F;
    font-size: 14px;
}

/* Tema escuro - ícone */
[data-theme="dark"] .autocomplete-item-icon,
.dark-mode .autocomplete-item-icon {
    background: rgba(232, 83, 31, 0.2);
}

/* ==================== TEXTO DO ITEM ==================== */
.autocomplete-item-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

/* 🆕 v1.1.0: Cor ajustada - preto/cinza escuro */
.autocomplete-item-label {
    font-size: 14px;
    font-weight: 500;
    color: #2d3748; /* Cinza escuro */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.autocomplete-item-desc {
    font-size: 12px;
    color: #718096; /* Cinza médio */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

/* Tema escuro - texto */
[data-theme="dark"] .autocomplete-item-label,
.dark-mode .autocomplete-item-label {
    color: #f7fafc;
}

[data-theme="dark"] .autocomplete-item-desc,
.dark-mode .autocomplete-item-desc {
    color: rgba(255, 255, 255, 0.6);
}

/* ==================== ESTADOS ESPECIAIS ==================== */

/* Loading */
.autocomplete-loading {
    padding: 20px;
    text-align: center;
    color: #718096;
    font-size: 14px;
}

.autocomplete-loading i {
    margin-right: 8px;
    color: #E8531F;
}

/* Tema escuro - loading */
[data-theme="dark"] .autocomplete-loading,
.dark-mode .autocomplete-loading {
    color: rgba(255, 255, 255, 0.6);
}

/* Vazio (sem resultados) */
.autocomplete-empty {
    padding: 20px;
    text-align: center;
    color: #718096;
    font-size: 14px;
}

.autocomplete-empty i {
    margin-right: 8px;
    opacity: 0.5;
}

/* Tema escuro - vazio */
[data-theme="dark"] .autocomplete-empty,
.dark-mode .autocomplete-empty {
    color: rgba(255, 255, 255, 0.5);
}

/* Erro */
.autocomplete-error {
    padding: 20px;
    text-align: center;
    color: #e53e3e;
    font-size: 14px;
}

.autocomplete-error i {
    margin-right: 8px;
}

/* ==================== SCROLLBAR CUSTOMIZADA ==================== */
.autocomplete-dropdown::-webkit-scrollbar {
    width: 6px;
}

.autocomplete-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.autocomplete-dropdown::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.autocomplete-dropdown::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Tema escuro - scrollbar */
[data-theme="dark"] .autocomplete-dropdown::-webkit-scrollbar-thumb,
.dark-mode .autocomplete-dropdown::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .autocomplete-dropdown::-webkit-scrollbar-thumb:hover,
.dark-mode .autocomplete-dropdown::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ==================== RESPONSIVO ==================== */
@media (max-width: 480px) {
    .autocomplete-dropdown {
        max-height: 220px;
        min-width: 260px;
    }
    
    .autocomplete-item {
        padding: 10px 12px;
        gap: 10px;
    }
    
    .autocomplete-item-icon {
        width: 32px;
        height: 32px;
    }
    
    .autocomplete-item-icon i {
        font-size: 12px;
    }
    
    .autocomplete-item-label {
        font-size: 13px;
    }
    
    .autocomplete-item-desc {
        font-size: 11px;
    }
}

/* ==================== ANIMAÇÃO DE ENTRADA ==================== */
.autocomplete-dropdown {
    animation: dropdownFadeIn 0.2s ease-out;
}

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