#seo-tool-wrapper {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
background: #f9f9f9;
border: 1px solid #ddd;
border-radius: 8px;
padding: 20px;
max-width: 100%;
margin: 20px 0;
color: #333;
}
#seo-tool-wrapper h3 {
margin-top: 0;
color: #2271b1;
font-size: 1.25rem;
}
.seo-input-group {
margin-bottom: 15px;
}
.seo-input-group label {
display: block;
font-weight: 600;
margin-bottom: 5px;
font-size: 14px;
}
.seo-input-group input,
.seo-input-group textarea {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
font-size: 14px;
}
.seo-counter-bar {
height: 4px;
background: #eee;
margin-top: 5px;
border-radius: 2px;
overflow: hidden;
}
.seo-progress {
height: 100%;
width: 0%;
transition: width 0.3s, background 0.3s;
}
.seo-stats {
display: flex;
justify-content: space-between;
font-size: 12px;
margin-top: 5px;
}
.status-good { background: #4caf50; }
.status-warn { background: #ff9800; }
.status-bad { background: #f44336; }
.seo-btn-clear {
background: #fff;
border: 1px solid #ccc;
padding: 5px 10px;
cursor: pointer;
font-size: 12px;
border-radius: 4px;
margin-top: 10px;
}
.seo-btn-clear:hover { background: #f1f1f1; }
function updateSEOCounters() {
var titleStr = document.getElementById('seo-title-input').value;
var descStr = document.getElementById('seo-desc-input').value;
var titleLen = titleStr.length;
var descLen = descStr.length;
// Update Title UI
var titleProgress = document.getElementById('title-progress');
var titleMsg = document.getElementById('title-msg');
document.getElementById('title-count').innerText = titleLen + ' characters';
var titlePercent = (titleLen / 60) * 100;
if(titlePercent > 100) titlePercent = 100;
titleProgress.style.width = titlePercent + '%';
if(titleLen === 0) {
titleMsg.innerText = 'Empty';
titleProgress.className = 'seo-progress';
} else if(titleLen < 40) {
titleMsg.innerText = 'Too short';
titleProgress.className = 'seo-progress status-warn';
} else if(titleLen 100) descPercent = 100;
descProgress.style.width = descPercent + '%';
if(descLen === 0) {
descMsg.innerText = 'Empty';
descProgress.className = 'seo-progress';
} else if(descLen < 120) {
descMsg.innerText = 'Too short';
descProgress.className = 'seo-progress status-warn';
} else if(descLen <= 160) {
descMsg.innerText = 'Perfect';
descProgress.className = 'seo-progress status-good';
} else {
descMsg.innerText = 'Too long';
descProgress.className = 'seo-progress status-bad';
}
}
function clearSEOTool() {
document.getElementById('seo-title-input').value = '';
document.getElementById('seo-desc-input').value = '';
updateSEOCounters();
}