const fs = require('fs');

if (fs.existsSync('style.css')) {
    let css = fs.readFileSync('style.css', 'utf8');
    
    // Replace the blinding neon cyan-green with a readable emerald/forest green
    css = css.replace(/--success: #00f2c3;/g, '--success: #008a45;');
    
    fs.writeFileSync('style.css', css, 'utf8');
    console.log('Fixed --success color in style.css');
}

if (fs.existsSync('index.html')) {
    let html = fs.readFileSync('index.html', 'utf8');
    
    // Fix rgba values for the old success color
    html = html.replace(/rgba\(0,\s*242,\s*195,/g, 'rgba(0, 138, 69,');
    
    fs.writeFileSync('index.html', html, 'utf8');
    console.log('Fixed btn-success rgba in index.html');
}

// Cache buster
if (fs.existsSync('index.html')) {
    let html = fs.readFileSync('index.html', 'utf8');
    html = html.replace(/v=\d+/g, 'v=' + Date.now());
    fs.writeFileSync('index.html', html, 'utf8');
}
