{% 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 %}{{ project_name|default:"RelayDesk" }}{% endblock %}</title>
  <meta name="description" content="{% block meta_description %}{{ page_description|default:project_description|default:'Lightweight support ticketing for small teams.' }}{% endblock %}">
  {% 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=Manrope:wght@600;700;800&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>
  <a class="skip-link" href="#main-content">Skip to content</a>
  <nav class="navbar navbar-expand-lg navbar-light navbar-glass sticky-top" aria-label="Main navigation">
    <div class="container py-2">
      <a class="navbar-brand d-flex align-items-center gap-2" href="{% url 'home' %}">
        <span class="brand-mark" aria-hidden="true">RD</span>
        <span class="brand-copy">RelayDesk</span>
      </a>
      <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#mainNav" aria-controls="mainNav" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
      </button>
      <div class="collapse navbar-collapse" id="mainNav">
        <ul class="navbar-nav ms-auto align-items-lg-center gap-lg-2">
          <li class="nav-item"><a class="nav-link" href="{% url 'ticket_list' %}">Tickets</a></li>
          <li class="nav-item"><a class="nav-link" href="/admin/">Admin</a></li>
          <li class="nav-item"><a class="btn btn-primary-soft" href="{% url 'ticket_create' %}">Submit ticket</a></li>
        </ul>
      </div>
    </div>
  </nav>

  {% if messages %}
  <div class="container message-stack" aria-live="polite" aria-atomic="true">
    {% for message in messages %}
    <div class="alert alert-{{ message.tags|default:'info' }} shadow-sm mb-2" role="alert">{{ message }}</div>
    {% endfor %}
  </div>
  {% endif %}

  <main id="main-content">
    {% block content %}{% endblock %}
  </main>

  <footer class="site-footer py-4 mt-5">
    <div class="container d-flex flex-column flex-md-row align-items-center justify-content-between gap-3">
      <div>
        <strong>RelayDesk</strong> keeps support moving from request to resolution.
      </div>
      <div class="footer-links d-flex gap-3">
        <a href="{% url 'ticket_list' %}">Browse tickets</a>
        <a href="{% url 'ticket_create' %}">New ticket</a>
        <a href="/admin/">Admin</a>
      </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>
