$htmlPath = "site\tools.html"
$html = Get-Content $htmlPath -Raw

$uniqueLogos = @{
    "robots-generator.html" = '<svg viewBox="0 0 24 24" width="24" height="24"><path fill="#34A853" d="M12 2a2 2 0 0 1 2 2v2h3a3 3 0 0 1 3 3v8a3 3 0 0 1-3 3h-2v2H9v-2H7a3 3 0 0 1-3-3V9a3 3 0 0 1 3-3h3V4a2 2 0 0 1 2-2zm4 11h-8v2h8v-2zm-5-4H9v2h2V9zm4 0h-2v2h2V9z"/></svg>'
    "broken-link-checker.html" = '<svg viewBox="0 0 24 24" width="24" height="24"><path fill="#EA4335" d="M17 7h-3v2h3c1.65 0 3 1.35 3 3s-1.35 3-3 3h-3v2h3c2.76 0 5-2.24 5-5s-2.24-5-5-5zM7 17h3v-2H7c-1.65 0-3-1.35-3-3s1.35-3 3-3h3V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5zm5-8l-4 8h2l4-8h-2z"/></svg>'
    "backlink-checker.html" = '<svg viewBox="0 0 24 24" width="24" height="24"><path fill="#4285F4" d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/></svg>'
    "image-url-checker.html" = '<svg viewBox="0 0 24 24" width="24" height="24"><path fill="#F9AB00" d="M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"/></svg>'
}

# Regex to find all tool cards and replace their SVG
$regex = '(?s)<a class="tool-card" href="[^"]*?([^/"]+\.html)">\s*<div class="tool-icon"[^>]*>.*?</div>'
$matches = [regex]::Matches($html, $regex)

foreach ($m in $matches) {
    $filename = $m.Groups[1].Value
    $fullMatch = $m.Value
    
    if ($uniqueLogos.ContainsKey($filename)) {
        $newIcon = $uniqueLogos[$filename]
        # Replace the <svg> block
        $newFullMatch = $fullMatch -replace '(?s)<svg.*?</svg>', $newIcon
        $html = $html.Replace($fullMatch, $newFullMatch)
    }
}

Set-Content -Path $htmlPath -Value $html -Encoding UTF8
Write-Host "Replaced additional specific tool logos with solid icons."
