#seo-analyzer-tool h2 { margin-top: 0; color: #1d2327; font-size: 22px; margin-bottom: 15px; }
#seo-analyzer-tool textarea { width: 100%; border: 1px solid #ccc; border-radius: 4px; padding: 12px; font-size: 14px; min-height: 120px; box-sizing: border-box; }
#seo-analyzer-tool .input-group { margin-bottom: 15px; }
#seo-analyzer-tool label { display: block; margin-bottom: 5px; font-weight: 600; font-size: 14px; }
#seo-analyzer-tool input[type="text"] { width: 100%; border: 1px solid #ccc; border-radius: 4px; padding: 10px; box-sizing: border-box; }
#seo-analyzer-tool button { background: #2271b1; color: #fff; border: none; padding: 12px 20px; border-radius: 4px; cursor: pointer; font-weight: 600; transition: background 0.2s; width: 100%; font-size: 16px; }
#seo-analyzer-tool button:hover { background: #135e96; }
#seo-analyzer-tool .results { margin-top: 20px; background: #fff; border-radius: 4px; padding: 15px; border: 1px solid #e2e8f0; display: none; }
#seo-analyzer-tool .metric { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #eee; }
#seo-analyzer-tool .metric:last-child { border-bottom: none; }
#seo-analyzer-tool .score-good { color: #2271b1; font-weight: bold; }
#seo-analyzer-tool .score-bad { color: #d63638; font-weight: bold; }
function analyzeSEOContent() {
var content = document.getElementById('seo-content-input').value;
var keyword = document.getElementById('seo-target-keyword').value.toLowerCase();
var resultsBox = document.getElementById('seo-results');
if (!content) {
alert('Please enter some content');
return;
}
resultsBox.style.display = 'block';
var words = content.trim().split(/\s+/);
var wordCount = words.length;
document.getElementById('res-word-count').innerText = wordCount;
var density = 0;
if (keyword) {
var regex = new RegExp('\\b' + keyword + '\\b', 'gi');
var matches = content.match(regex);
var count = matches ? matches.length : 0;
density = (count / wordCount) * 100;
document.getElementById('res-density').innerText = density.toFixed(2) + '%';
} else {
document.getElementById('res-density').innerText = 'N/A';
}
var advice = ";
var adviceEl = document.getElementById('res-advice');
if (wordCount 3) {
advice = 'Keyword stuffing detected. Reduce keyword usage.';
adviceEl.className = 'score-bad';
} else if (density 6) {
readability.innerText = 'Complex (Academic)';
readability.className = 'score-bad';
} else {
readability.innerText = 'Good (Conversational)';
readability.className = 'score-good';
}
}
SEO Content Analyzer
Word Count:
0
Keyword Density:
0%
Readability Score:
Neutral
SEO Recommendation:
N/A