import glob
import re

files = glob.glob('resources/views/livewire/admin/**/*.blade.php', recursive=True)

for filepath in files:
    with open(filepath, 'r') as f:
        content = f.read()

    # Find the inner div which follows the absolute inset-0 backdrop
    # It usually starts with <div class="relative ... bg-white ... rounded-2xl ... max-h-[85vh] ...">
    # We want to replace it with:
    # <div class="relative w-full md:w-3/4 lg:w-3/4 bg-white dark:bg-slate-900 shadow-2xl flex flex-col h-full animate-slide-in-right overflow-hidden border-l border-slate-200 dark:border-slate-800">
    
    # Let's replace the whole class attribute for these modal containers
    # The container is the sibling of <div class="absolute inset-0 bg-slate-900/40...
    
    # We will use regex to find the div immediately after the backdrop
    pattern = r'(<div class="absolute inset-0[^>]*></div>\s*)<div class="relative[^>]*>'
    replacement = r'\1<div class="relative w-full md:w-3/4 lg:w-3/4 bg-white dark:bg-slate-900 shadow-2xl flex flex-col h-full animate-slide-in-right overflow-hidden border-l border-slate-200 dark:border-slate-800">'
    
    new_content = re.sub(pattern, replacement, content)

    if new_content != content:
        with open(filepath, 'w') as f:
            f.write(new_content)

print("Done")
