.seo-input-group { margin-bottom: 20px; }
.seo-label { display: block; font-weight: 600; margin-bottom: 8px; color: #1a202c; font-size: 14px; }
.seo-input { width: 100%; padding: 12px; border: 1px solid #cbd5e0; border-radius: 6px; font-size: 16px; box-sizing: border-box; transition: border-color 0.2s; }
.seo-input:focus { border-color: #4299e1; outline: none; }
.seo-counter { font-size: 12px; margin-top: 5px; text-align: right; font-weight: 500; }
.seo-preview { background: #f7fafc; padding: 15px; border-radius: 8px; margin-top: 20px; border: 1px dashed #cbd5e0; }
.seo-preview-title { color: #1a0dab; font-size: 20px; text-decoration: none; display: block; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seo-preview-url { color: #006621; font-size: 14px; margin-bottom: 3px; }
.seo-preview-desc { color: #4d5156; font-size: 14px; line-height: 1.58; }
.seo-status-good { color: #38a169; }
.seo-status-warn { color: #dd6b20; }
.seo-status-bad { color: #e53e3e; }
.seo-btn { background: #4a5568; color: white; border: none; padding: 10px 15px; border-radius: 6px; cursor: pointer; font-size: 14px; margin-top: 10px; }
.seo-btn:hover { background: #2d3748; }
function updateSeoPreview() {
var titleInput = document.getElementById('seo-title-input');
var descInput = document.getElementById('seo-desc-input');
var titlePreview = document.getElementById('preview-title');
var descPreview = document.getElementById('preview-desc');
var titleCounter = document.getElementById('title-count');
var descCounter = document.getElementById('desc-count');
var titleVal = titleInput.value;
var descVal = descInput.value;
// Update Text
titlePreview.innerText = titleVal || "Your Page Title Starts Here";
descPreview.innerText = descVal || "Your meta description will appear here. It's a good practice to include your primary keywords naturally to improve CTR.";
// Title Logic
var tLen = titleVal.length;
titleCounter.innerText = tLen + " / 60 characters";
if (tLen > 40 && tLen 60) {
titleCounter.className = "seo-counter seo-status-bad";
} else {
titleCounter.className = "seo-counter seo-status-warn";
}
// Desc Logic
var dLen = descVal.length;
descCounter.innerText = dLen + " / 160 characters";
if (dLen > 120 && dLen 160) {
descCounter.className = "seo-counter seo-status-bad";
} else {
descCounter.className = "seo-counter seo-status-warn";
}
}
function resetSeoFields() {
document.getElementById('seo-title-input').value = "";
document.getElementById('seo-desc-input').value = "";
updateSeoPreview();
}
Google Snippet Optimizer
0 / 60 characters
0 / 160 characters
Search Result Preview
Your Page Title Starts Here
https://example.com › your-page-url
Your meta description will appear here. It's a good practice to include your primary keywords naturally to improve CTR.