<!DOCTYPE html>
<html lang="de" data-theme="valentine">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% block title %}SolrHelper{% endblock %}</title>
    
    <!-- CSS -->
    <link href="https://cdn.jsdelivr.net/npm/daisyui@5" rel="stylesheet" type="text/css" />
    <script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
    
    <!-- JavaScript Libraries -->
    <script src="https://unpkg.com/htmx.org@1.9.10"></script>
    <script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
    
    {% block extra_head %}{% endblock %}
    
    <!-- HTMX Configuration -->
    <script>
        // HTMX Global Configuration
        htmx.config.globalViewTransitions = true;
        htmx.config.timeout = 10000; // 10 seconds timeout
        
        // Global HTMX Event Handlers
        document.addEventListener('htmx:beforeRequest', function(event) {
            // Zeige Loading-Indikator
            const indicator = event.target.querySelector('.htmx-indicator');
            if (indicator) indicator.style.display = 'inline-block';
        });
        
        document.addEventListener('htmx:afterRequest', function(event) {
            // Verstecke Loading-Indikator
            const indicator = event.target.querySelector('.htmx-indicator');
            if (indicator) indicator.style.display = 'none';
            
            // Zeige Success-Toast bei erfolgreichen Requests
            if (event.detail.successful && event.detail.xhr.status === 200) {
                const successMessage = event.detail.xhr.getResponseHeader('HX-Success-Message');
                if (successMessage && window.showToast) {
                    window.showToast(successMessage, 'success');
                }
            }
        });
    </script>
</head>
<body class="bg-base-200">
    {% include '_header.html' %}
    {% include '_toast.html' %}
    
    <main role="main">
        {% block content %}{% endblock %}
    </main>
    
    {% block extra_scripts %}{% endblock %}
</body>
</html>
