#search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    max-height: 320px;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    z-index: 1100 !important;
    
    /* Hide scrollbar */
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
}

#search-results::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}

#search-results-link::-webkit-scrollbar {
    width: 6px;
}

#search-results-link::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 3px;
}

.search-result-item {
    padding: 0.625rem 1rem;
    cursor: pointer;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}

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

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

.search-result-item:hover .p-avatar, 
.search-result-item:hover .p-avatar-initial {
    transform: scale(1.1);
}

/* Custom Autocomplete (used in forms etc.) */
.custom-autocomplete-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 320px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1), 0 0 1px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid #f1f5f9;
}

.stemma-suggestion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.stemma-suggestion-item:hover {
    background: #f8fafc;
}

.stemma-suggestion-item img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 4px;
    background: #f1f5f9;
    padding: 2px;
}

.stemma-suggestion-item .suggestion-info {
    display: flex;
    flex-direction: column;
}

.stemma-suggestion-item .suggestion-name {
    font-size: 14px;
    font-weight: 500;
    color: #0f172a;
}

.stemma-suggestion-item .suggestion-filename {
    font-size: 11px;
    color: #94a3b8;
}

/* Mention Preview Card */
.mention-preview-card {
    position: fixed;
    z-index: 3000;
    width: 280px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: none;
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.mention-preview-card.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.mention-preview-avatar {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    background-size: cover;
    background-position: center;
    background-color: var(--glass-bg);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    border: 2px solid white;
}

.mention-preview-content {
    flex: 1;
    min-width: 0;
}

.mention-preview-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mention-preview-dates {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0 0 6px 0;
}

.mention-preview-family {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.3;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mention-link {
    cursor: pointer !important;
    text-decoration: underline dotted rgba(0, 0, 0, 0.3);
}

.mention-link:hover {
    color: var(--primary-color);
    text-decoration: underline !important;
}

/* Mobile Search Fixes */
@media (max-width: 768px) {
    #search-input {
        width: 100%;
        max-width: none;
        flex: 1 1 150px;
        height: 36px;
        padding: 4px 8px;
    }
}
