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)) {
        console.log(`File ${file} tidak ditemukan.`);
        return;
    }

    let content = fs.readFileSync(file, 'utf-8');

    // Replace outer wrapper
    content = content.replace(/bg-\[#F8FAFC\]/g, 'bg-[#07090f]');
    
    // Cards
    content = content.replace(/bg-white/g, 'bg-white/5 backdrop-blur-md border border-white/10');
    content = content.replace(/shadow-sm/g, 'shadow-lg');
    content = content.replace(/shadow-md/g, 'shadow-[0_8px_32px_0_rgba(0,0,0,0.3)]');
    
    // Text colors
    content = content.replace(/text-slate-800/g, 'text-white');
    content = content.replace(/text-slate-900/g, 'text-white');
    content = content.replace(/text-gray-800/g, 'text-white');
    content = content.replace(/text-gray-900/g, 'text-white');
    content = content.replace(/text-slate-600/g, 'text-gray-300');
    content = content.replace(/text-slate-500/g, 'text-gray-400');
    content = content.replace(/text-gray-600/g, 'text-gray-300');
    content = content.replace(/text-gray-500/g, 'text-gray-400');
    content = content.replace(/text-\[#0B1F3A\]/g, 'text-white');
    
    // Hero Section background
    content = content.replace(/bg-\[#0B1F3A\]/g, 'bg-transparent');
    
    // Inputs & selects
    content = content.replace(/border-slate-200/g, 'border-white/20');
    content = content.replace(/border-slate-300/g, 'border-white/20');
    content = content.replace(/focus:ring-slate-900/g, 'focus:ring-white/50');
    content = content.replace(/bg-slate-100/g, 'bg-white/10');
    content = content.replace(/bg-slate-50/g, 'bg-white/5');
    content = content.replace(/hover:bg-slate-50/g, 'hover:bg-white/10');
    content = content.replace(/hover:bg-slate-100/g, 'hover:bg-white/20');
    content = content.replace(/divide-slate-200/g, 'divide-white/10');
    
    // Remove specific light mode hover and border
    content = content.replace(/border-gray-200/g, 'border-white/10');
    content = content.replace(/divide-gray-100/g, 'divide-white/10');
    content = content.replace(/divide-gray-200/g, 'divide-white/10');

    fs.writeFileSync(file, content, 'utf-8');
    console.log(`Berhasil mengubah ${file}`);
});
