import os
import re

# Step 1: Update homepage to 70px
print("📄 Updating Homepage...")
with open('index.html', 'r', encoding='utf-8') as f:
    content = f.read()

# Change Mercedes height from 60px to 70px on homepage
content = re.sub(
    r'(<img[^>]*src="/mercedes-logo-final\.png"[^>]*style="[^"]*?)height:\s*60px;',
    r'\1height: 70px;',
    content
)

with open('index.html', 'w', encoding='utf-8') as f:
    f.write(content)
print("✅ Homepage updated to 70px Mercedes")

# Step 2: Remove Mercedes from all other pages
print("\n📄 Removing Mercedes from all other pages...")

# List of all other pages (exclude index.html)
other_pages = [
    # Main pages
    'quotation.html', 'fleet.html', 'contact.html',
    'locations.html', 'sitemap-towns.html', 'q-and-a.html', 
    'privacy.html', 'terms.html',
    # Admin pages
    'admin-drivers.html', 'admin-messages.html', 'admin-new-booking.html',
    'admin-pricing.html', 'admin-quotes.html', 'admin.html', 'admin-login.html',
    # Other pages
    'acceptable-use.html', 'gdpr.html', 'promotional-terms.html',
    'sign-in.html', 'sign-up.html', 'success.html', 'test-menu.html',
    'terms_temp.html', 'terms_old_backup.html', 'reset-password.html'
]

for page in other_pages:
    if not os.path.exists(page):
        print(f"  ⚠️  {page} - File not found")
        continue
    
    with open(page, 'r', encoding='utf-8') as f:
        content = f.read()
    
    original_content = content
    
    # Remove the entire Mercedes image tag
    content = re.sub(
        r'\s*<img[^>]*src="/mercedes-logo-final\.png"[^>]*>',
        '',
        content
    )
    
    if content != original_content:
        with open(page, 'w', encoding='utf-8') as f:
            f.write(content)
        print(f"  ✅ Removed Mercedes from {page}")
    else:
        print(f"  ℹ️  {page} - No Mercedes image found")

print("\n" + "="*60)
print("✅ COMPLETE!")
print("="*60)
print("✅ Homepage: 70px Mercedes")
print("✅ All other pages: Mercedes removed (only Logo.svg)")
print("="*60)
