<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta 
            name="viewport" 
            content="width=device-width, initial-scale=1"
        >

        <link
        rel="stylesheet"
        href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
        integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh"
        crossorigin="anonymous"
      />
      <link
        rel="stylesheet"
        href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"
        crossorigin="anonymous"
      />
        <title>{% block title %}Hometab{% endblock %}</title>
        <link rel = "icon" href = 
            "static/logo/hometag_logo.png" 
             type = "image/x-icon">
    </head>

    <style>
        .navbar-nav-right {
            margin-left: auto;
        }
        a {
            font-size: 18px;
        }
        .navbar-nav > li{
            padding-left:30px;
        }
        body {
            font: 400 15px/1.8 "Lato", sans-serif;
        }
    </style>
    
    <body>
        <nav class="navbar fixed-top navbar-expand-sm bg-dark navbar-dark">
            <a class="navbar-brand" href="/"><img src="static/logo/hometag_logo.png" alt="hometag_logo" id="logo" width="40"/></a></li>
        </a>      
            <ul class="navbar-nav">
            {% if user.is_authenticated %} <!-- shows only if user is logged in -->
            <li class="nav-item">
                <a class="nav-link" href="/">Home</a>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="/create">New Bookmark</a>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="/shared">Public Bookmarks</a>
              </li>
            </ul>
            <ul class="navbar-nav-right">
              <li class="nav-item">
                <a class="navbar-brand" href="/logout"><img src="static/logo/logout_logo.gif" alt="logout_logo" id="logo" width="85"/></a></li>
              </li>
            </ul>
            {% else %}
            {% endif %}
            </ul>
          </nav>
        <!-- For Flash Errors to User -->
        {% with messages = get_flashed_messages(with_categories=true) %}
        {% if messages %}
            {% for category, message in messages %}
                {% if category == 'error' %}
                <div class="alert alert-danger alter-dismissable fade show", role="alert" style="z-index:2;">
                    {{ message }}
                    <button type="button" class="close" data-dismiss="alert">
                        <span aria-hidden="true">&times;</span> <!-- fancy button styling-->
                    </button>
                </div>
                {% else %}
                <div class="alert alert-success alter-dismissable fade show", role="alert" style="z-index:2;">
                    {{ message }}
                    <button type="button" class="close" data-dismiss="alert">
                        <span aria-hidden="true">&times;</span> <!-- fancy button styling-->
                    </button>
                </div>
                {% endif %}
            {% endfor %}
        {% endif %}
        {% endwith %}
        <div class="container">
            {% block content %}
            {% endblock %}
        </div>


        <script
            src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
            integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
            crossorigin="anonymous">
        </script>
        <script
            src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
            integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
            crossorigin="anonymous">
        </script>
        <script
            src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
            integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
            crossorigin="anonymous">
        </script>
    </body>
</html>
