import re

with open('properties.html', 'r', encoding='utf-8') as f:
    content = f.read()

toolbar_pattern = r'\s*<!-- Sticky Toolbar -->.*?</div>\s*</div>\s*</div>\s*'
toolbar_match = re.search(toolbar_pattern, content, re.DOTALL)

if toolbar_match:
    toolbar_html = toolbar_match.group(0)
    # Remove from old position
    content = content.replace(toolbar_html, '\n\n')
    
    # Insert right after <header class="main-header"></header>
    content = content.replace('<header class="main-header"></header>', '<header class="main-header"></header>\n' + toolbar_html)
    
    with open('properties.html', 'w', encoding='utf-8') as f:
        f.write(content)
    print('Successfully moved toolbar')
else:
    print('Toolbar not found')
