
import sys

def check_html_balance(filename):
    with open(filename, 'r') as f:
        content = f.read()
    
    # Simple regex to find tags, ignoring PHP for now
    import re
    tags = re.findall(r'<(/?div|/?span|/?form|/?section|/?article|/?aside|/?header|/?footer|/?nav|/?main)', content)
    
    stack = []
    for i, tag in enumerate(tags):
        if tag.startswith('/'):
            if not stack:
                print(f"Error: Closing tag {tag} with no opening tag at index {i}")
            else:
                stack.pop()
        else:
            stack.append(tag)
    
    if stack:
        print(f"Error: Unbalanced tags remaining: {stack}")
    else:
        print("Tags are balanced (excluding potential PHP issues)")

check_html_balance('index.php')
