/* Modern Search Styles */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    z-index: 1050;
    max-height: 400px;
    overflow-y: auto;
    margin-top: 4px;
}

.search-suggestions .suggestions-content {
    border-radius: 8px;
    overflow: hidden;
}

.suggestions-header {
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    font-size: 0.8rem;
    font-weight: 500;
    color: #6c757d;
}

.suggestion-item {
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f8f9fa;
}

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

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

.suggestion-item.view-all:hover {
    background: #e3f2fd;
}

.suggestion-item.no-results {
    cursor: default;
}

.suggestion-item.no-results:hover {
    background: transparent;
}

.suggestion-image {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.suggestion-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.suggestion-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
    margin-bottom: 2px;
    line-height: 1.2;
}

.suggestion-title strong {
    background: #fff3cd;
    padding: 1px 2px;
    border-radius: 2px;
}

.suggestion-meta {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.suggestion-meta .badge {
    font-size: 0.7rem;
    padding: 2px 6px;
}

.suggestion-action {
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.suggestion-item:hover .suggestion-action,
.suggestion-item.selected .suggestion-action {
    opacity: 1;
}

/* Search Input Enhancements */
.form-control:focus {
    border-color: #026AA2;
    box-shadow: 0 0 0 0.2rem rgba(2, 106, 162, 0.25);
}

.btn-search {
    transition: color 0.2s ease;
}

.btn-search:hover {
    color: #026AA2 !important;
}

/* Loading State */
.suggestion-item.loading {
    background: #f8f9fa;
}

.suggestion-item.error {
    background: #fff5f5;
}

/* Responsive Design */
@media (max-width: 768px) {
    .search-suggestions {
        left: -15px;
        right: -15px;
        margin-top: 8px;
        border-radius: 12px;
        max-height: 300px;
    }
    
    .suggestion-item {
        padding: 8px 12px;
    }
    
    .suggestion-title {
        font-size: 0.85rem;
    }
    
    .suggestion-meta {
        font-size: 0.75rem;
    }
    
    .suggestion-image {
        width: 35px;
        height: 35px;
    }
}

/* Scrollbar Styling */
.search-suggestions::-webkit-scrollbar {
    width: 4px;
}

.search-suggestions::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.search-suggestions::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.search-suggestions::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

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

.search-suggestions {
    animation: fadeInUp 0.2s ease;
}

/* Focus states */
.search-form {
    position: relative;
}

.search-form .form-control {
    padding-right: 40px;
}

.search-form .btn-search {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6c757d;
    z-index: 10;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.search-form .btn-search:hover {
    color: #026AA2;
    background: rgba(2, 106, 162, 0.1);
}

/* Highlight matching text */
.suggestion-title strong {
    background: linear-gradient(120deg, #fff3cd 0%, #fff3cd 100%);
    background-repeat: no-repeat;
    background-size: 100% 0.2em;
    background-position: 0 88%;
    font-weight: 600;
    color: #856404;
}

/* Brand and Category specific styles */
.brand-suggestion .suggestion-title {
    color: #026AA2;
}

.category-suggestion .suggestion-title {
    color: #198754;
}

.popular-suggestion .suggestion-title {
    color: #6f42c1;
}

/* Mobile specific adjustments */
@media (max-width: 576px) {
    .search-suggestions {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        margin: 0;
        border-radius: 20px 20px 0 0;
        max-height: 50vh;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    }
    
    .suggestions-header {
        position: sticky;
        top: 0;
        z-index: 1;
        background: white;
        border-bottom: 1px solid #dee2e6;
    }
}

/* Multiple Search Instances Support */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    z-index: 1050;
    max-height: 400px;
    overflow-y: auto;
    margin-top: 4px;
}

/* Specific z-index for header search to appear above other elements */
#suggestions-InputHeaderSearch {
    z-index: 1055;
}

/* Specific z-index for product search */
#suggestions-InputProductSearch {
    z-index: 1050;
}

/* Ensure sidebar search container has proper positioning */
.search-box {
    position: relative;
}
