<!DOCTYPE html>
<html lang="de">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% block title %}Fragify{% endblock %}</title>
    <link href="/static/css/bootstrap.min.css" rel="stylesheet">
    <link href="/static/css/select2.min.css" rel="stylesheet">
    <link href="/static/css/select2-bootstrap-5-theme.min.css" rel="stylesheet">

    <meta name="description" content="{{ meta_description | default('Erstelle vorausgefüllte FragDenStaat.de-Anfragelinks und teile sie mit Freund:innen. Suche Behörden, füge Betreff und Text hinzu und generiere einen teilbaren Link.') }}">
    <link rel="canonical" href="{{ canonical_url | default('/') }}">
    <link rel="alternate" hreflang="de" href="{{ canonical_url | default('/') }}">

    <meta property="og:type" content="website">
    <meta property="og:site_name" content="Fragify">
    <meta property="og:title" content="{{ meta_title | default('Fragify') }}">
    <meta property="og:description" content="{{ meta_description | default('Erstelle vorausgefüllte FragDenStaat.de-Anfragelinks und teile sie mit Freund:innen.') }}">
    <meta property="og:locale" content="de_DE">
    <meta property="og:url" content="{{ canonical_url | default('/') }}">

    <meta name="twitter:card" content="summary_large_image">
    <meta name="twitter:title" content="{{ meta_title | default('Fragify') }}">
    <meta name="twitter:description" content="{{ meta_description | default('Erstelle vorausgefüllte FragDenStaat.de-Anfragelinks und teile sie mit Freund:innen.') }}">

    {% if noindex %}<meta name="robots" content="noindex,follow">{% endif %}
    <meta name="theme-color" content="#667eea">
    <link rel="icon" href="/static/favicon.svg" type="image/svg+xml">
    <link rel="alternate icon" href="/static/favicon.ico">

    {% block meta_extra %}{% endblock %}
    <style>
        body {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }
        .main-container {
            background: white;
            border-radius: 20px;
            box-shadow: 0 20px 40px rgba(0,0,0,0.1);
            padding: 3rem;
            margin: 2rem auto;
            max-width: 800px;
        }
        .title {
            color: #2c3e50;
            font-weight: 700;
            margin-bottom: 1rem;
        }
        .description {
            color: #7f8c8d;
            font-size: 1.1rem;
            margin-bottom: 2.5rem;
            line-height: 1.6;
        }
        .form-control, .form-select {
            border-radius: 10px;
            border: 2px solid #e9ecef;
            padding: 0.75rem 1rem;
            transition: all 0.3s ease;
        }
        .form-control:focus, .form-select:focus {
            border-color: #667eea;
            box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
        }
        .btn-primary {
            background: linear-gradient(45deg, #667eea, #764ba2);
            border: none;
            border-radius: 15px;
            padding: 1rem 2rem;
            font-size: 1.1rem;
            font-weight: 600;
            transition: all 0.3s ease;
        }
        .btn-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
        }
        .result-link {
            background: #f8f9fa;
            border: 2px solid #e9ecef;
            border-radius: 10px;
            padding: 1rem;
            margin-top: 1rem;
            word-break: break-all;
        }
        /* Ensure Select2 scales properly */
        .select2-container {
            width: 100% !important;
        }
        .select2-container .select2-selection--single {
            height: auto;
            min-height: 2.75rem;
        }
        .select2-container .select2-selection__rendered {
            white-space: normal;
            line-height: 1.4 !important;
        }
        .select2-container .select2-selection__arrow {
            height: 100% !important;
        }
        /* Mobile adjustments */
        @media (max-width: 576px) {
            .main-container {
                padding: 1.25rem;
                margin: 1rem auto 4rem auto;
            }
            .title {
                font-size: 2rem;
            }
            .description {
                font-size: 1rem;
            }
        }
        .loading {
            display: none;
        }
        .footer {
            background: transparent;
            margin-top: 3rem;
        }
        .footer-links a {
            font-size: 0.9rem;
            transition: color 0.3s ease;
        }
        .footer-links a:hover {
            color: #667eea !important;
        }
        .footer-text {
            font-size: 0.8rem;
        }
        .footer-text a:hover {
            color: #667eea !important;
        }
        .footer-text a {
            text-decoration: underline;
        }
        .footer-text {
            font-size: 0.8rem;
            margin-bottom: 2rem;
        }
        .legal-content {
            text-align: left;
            line-height: 1.6;
        }
        .legal-content h2 {
            color: #2c3e50;
            margin-top: 2rem;
            margin-bottom: 1rem;
        }
        .legal-content p {
            margin-bottom: 1rem;
        }
        .legal-content ul {
            margin-bottom: 1rem;
        }
        .main-container {
            margin-bottom: 4rem;
        }
    </style>
    {% block extra_css %}{% endblock %}
</head>
<body>
    <div class="container">
        <div class="main-container">
            {% block content %}{% endblock %}
        </div>
        
        <!-- Footer -->
        <footer class="footer mt-5 pt-4">
            <div class="container">
                <div class="row">
                    <div class="col-12 text-center">
                        <div class="footer-links mb-2">
                            <a href="/impressum" class="text-muted text-decoration-none me-3">Impressum</a>
                            <a href="/datenschutz" class="text-muted text-decoration-none me-3">Datenschutz</a>
                            <a href="https://git.project-insanity.org/onny/fragify" class="text-muted text-decoration-none" target="_blank">Source</a>
                        </div>
                        <div class="footer-text">
                            <small class="text-muted">
                                Projekt von <a href="https://project-insanity.org" class="text-muted text-decoration-none" target="_blank">Project-Insanity.org</a>, 
                                follow us on <a href="https://social.project-insanity.org/@pi_crew" class="text-muted text-decoration-none" target="_blank">Mastodon</a> :)
                            </small>
                        </div>
                    </div>
                </div>
            </div>
        </footer>
    </div>

    <script src="/static/js/bootstrap.bundle.min.js"></script>
    <script src="/static/js/jquery.min.js"></script>
    <script src="/static/js/select2.min.js"></script>
    
    {% block extra_js %}{% endblock %}
</body>
</html> 