Product Status Box `;document.getElementById('codeOutput').value = code;
}// Función para convertir color hex a rgba
function hexToRgba(hex, alpha = 1) {
const r = parseInt(hex.slice(1, 3), 16);
const g = parseInt(hex.slice(3, 5), 16);
const b = parseInt(hex.slice(5, 7), 16);
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
}// Función para copiar al portapapeles
function copyToClipboard() {
const textarea = document.getElementById('codeOutput');
textarea.select();
document.execCommand('copy');
const copyButton = document.querySelector('.copy-btn');
copyButton.textContent = '¡Código Copiado!';
setTimeout(() => {
copyButton.innerHTML = '
📋Copiar Código';
}, 2000);
}// Agregar listeners para actualización en tiempo real
document.addEventListener('DOMContentLoaded', () => {
// Mostrar/ocultar controles de sombra
const enableShadow = document.getElementById('enableShadow');
const shadowControls = document.querySelector('.shadow-controls');
enableShadow.addEventListener('change', () => {
shadowControls.style.display = enableShadow.checked ? 'block' : 'none';
updatePreview();
});// Actualizar en tiempo real
document.querySelectorAll('input, select').forEach(input => {
input.addEventListener('input', updatePreview);
input.addEventListener('change', updatePreview);
});
// Actualizar la vista previa inicialmente
updatePreview();
});