{% load static %}
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>Polls</title>
        <!-- Bootstrap CSS -->
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
        <link rel="stylesheet" type="text/css" href="{% static 'style.css' %}" />
    </head>
    <body>
                <nav class="navbar navbar-default" role="navigation">
            <div class="container">
                <!-- Brand and toggle get grouped for better mobile display -->
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand" href="#">Poll Application</a>
                </div>

                <!-- Collect the nav links, forms, and other content for toggling -->
                <div class="collapse navbar-collapse navbar-ex1-collapse">
                    <ul class="nav navbar-nav">
                        <li><a href="#">Home</a></li>
                        <li><a href="#">Create</a></li>
                         {% if user.is_authenticated %}
                        {% if user.is_staff %}
                        <li><a href="{% url 'polls:poll_new' %}" class="top-menu">New</a></li>
                        {% endif %}
                        <li><a href="{% url 'polls:logout' %}" class="top-menu">Logout</a></li>
                        <a href="#" class="top-menu-welcome">
                        <span style="color: white">Welcome, {{user.username}}</span></a>
                        {% else %}
                        <li><a href="{% url 'polls:register' %}" class="top-menu">Register</a></li>
                        <li><a href="{% url 'polls:login' %}" class="top-menu">Login</a></li>
                        {% endif %}
                    </ul>
                </div><!-- /.navbar-collapse -->
            </div>
        </nav>
        <!-- Messages -->
        <div class="container">
            {% if messages %}
                <div class="alert alert-info alert-dismissible fade show" role="alert">
                    {% for message in messages %}
                        {{ message }}
                    {% endfor %}
                    <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                </div>
            {% endif %}
        </div>

        <div class="content container mt-4">
            <div class="row">
                <div class="col-md-8">
                    {% block content %}
                    {% endblock %}
                </div>
            </div>
        </div>

        <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
    </body>
</html>