<body>
    {% from 'macros.html' import render_datetime %}
    <!-- Begin Bootstrap Navbar -->
    <nav class="navbar navbar-expand-lg navbar-light bg-light">
        <div class="container-fluid">
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
                aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
            <a class="navbar-brand" href="{{ url_for('about') }}">FABLAB</a>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav">
                    {% if current_user and current_user.is_authenticated %}
                        <li class="nav-item">
                            <a class="nav-link" href="{{ url_for('view_users') }}">{{ _("Users") }}</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="{{ url_for('view_machines') }}">{{ _("Machines") }}</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="{{ url_for('view_uses') }}">{{ _("History") }}</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="{{ url_for('view_authorizations') }}">{{ _("Authorizations") }}</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="{{ url_for('maintenances') }}">{{ _("Maintenance") }}</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="{{ url_for('view_interventions') }}">{{ _("Interventions") }}</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="{{ url_for('roles') }}">{{ _("Roles") }}</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="{{ url_for('machinetypes') }}">{{ _("Machine types") }}</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="{{ url_for('system') }}">{{ _("System") }}</a>
                        </li>                    
                        <li class="nav-item">
                            <a class="nav-link" href="{{ url_for('logout') }}">{{ _("Logout") }}</a>
                        </li>
                    {% else %}
                        <li class="nav-item">
                            <a class="nav-link" href="{{ url_for('login') }}">{{ _("Login") }}</a>
                        </li>
                    {% endif %}
                </ul>
            </div>
            <a href="{{ url_for('set_language', lang='en') }}">🇬🇧</a>&nbsp;
            <a href="{{ url_for('set_language', lang='it') }}">🇮🇹</a>
        </div>
    </nav>
    <style>
        @media (max-width: 992px) {
            .navbar-nav .nav-link {
                padding: .5rem 1rem;  /* Increase padding to make links easier to tap */
                font-size: 2rem;  /* Increase font size to make links easier to read */
                font-weight: bold;  /* Increase font weight to make links easier to read */
            }
    
            #navbarNav {
                max-height: calc(100vh - 56px);  /* Subtract the height of the navbar */
                overflow-y: auto;  /* Add scroll if content is larger than screen */
            }

            body {
                padding-left: 0px;
                padding-right: 0px;
            }
        }
        .container-fluid {
            padding: 1px;
        }
    </style>
    <!-- End Bootstrap Navbar -->
    <hr>
    {% for mesg in get_flashed_messages() %}
    <div class="alert alert-warning" role="alert">{{mesg}}</div>
    {% endfor %}
    <div class="container-fluid content ">
    {% block content %} 
    {% endblock %}
    </div>
    <!-- Include Bootstrap JS -->
    <script src="{{ url_for('static', filename='js/bootstrap.bundle.min.js') }}"></script>
</body>

</html>