<!DOCTYPE html>
<html lang="en" x-data="{ open:false }">
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <title>Web Admin — {% block title %}{% endblock %}</title>
  {% load tailwind_tags public_urls  %}
  {% tailwind_css %}
  <script defer src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js"></script>
</head>
<body class="bg-gray-50 text-gray-900">
  <div class="min-h-screen">
    <nav class="bg-white border-b border-gray-200">
      <div class="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
        <div class="flex h-16 items-center justify-between">
          <div class="flex items-center gap-8">
            <a href="/webadmin/" class="text-lg font-semibold">Web Admin</a>
            <div class="hidden md:flex items-center gap-4">
              <a class="hover:text-black/70" href="{% url 'admin_frontend:dashboard' %}">Dashboard</a>
              <a class="hover:text-black/70" href="{% url 'admin_frontend:profiles_list' %}">Profiles</a>
              <a class="hover:text-black/70" href="{% url 'admin_frontend:opportunities_list' %}">Opportunities</a>
              <a class="hover:text-black/70" href="{% url 'admin_frontend:intro_requests_list' %}">Intro Requests</a>
            </div>
          </div>
          <div class="flex items-center gap-3">
            {% if request.user.is_authenticated %}
              <span class="text-sm text-gray-600">{{ request.user.username }}</span>
              <form method="post" action="{% url 'admin_frontend:logout' %}">
                {% csrf_token %}
                <button class="text-sm text-red-600 hover:text-red-700">Logout</button>
              </form>
            {% else %}
              <a class="text-sm text-blue-600 hover:text-blue-700" href="{% url 'admin_frontend:login' %}">Login</a>
            {% endif %}
          </div>
        </div>
      </div>
    </nav>

    <main class="mx-auto max-w-7xl p-4 sm:p-6 lg:p-8">
      {% if messages %}
        <div class="space-y-2 mb-4">
          {% for message in messages %}
            <div class="px-4 py-3 rounded border {{ message.tags|default:'' }}"
                 :class="{'bg-green-50 border-green-300 text-green-800': '{{ message.tags }}'.includes('success'), 'bg-red-50 border-red-300 text-red-800': '{{ message.tags }}'.includes('error'), 'bg-blue-50 border-blue-300 text-blue-800': '{{ message.tags }}'.includes('info')}">
              {{ message }}
            </div>
          {% endfor %}
        </div>
      {% endif %}

      {% block content %}{% endblock %}
    </main>
    <footer class="bg-white border-t border-gray-200">
      <div class="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
        <div class="flex h-16 items-center justify-between">
          <p class="text-sm text-gray-600">&copy; {% now "Y" %} Lux Backend. All rights reserved.</p>
        </div>
      </div>
    </footer>
  </div>
  {% block scripts %}{% endblock %}
  <!-- Flowbite JS (components and interactivity) -->
  <script src="https://cdnjs.cloudflare.com/ajax/libs/flowbite/2.5.1/flowbite.min.js"></script>
  <style>
    /* Ensure system UI controls (date/time pickers) render with dark icons on light background */
    input[type="date"], input[type="time"], input[type="datetime-local"] { color-scheme: light; }
    .success { background-color: #ecfdf5; border-color:#34d399; color:#065f46; }
    .error { background-color: #fef2f2; border-color:#fca5a5; color:#7f1d1d; }
    .info { background-color: #eff6ff; border-color:#93c5fd; color:#1e3a8a; }

    #div_id_is_verified .mb-3 { margin-bottom: 0px !important; }
  </style>
</body>
</html>
