<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>WearWell Shop{% block title %}{% endblock %}</title>
  <link rel="stylesheet" href="{{ url_for('static', filename='css/styles.css') }}" />
  {% block styles %}{% endblock %}
  <link rel="icon" href="{{ url_for('static', filename='favicon.ico') }}" type="image/x-icon">
  <link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}" type="image/x-icon">
</head>

<body>
  <header>
    <nav>
      <a href="{{ url_for('main.home') }}">Home</a>
      <a href="{{ url_for('main.products') }}">Products</a>

      {% if current_user.is_authenticated %}
      <a href="{{ url_for('cart.view_cart') }}">
        Cart {% if current_user.cart and current_user.cart.items|length > 0 %}
        <span class="cart-count">{{ current_user.cart.items|length }}</span>
        {% endif %}
      </a>
      <a href="{{ url_for('user.profile') }}">My Profile</a>

      {% if current_user.is_admin %}
      <a href="{{ url_for('admin.dashboard') }}">Admin Panel</a>
      {% endif %}

      <a href="{{ url_for('auth.logout') }}">Logout</a>
      {% else %}
      <a href="{{ url_for('auth.login') }}">Login</a>
      <a href="{{ url_for('auth.register') }}">Register</a>
      {% endif %}
    </nav>
  </header>

  <main class="container">
    {% with messages = get_flashed_messages(with_categories=true) %} {% if messages %}
    <div class="flash-messages">
      {% for category, message in messages %}
      <div class="flash {{ category }}">{{ message }}</div>
      {% endfor %}
    </div>
    {% endif %} {% endwith %}


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

  <footer>
    <div class="container text-center">
      <p>&copy; 2025 WearWell Shop. All rights reserved.</p>
    </div>
  </footer>

  {% block scripts %}{% endblock %}
</body>
</html>
