import re

html_files = [
    'd:\\iss\\Franciscan Society\\index.html',
    'd:\\iss\\Franciscan Society\\about.html',
    'd:\\iss\\Franciscan Society\\gallery.html'
]

youtube_btn_html = """<a href="https://youtube.com" target="_blank" style="position: absolute; inset: 0; background: transparent; display: flex; align-items: center; justify-content: center; text-decoration: none; z-index: 99; transition: background 0.3s;">
                                <div style="width: 48px; height: 34px; background: #FF0000; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; box-shadow: 0 4px 12px rgba(255,0,0,0.5); transition: transform 0.3s;">
                                    <svg viewBox="0 0 24 24" fill="currentColor" width="20" height="20" style="margin-left: 3px;">
                                        <path d="M8 5v14l11-7z"/>
                                    </svg>
                                </div>
                            </a>"""

for file_path in html_files:
    try:
        with open(file_path, 'r', encoding='utf-8') as f:
            content = f.read()
        
        # Replace the old a tag for the youtube video
        pattern = r'<a href="https://youtube\.com"[^>]*>.*?</a>'
        content = re.sub(pattern, youtube_btn_html, content, flags=re.DOTALL)
        
        with open(file_path, 'w', encoding='utf-8') as f:
            f.write(content)
        print(f"Updated HTML in {file_path}")
    except Exception as e:
        print(f"Error in {file_path}: {e}")

# Hide CTA Dock globally
css_code = "\n/* Hide the old CTA dock that conflicts with new bottom bar */\n.cta-dock { display: none !important; }\n"
with open('d:\\iss\\Franciscan Society\\css\\styles.css', 'a', encoding='utf-8') as f:
    f.write(css_code)
print("Updated CSS to hide cta-dock")
