"padding: 20px; color: #c62828; font-family: monospace;">
                        <h3>Error:</h3>
                        <pre>${error.message}</pre>
                    </div>
                `);
        iframeDoc.close();

        // Show error in HTML tab
        updateHTMLDisplay('<div>Error loading preview</div>');
      }
    }

    // Update HTML display with actual rendered content
    function updateHTMLDisplay(renderedHTML) {
      const htmlDisplay = document.getElementById('htmlDisplay');

     