{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>{% block title %}{{ page_title|default:project_name }}{% endblock %}</title>
  <meta name="description" content="{% block meta_description %}{{ meta_description|default:project_description }}{% endblock %}">
  <meta name="author" content="Northstar Events">
  {% if project_image_url %}
  <meta property="og:image" content="{{ project_image_url }}">
  <meta property="twitter:image" content="{{ project_image_url }}">
  {% endif %}
  <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;700;800&family=Fraunces:opsz,wght@9..144,600;9..144,700&display=swap" rel="stylesheet">
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
  <link rel="stylesheet" href="{% static 'css/custom.css' %}?v={{ deployment_timestamp }}">
  {% block head %}{% endblock %}
</head>
<body class="{% block body_class %}app-shell{% endblock %}">
  <header class="site-header sticky-top">
    <nav class="navbar navbar-expand-lg navbar-light py-3">
      <div class="container">
        <a class="navbar-brand brand-wordmark" href="{% url 'home' %}">
          <span class="brand-mark">✦</span>
          Northstar Events
        </a>
        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#primaryNav" aria-controls="primaryNav" aria-expanded="false" aria-label="Toggle navigation">
          <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="primaryNav">
          <ul class="navbar-nav ms-auto align-items-lg-center gap-lg-2">
            <li class="nav-item"><a class="nav-link" href="{% url 'home' %}#events">Events</a></li>
            <li class="nav-item"><a class="nav-link" href="{% url 'home' %}#how-it-works">How it works</a></li>
            <li class="nav-item"><a class="nav-link" href="{% url 'organizer_dashboard' %}">Dashboard</a></li>
            {% if request.user.is_authenticated %}
            <li class="nav-item ms-lg-2"><a class="btn btn-ghost" href="/admin/">Admin</a></li>
            <li class="nav-item">
              <form method="post" action="{% url 'logout' %}" class="d-inline">
                {% csrf_token %}
                <button class="btn btn-link nav-link" type="submit">Log out</button>
              </form>
            </li>
            {% else %}
            <li class="nav-item ms-lg-2"><a class="btn btn-ghost" href="{% url 'login' %}">Organizer login</a></li>
            {% endif %}
          </ul>
        </div>
      </div>
    </nav>
  </header>

  {% if messages %}
  <div class="container pt-3">
    {% for message in messages %}
    <div class="alert alert-{{ message.tags|default:'info' }} app-alert" role="alert">
      {{ message }}
    </div>
    {% endfor %}
  </div>
  {% endif %}

  {% block content %}{% endblock %}

  <footer class="site-footer py-5">
    <div class="container d-flex flex-column flex-lg-row justify-content-between gap-3 align-items-lg-center">
      <div>
        <div class="footer-brand">Northstar Events</div>
        <p class="footer-copy mb-0">A polished event listing and registration workspace for one organizer team.</p>
      </div>
      <div class="footer-links d-flex flex-wrap gap-3 align-items-center">
        <a href="{% url 'home' %}">Home</a>
        <a href="{% url 'organizer_dashboard' %}">Organizer dashboard</a>
        {% if request.user.is_authenticated %}
        <a href="/admin/">Admin</a>
        <form method="post" action="{% url 'logout' %}" class="d-inline">
          {% csrf_token %}
          <button type="submit" class="btn btn-link p-0 text-decoration-none align-baseline">Log out</button>
        </form>
        {% else %}
        <a href="{% url 'login' %}">Organizer login</a>
        {% endif %}
      </div>
    </div>
  </footer>

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