import fs from 'fs';

const files = [
    'src/app/(public)/konten/kinetik/kinetik-client.tsx',
    'src/app/(public)/konten/bearr/bearr-client.tsx',
    'src/app/(public)/konten/link-shortener/page.tsx',
];

files.forEach(file => {
    if (!fs.existsSync(file)) return;
    let content = fs.readFileSync(file, 'utf-8');

    // Clean up typos from previous replacements
    content = content.replace(/bg-white\/5 backdrop-blur-md border border-white\/10\/10/g, 'bg-white/5 backdrop-blur-md border border-white/10');
    content = content.replace(/border border-white\/10\/60/g, 'border border-white/10');
    content = content.replace(/border border-white\/10 shadow border border-white\/10/g, 'border border-white/10 shadow');
    content = content.replace(/bg-white\/5 backdrop-blur-md border border-white\/10\/20/g, 'bg-white/5 backdrop-blur-md border border-white/10');
    
    // Convert remaining light backgrounds
    content = content.replace(/bg-gray-50\/80/g, 'bg-white/5');
    content = content.replace(/bg-gray-50\/30/g, 'bg-white/5');
    content = content.replace(/bg-gray-50/g, 'bg-white/5');
    content = content.replace(/bg-gray-100/g, 'bg-white/5');
    content = content.replace(/bg-white /g, 'bg-white/5 ');
    content = content.replace(/bg-white"/g, 'bg-white/5"');
    
    // Text colors
    content = content.replace(/text-gray-700/g, 'text-gray-300');
    content = content.replace(/text-gray-800/g, 'text-gray-200');
    content = content.replace(/text-gray-900/g, 'text-white');
    content = content.replace(/text-slate-700/g, 'text-gray-300');
    content = content.replace(/text-slate-800/g, 'text-gray-200');
    content = content.replace(/text-slate-900/g, 'text-white');
    
    // Border colors
    content = content.replace(/border-gray-200/g, 'border-white/10');
    content = content.replace(/border-gray-300/g, 'border-white/10');
    content = content.replace(/border-slate-200/g, 'border-white/10');

    // Focus rings
    content = content.replace(/focus:ring-gray-100/g, 'focus:ring-white/10');
    
    // Special check for Bearr & Kinetik select inputs or table rows
    content = content.replace(/hover:bg-gray-50/g, 'hover:bg-white/10');
    content = content.replace(/hover:bg-gray-100/g, 'hover:bg-white/10');
    
    fs.writeFileSync(file, content, 'utf-8');
});
