<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% block title %}DirectLX{% endblock %} | DirectLX.dev</title>
    <link href="{{ url_for('static', filename='css/styles.css') }}" rel="stylesheet">
    <script src="{{ url_for('static', filename='js/htmx.min.js') }}"></script>
    {% block head %}{% endblock %}
</head>
<body class="min-h-screen bg-gray-50 flex flex-col">
    <!-- Navigation -->
    <nav class="bg-white shadow-sm sticky top-0 z-50">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
            <div class="flex justify-between h-20">
                <div class="flex items-center">
                    <a href="{{ url_for('index') }}" class="flex items-center">
                        <img src="{{ url_for('static', filename='images/directLX_small.png') }}" alt="DirectLX" class="h-14">
                    </a>
                </div>

                <!-- Desktop Navigation -->
                <div class="hidden md:flex items-center space-x-8">
                    <a href="{{ url_for('index') }}" class="nav-link {% if request.endpoint == 'index' %}nav-link-active{% endif %}">Home</a>
                    <a href="{{ url_for('about') }}" class="nav-link {% if request.endpoint == 'about' %}nav-link-active{% endif %}">About</a>
                    <a href="{{ url_for('services') }}" class="nav-link {% if request.endpoint == 'services' %}nav-link-active{% endif %}">Services</a>
                    <a href="{{ url_for('blog_index') }}" class="nav-link {% if 'blog' in request.endpoint %}nav-link-active{% endif %}">Blog</a>
                    <a href="{{ url_for('forum_index') }}" class="nav-link {% if 'forum' in request.endpoint %}nav-link-active{% endif %}">Forum</a>
                    <a href="{{ url_for('contact') }}" class="btn btn-primary">Contact</a>
                </div>

                <!-- Mobile menu button -->
                <div class="md:hidden flex items-center">
                    <button id="mobile-menu-btn" class="text-gray-600 hover:text-primary-600 focus:outline-none">
                        <svg class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
                        </svg>
                    </button>
                </div>
            </div>
        </div>

        <!-- Mobile Navigation -->
        <div id="mobile-menu" class="hidden md:hidden bg-white border-t">
            <div class="px-4 py-3 space-y-3">
                <a href="{{ url_for('index') }}" class="block nav-link">Home</a>
                <a href="{{ url_for('about') }}" class="block nav-link">About</a>
                <a href="{{ url_for('services') }}" class="block nav-link">Services</a>
                <a href="{{ url_for('blog_index') }}" class="block nav-link">Blog</a>
                <a href="{{ url_for('forum_index') }}" class="block nav-link">Forum</a>
                <a href="{{ url_for('contact') }}" class="block btn btn-primary text-center">Contact</a>
            </div>
        </div>
    </nav>

    <!-- Flash Messages -->
    {% with messages = get_flashed_messages(with_categories=true) %}
        {% if messages %}
            <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 mt-4">
                {% for category, message in messages %}
                    <div class="p-4 rounded-lg mb-2 {% if category == 'error' %}bg-red-100 text-red-700{% elif category == 'success' %}bg-green-100 text-green-700{% else %}bg-blue-100 text-blue-700{% endif %}">
                        {{ message }}
                    </div>
                {% endfor %}
            </div>
        {% endif %}
    {% endwith %}

    <!-- Main Content -->
    <main class="flex-grow">
        {% block content %}{% endblock %}
    </main>

    <!-- Footer -->
    <footer class="bg-gray-900 text-gray-300 mt-auto">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
            <div class="grid grid-cols-1 md:grid-cols-4 gap-8">
                <div class="col-span-1 md:col-span-2">
                    <div class="flex items-center mb-4">
                        <img src="{{ url_for('static', filename='images/directLX_small.png') }}" alt="DirectLX" class="h-14">
                    </div>
                    <p class="text-gray-400 max-w-md">
                        Building innovative software solutions that drive business growth.
                        We specialize in custom development, consulting, and technical excellence.
                    </p>
                </div>
                <div>
                    <h3 class="text-white font-semibold mb-4">Quick Links</h3>
                    <ul class="space-y-2">
                        <li><a href="{{ url_for('index') }}" class="hover:text-white transition-colors">Home</a></li>
                        <li><a href="{{ url_for('about') }}" class="hover:text-white transition-colors">About</a></li>
                        <li><a href="{{ url_for('services') }}" class="hover:text-white transition-colors">Services</a></li>
                        <li><a href="{{ url_for('blog_index') }}" class="hover:text-white transition-colors">Blog</a></li>
                    </ul>
                </div>
                <div>
                    <h3 class="text-white font-semibold mb-4">Community</h3>
                    <ul class="space-y-2">
                        <li><a href="{{ url_for('forum_index') }}" class="hover:text-white transition-colors">Forum</a></li>
                        <li><a href="{{ url_for('contact') }}" class="hover:text-white transition-colors">Contact</a></li>
                    </ul>
                </div>
            </div>
            <div class="border-t border-gray-800 mt-8 pt-8 text-center text-gray-500">
                <p>&copy; {{ now.year if now else '2024' }} DirectLX.dev. All rights reserved.</p>
            </div>
        </div>
    </footer>

    <script>
        // Mobile menu toggle
        document.getElementById('mobile-menu-btn').addEventListener('click', function() {
            document.getElementById('mobile-menu').classList.toggle('hidden');
        });
    </script>
    {% block scripts %}{% endblock %}
</body>
</html>
