/* Unified Search Results Styling */

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

/* Search Categories */
.search-category {
    border-bottom: 1px solid #f0f0f0;
}

.search-category:last-child {
    border-bottom: none;
}

.search-category-title {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    padding: 0.5rem 1rem 0;
    color: #495057;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    margin: 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Search Result Items */
.search-result-item {
    transition: background-color 0.2s ease;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.search-result-item:hover {
    background-color: #f8f9fa;
}

.search-result-item:last-child {
    border-bottom: none !important;
}

.search-result-item h6 {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.search-result-item h6 a {
    color: #212529;
    font-weight: 500;
    text-decoration: none;
}

.search-result-item h6 a:hover {
    color: #007bff;
    text-decoration: underline;
}

.search-result-item p {
    font-size: 0.8rem;
    line-height: 1.4;
    margin-bottom: 0.25rem;
    color: #6c757d;
}

/* Search Results Footer */
.search-results-footer {
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
    position: sticky;
    bottom: 0;
    z-index: 10;
}

/* Badges */
.badge-sm {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

/* Loading and Error States */
.search-loading {
    text-align: center;
    color: #6c757d;
    font-style: italic;
}

.search-no-results {
    text-align: center;
    color: #6c757d;
    padding: 2rem 1rem;
}

.search-error {
    text-align: center;
    color: #dc3545;
    padding: 1rem;
}

/* Category Icons */
.search-category-title i {
    width: 16px;
    text-align: center;
}

/* Price Badges */
.search-result-item .badge.bg-success {
    font-size: 0.75rem;
    font-weight: 500;
}

/* Avatar Images */
.search-result-item img.rounded-circle,
.search-result-item img.rounded {
    border: 1px solid #e9ecef;
}

/* Responsive Design */
@media (max-width: 768px) {
    .search-results-dropdown {
        max-height: 400px;
        left: -15px;
        right: -15px;
        border-radius: 0 0 12px 12px;
    }
    
    .search-result-item {
        padding: 0.75rem !important;
    }
    
    .search-result-item h6 {
        font-size: 0.85rem;
    }
    
    .search-result-item p {
        font-size: 0.75rem;
    }
    
    .search-result-item small {
        font-size: 0.7rem;
    }
    
    .search-category-title {
        font-size: 0.8rem;
        padding: 0.4rem 0.75rem;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .search-results-dropdown {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .search-category-title {
        background-color: #1a202c;
        color: #e2e8f0;
        border-bottom-color: #4a5568;
    }
    
    .search-result-item:hover {
        background-color: #4a5568;
    }
    
    .search-result-item h6 a {
        color: #e2e8f0;
    }
    
    .search-result-item h6 a:hover {
        color: #63b3ed;
    }
    
    .search-results-footer {
        background-color: #1a202c;
        border-top-color: #4a5568;
    }
}

/* Animation for smooth appearance */
.search-results-dropdown {
    animation: slideDown 0.2s ease-out;
}

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

/* Highlight matching text */
.search-highlight {
    background-color: #fff3cd;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 500;
}

/* Category color coding */
.search-category-title.text-primary { color: #007bff !important; }
.search-category-title.text-success { color: #28a745 !important; }
.search-category-title.text-warning { color: #ffc107 !important; }
.search-category-title.text-info { color: #17a2b8 !important; }

/* Improved spacing */
.search-result-item .d-flex {
    align-items: flex-start;
}

.search-result-item .flex-grow-1 {
    min-width: 0; /* Allows text truncation */
}

/* Better text truncation */
.search-result-item h6 a {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-item p {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
