<?php
$content = file_get_contents('/Users/ahmeddarrazi/Documents/projects/wt-plattform/apps/platform/resources/views/filament/widgets/dashboard/tenant-dashboard-overview.blade.php');

$startMarker = '<x-filament::section>';
$gridMarker = '<div class="grid min-w-0 gap-6 xl:grid-cols-[minmax(0,1.65fr)_minmax(20rem,1fr)]">';

$posStart = strpos($content, $startMarker);
$posGrid = strpos($content, $gridMarker);

if ($posStart !== false && $posGrid !== false) {
    // We want to remove everything from $startMarker up to (but not including) $gridMarker
    // And replace it with our main grid start
    
    $header = substr($content, 0, $posStart);
    
    $newStart = '<div class="grid min-w-0 gap-6 xl:grid-cols-12">
    <!-- Left Column (Main) -->
    <div class="flex min-w-0 flex-col gap-6 xl:col-span-8">';
    
    $remaining = substr($content, $posGrid + strlen($gridMarker));
    
    // We also need to change the split for the right column.
    // The left column ends and the right column starts somewhere.
    // Let's find "<!-- Right Column (Aside) -->" or where the left div ends.

    $newContent = $header . $newStart . $remaining;
    
    file_put_contents('/Users/ahmeddarrazi/Documents/projects/wt-plattform/apps/platform/resources/views/filament/widgets/dashboard/tenant-dashboard-overview.blade.php', $newContent);
    echo "Replaced top section\n";
} else {
    echo "Markers not found\n";
}

