.code-wrapper {
font-family: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
background: #1e293b;
border-radius: 12px;
overflow: hidden;
max-width: 500px;
box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}
.code-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px 20px;
background: #0f172a;
border-bottom: 1px solid #334155;
}
.lang-label {
color: #94a3b8;
font-size: 0.85rem;
font-weight: 600;
}
.copy-code-btn {
background: #334155;
border: none;
color: #fff;
padding: 6px 12px;
border-radius: 6px;
font-size: 0.8rem;
cursor: pointer;
transition: background 0.2s;
}
.copy-code-btn:hover {
background: #475569;
}
pre {
margin: 0;
padding: 20px;
overflow-x: auto;
}
code {
font-family: monospace;
color: #e2e8f0;
font-size: 0.9rem;
line-height: 1.5;
}
const copyCodeBtn = document.querySelector(".copy-code-btn");
const codeSource = document.getElementById("codeSource");
copyCodeBtn.addEventListener("click", () => {
navigator.clipboard.writeText(codeSource.innerText).then(() => {
const originalText = copyCodeBtn.innerText;
copyCodeBtn.innerText = "Copied!";
setTimeout(() => {
copyCodeBtn.innerText = originalText;
}, 2000);
});
});