import re

uk = '<svg width="18" height="18" viewBox="0 0 60 30" style="border-radius: 50%; overflow: hidden; vertical-align: middle; flex-shrink: 0; margin-right: 8px;"><rect width="60" height="30" fill="#012169"/><path d="M0 0l60 30M60 0L0 30" stroke="#fff" stroke-width="6"/><path d="M0 0l60 30M60 0L0 30" stroke="#C8102E" stroke-width="4"/><path d="M30 0v30M0 15h60" stroke="#fff" stroke-width="10"/><path d="M30 0v30M0 15h60" stroke="#C8102E" stroke-width="6"/></svg>'
fr = '<svg width="18" height="18" viewBox="0 0 3 2" style="border-radius: 50%; overflow: hidden; vertical-align: middle; flex-shrink: 0; margin-right: 8px;"><rect width="1" height="2" fill="#002395"/><rect x="1" width="1" height="2" fill="#fff"/><rect x="2" width="1" height="2" fill="#ED2939"/></svg>'

pattern = r'<div class="plan-head">\s*<p[^>]*>.*?</p>\s*<h3 class="plan-name"[^>]*>(.*?)</h3>\s*<p class="plan-para"[^>]*>(.*?)</p>\s*</div>'

def repl(match):
    name = match.group(1).strip()
    para = match.group(2).strip()
    return f'''<div class="plan-head">
                                                 <div style="display: flex; align-items: center; margin-bottom: 6px;">
                                                     {uk}
                                                     <h3 class="plan-name" style="margin: 0;">{name}</h3>
                                                 </div>
                                                 <div style="display: flex; align-items: center;">
                                                     {fr}
                                                     <p class="plan-para" style="margin: 0;">{para}</p>
                                                 </div>
                                             </div>'''

with open(r'd:\DN\NIKITA_RAjput\vps.html', 'r', encoding='utf-8') as f:
    content = f.read()

new_content = re.sub(pattern, repl, content, flags=re.DOTALL)

with open(r'd:\DN\NIKITA_RAjput\vps.html', 'w', encoding='utf-8') as f:
    f.write(new_content)

print("Updated successfully!")
