{% load static %}
<!DOCTYPE html>
<html lang="pt-br">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{ title|default:"AI Game Forge" }}</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Outfit:wght@700;800&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="{% static 'css/custom.css' %}?v={% now 'U' %}">
    <style>
        :root {
            --midnight: #0B0F1A;
            --indigo-accent: #6366F1;
            --cyan-accent: #0EA5E9;
            --ghost-white: #F8FAFC;
        }
        body {
            background-color: var(--midnight);
            color: var(--ghost-white);
            font-family: 'Inter', sans-serif;
            min-height: 100vh;
        }
        h1, h2, h3, .brand-font {
            font-family: 'Outfit', sans-serif;
        }
        .navbar {
            background: rgba(11, 15, 26, 0.8);
            backdrop-filter: blur(10px);
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        }
        .btn-primary {
            background: linear-gradient(135deg, var(--indigo-accent), var(--cyan-accent));
            border: none;
            font-weight: 600;
        }
        .glass-card {
            background: rgba(255, 255, 255, 0.05);
            backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 16px;
            padding: 2rem;
        }
    </style>
    {% block extra_css %}{% endblock %}
</head>
<body>
    <nav class="navbar navbar-expand-lg navbar-dark sticky-top">
        <div class="container">
            <a class="navbar-brand brand-font fs-3" href="{% url 'index' %}">
                AI <span class="text-info">GAME</span> FORGE
            </a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav ms-auto align-items-center">
                    {% if request.session.is_admin %}
                        <li class="nav-item"><a class="nav-link" href="{% url 'admin_dashboard' %}">Painel Admin</a></li>
                        <li class="nav-item"><a class="nav-link btn btn-outline-danger btn-sm ms-lg-3" href="{% url 'logout' %}">Sair Admin</a></li>
                    {% elif request.session.user_code %}
                        <li class="nav-item"><a class="nav-link" href="{% url 'catalog' %}">Catálogo</a></li>
                        <li class="nav-item"><span class="nav-link text-info">Cod: {{ request.session.user_code }}</span></li>
                        <li class="nav-item"><a class="nav-link btn btn-outline-light btn-sm ms-lg-3" href="{% url 'logout' %}">Trocar Código</a></li>
                    {% else %}
                        <li class="nav-item"><a class="nav-link" href="{% url 'admin_login' %}">Administrador</a></li>
                    {% endif %}
                </ul>
            </div>
        </div>
    </nav>

    <main class="py-5">
        <div class="container">
            {% if messages %}
                {% for message in messages %}
                    <div class="alert alert-{{ message.tags }} alert-dismissible fade show bg-dark text-white border-secondary">
                        {{ message }}
                        <button type="button" class="btn-close btn-close-white" data-bs-dismiss="alert"></button>
                    </div>
                {% endfor %}
            {% endif %}
            
            {% block content %}{% endblock %}
        </div>
    </main>

    <footer class="py-4 text-center border-top border-secondary mt-auto">
        <p class="text-secondary small">&copy; 2026 AI Game Forge. Todos os direitos reservados.</p>
    </footer>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
    {% block extra_js %}{% endblock %}
</body>
</html>
