/**
 * Search Autocomplete Styles
 */

.search-autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 500px;
    overflow-y: auto;
    z-index: 1000;
}

.autocomplete-results {
    padding: 0;
}

.autocomplete-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f0f0f0;
}

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

.autocomplete-item:hover,
.autocomplete-item.selected {
    background-color: #f8f9fa;
}

.autocomplete-image {
    width: 60px;
    height: 60px;
    margin-right: 12px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.autocomplete-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.autocomplete-image .no-image {
    color: #ccc;
    font-size: 1.5rem;
}

.autocomplete-details {
    flex: 1;
    min-width: 0;
}

.autocomplete-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #2c3e50;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.autocomplete-name strong {
    color: #3498db;
    background: #e8f4f8;
    padding: 0 2px;
    border-radius: 2px;
}

.autocomplete-meta {
    font-size: 0.8rem;
    color: #7f8c8d;
    margin-bottom: 4px;
}

.autocomplete-sku {
    margin-right: 8px;
}

.autocomplete-category {
    padding: 2px 6px;
    background: #ecf0f1;
    border-radius: 3px;
    font-size: 0.75rem;
}

.autocomplete-stock {
    font-size: 0.8rem;
    font-weight: 500;
}

.autocomplete-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    margin-left: 12px;
}

.autocomplete-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: #27ae60;
}

.add-to-cart-btn {
    padding: 6px 12px;
    border-radius: 4px;
}

.autocomplete-footer {
    padding: 12px 16px;
    text-align: center;
    border-top: 1px solid #f0f0f0;
    background: #f8f9fa;
}

.view-all-link {
    color: #3498db;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}

.view-all-link:hover {
    text-decoration: underline;
}

.autocomplete-loading,
.autocomplete-no-results,
.autocomplete-error {
    padding: 24px;
    text-align: center;
    color: #7f8c8d;
}

.autocomplete-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.autocomplete-no-results i,
.autocomplete-error i {
    font-size: 2rem;
    display: block;
    margin-bottom: 12px;
}

.autocomplete-no-results p,
.autocomplete-error p {
    margin: 8px 0;
    color: #95a5a6;
}

.autocomplete-error {
    color: #e74c3c;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .autocomplete-image {
        width: 50px;
        height: 50px;
    }
    
    .autocomplete-name {
        font-size: 0.9rem;
    }
    
    .autocomplete-meta,
    .autocomplete-stock {
        font-size: 0.75rem;
    }
    
    .autocomplete-price {
        font-size: 1rem;
    }
    
    .add-to-cart-btn {
        padding: 4px 8px;
        font-size: 0.85rem;
    }
    
    .autocomplete-item {
        padding: 10px 12px;
    }
}

/* Search input enhancement */
.search-autocomplete-input {
    position: relative;
}

.search-autocomplete-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
}

/* Loading spinner in input */
.search-input-wrapper {
    position: relative;
}

.search-input-loading {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

/* Scrollbar styling */
.search-autocomplete-dropdown::-webkit-scrollbar {
    width: 6px;
}

.search-autocomplete-dropdown::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 8px;
}

.search-autocomplete-dropdown::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 8px;
}

.search-autocomplete-dropdown::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

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

.search-autocomplete-dropdown {
    animation: slideDown 0.2s ease-out;
}

/* Focus states for accessibility */
.autocomplete-item:focus {
    outline: 2px solid #3498db;
    outline-offset: -2px;
}
