{% extends 'admin_frontend/base.html' %}
{% block title %}{% if creating %}New Profile{% else %}Edit Profile{% endif %}{% endblock %}
{% block content %}
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
  <div class="lg:col-span-2">
    <h1 class="text-2xl font-semibold mb-4">{% if creating %}New Profile{% else %}Edit Profile{% endif %}</h1>
    {% if not creating %}
      <div class="bg-white rounded shadow p-6 mb-4">
        <label class="text-sm font-medium">User</label>
        <input value="{{ profile.user.username }}" disabled class="mt-1 block w-full rounded-md border-gray-200 bg-gray-100" />
      </div>
    {% endif %}
    {% include 'admin_frontend/_form.html' with form=form submit_label='Save' cancel_url=cancel_url %}
  </div>
  {% if not creating %}
  <aside class="space-y-6">
    <div class="bg-white rounded shadow p-4">
      <h2 class="text-lg font-semibold mb-3">Suggested Matches</h2>
      <ul class="divide-y divide-gray-200">
        {% for item in user_matches %}
          <li class="py-2 flex items-center justify-between">
            <div>
              <div class="font-medium">{{ item.profile.user.username }}</div>
              <div class="text-sm text-gray-500">Score: {{ item.score|floatformat:3 }}</div>
            </div>
            <a class="btn-outline" href="{% url 'admin_frontend:profile_edit' item.profile.pk %}">View</a>
          </li>
        {% empty %}
          <li class="py-2 text-gray-500">No matches yet.</li>
        {% endfor %}
      </ul>
    </div>
    <div class="bg-white rounded shadow p-4">
      <h2 class="text-lg font-semibold mb-3">Recommended Opportunities</h2>
      <ul class="divide-y divide-gray-200">
        {% for item in opp_recs %}
          <li class="py-2">
            <div class="font-medium">{{ item.opportunity.title }}</div>
            <div class="text-sm text-gray-500">Score: {{ item.score|floatformat:3 }}</div>
          </li>
        {% empty %}
          <li class="py-2 text-gray-500">No recommendations.</li>
        {% endfor %}
      </ul>
    </div>
  </aside>
  {% endif %}
</div>
{% endblock %}
