{% load static %}
<!DOCTYPE html>
<html lang="es">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>{% block title %}{{ meta_title|default:"Restaurante POS" }}{% endblock %}</title>
  <meta name="description" content="{% block meta_description %}{{ meta_description|default:project_description|default:'Gestión visual de mesas, comandas y cocina para restaurantes.' }}{% 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 class="pos-app">
  <div class="page-shell">
    <header class="site-header sticky-top">
      <nav class="navbar navbar-expand-lg">
        <div class="container-xxl align-items-center">
          <a class="navbar-brand" href="{% url 'home' %}">
            <span class="brand-mark">RP</span>
            <span>
              <strong>Restaurante POS</strong>
              <small>Operación en tiempo real</small>
            </span>
          </a>
          <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#mainNav" aria-controls="mainNav" aria-expanded="false" aria-label="Abrir navegación">
            <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">
              {% if request.user.is_authenticated %}
              <li class="nav-item"><a class="nav-link" href="{% url 'home' %}">Dashboard</a></li>
              <li class="nav-item"><a class="nav-link" href="{% url 'kitchen_board' %}">KDS Cocina</a></li>
              <li class="nav-item"><a class="nav-link" href="/admin/">Admin</a></li>
              <li class="nav-item">
                <span class="nav-link disabled">{{ request.user.username }}{% if resolved_user_role %} · {{ resolved_user_role }}{% endif %}</span>
              </li>
              <li class="nav-item">
                <form method="post" action="{% url 'logout' %}">
                  {% csrf_token %}
                  <button type="submit" class="btn btn-outline-dark rounded-pill px-3">Salir</button>
                </form>
              </li>
              {% else %}
              <li class="nav-item"><a class="nav-link" href="{% url 'login' %}">Iniciar sesión</a></li>
              {% endif %}
            </ul>
          </div>
        </div>
      </nav>
    </header>

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

    {% block content %}{% endblock %}
  </div>

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