/**
 * Advanced Search Autocomplete Styles
 * Modern, minimal design with smooth animations
 */

/* =====================================================
   Autocomplete Dropdown
   ===================================================== */

.autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: none;
    border: 1px solid #e2e8f0;
    max-height: 480px;
    overflow-y: auto;
    z-index: 1000;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar styling */
.autocomplete-dropdown::-webkit-scrollbar {
    width: 6px;
}

.autocomplete-dropdown::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.autocomplete-dropdown::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.autocomplete-dropdown::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* =====================================================
   Sections
   ===================================================== */

.autocomplete-section {
    padding: 12px 0;
    border-bottom: 1px solid #e5e7eb;
}

.autocomplete-section:last-child {
    border-bottom: none;
}

.autocomplete-section-title {
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.autocomplete-section-title i {
    color: #17a2b8;
}

/* =====================================================
   Items
   ===================================================== */

.autocomplete-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    text-decoration: none;
    color: #1f2937;
    border: none;
    background: none;
    width: 100%;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background-color: rgba(23, 162, 184, 0.05);
    border-left: 3px solid #17a2b8;
    padding-left: 13px;
}

.autocomplete-item mark {
    background-color: #fef3c7;
    color: #92400e;
    font-weight: 600;
    padding: 2px 4px;
    border-radius: 3px;
}

/* Product items */
.product-item {
    padding: 12px 16px;
}

.autocomplete-image {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.autocomplete-item-content {
    flex: 1;
    min-width: 0;
}

.autocomplete-item-name {
    font-size: 14px;
    font-weight: 500;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.autocomplete-item-meta {
    font-size: 12px;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 12px;
}

.autocomplete-item-meta .price {
    font-weight: 600;
    color: #17a2b8;
}

.autocomplete-item-meta .offers {
    color: #10b981;
}

/* Category and Brand items */
.category-item i,
.brand-item i {
    font-size: 18px;
    color: #6b7280;
    flex-shrink: 0;
}

.recent-item,
.popular-item {
    position: relative;
}

.recent-item i,
.popular-item i {
    font-size: 14px;
    color: #94a3b8;
    flex-shrink: 0;
}

.remove-recent {
    margin-left: auto;
    background: none;
    border: none;
    padding: 4px 8px;
    cursor: pointer;
    color: #9ca3af;
    font-size: 12px;
    border-radius: 4px;
    transition: all 0.15s ease;
    opacity: 0;
}

.recent-item:hover .remove-recent {
    opacity: 1;
}

.remove-recent:hover {
    background-color: #fee2e2;
    color: #dc2626;
}

/* =====================================================
   States
   ===================================================== */

.autocomplete-loading,
.autocomplete-error,
.autocomplete-empty {
    padding: 24px 16px;
    text-align: center;
    color: #6b7280;
    font-size: 14px;
}

.autocomplete-loading i {
    color: #3b82f6;
    margin-right: 8px;
}

.autocomplete-error {
    color: #dc2626;
}

.autocomplete-empty {
    color: #9ca3af;
}

.autocomplete-empty i {
    font-size: 32px;
    color: #cbd5e1;
    display: block;
    margin-bottom: 12px;
}

/* =====================================================
   Typo Correction
   ===================================================== */

.autocomplete-typo {
    padding: 12px 16px;
    background: #eff6ff;
    border-left: 3px solid #3b82f6;
    font-size: 13px;
    color: #1e40af;
    display: flex;
    align-items: center;
    gap: 8px;
}

.autocomplete-typo i {
    color: #3b82f6;
}

.typo-suggestion {
    color: #2563eb;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

.typo-suggestion:hover {
    color: #1d4ed8;
}

/* =====================================================
   Mobile Responsive
   ===================================================== */

@media (max-width: 768px) {
    .autocomplete-dropdown {
        max-height: 60vh;
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
    
    .autocomplete-item {
        padding: 10px 12px;
        gap: 10px;
    }
    
    .autocomplete-image {
        width: 40px;
        height: 40px;
    }
    
    .autocomplete-item-name {
        font-size: 13px;
    }
    
    .autocomplete-item-meta {
        font-size: 11px;
    }
    
    .autocomplete-section-title {
        padding: 6px 12px;
        font-size: 11px;
    }
}

/* =====================================================
   Accessibility
   ===================================================== */

.autocomplete-item:focus {
    outline: 2px solid #3b82f6;
    outline-offset: -2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .autocomplete-dropdown {
        border: 2px solid #000;
    }
    
    .autocomplete-item:hover,
    .autocomplete-item.active {
        background-color: #000;
        color: #fff;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .autocomplete-dropdown {
        animation: none;
    }
    
    * {
        transition: none !important;
    }
}

/* =====================================================
   Dark Mode Support
   ===================================================== */

@media (prefers-color-scheme: dark) {
    .autocomplete-dropdown {
        background: #1f2937;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4),
                    0 2px 8px rgba(0, 0, 0, 0.3);
    }
    
    .autocomplete-section {
        border-bottom-color: #374151;
    }
    
    .autocomplete-section-title {
        color: #9ca3af;
    }
    
    .autocomplete-item {
        color: #f3f4f6;
    }
    
    .autocomplete-item:hover,
    .autocomplete-item.active {
        background-color: #374151;
    }
    
    .autocomplete-item-name {
        color: #f9fafb;
    }
    
    .autocomplete-item-meta {
        color: #9ca3af;
    }
    
    .autocomplete-image {
        border-color: #374151;
    }
    
    .autocomplete-typo {
        background: #1e3a5f;
        border-left-color: #3b82f6;
        color: #93c5fd;
    }
    
    .autocomplete-loading,
    .autocomplete-empty {
        color: #9ca3af;
    }
    
    .autocomplete-dropdown::-webkit-scrollbar-track {
        background: #374151;
    }
    
    .autocomplete-dropdown::-webkit-scrollbar-thumb {
        background: #4b5563;
    }
}
