{% extends "core/base.html" %}
{% block title %}Search Results{% endblock %}

{% block content %}
<div class="container mt-4">
  <h1 class="mb-3">
    Search Results{% if query %} for "{{ query }}"{% endif %}
  </h1>

  {% if results %}
    <ul class="list-group">
      {% for plant in results %}
        <li class="list-group-item d-flex justify-content-between align-items-center">
          <a href="{{ url_for('plant.view', plant_uuid=plant.uuid) }}">
            {{ plant.common_name[0].name if plant.common_name else plant.scientific_name[0].name }}
          </a>
          {% if plant.owner_id == current_user.id and not plant.is_public %}
            <span class="badge bg-secondary">Private</span>
          {% endif %}
        </li>
      {% endfor %}
    </ul>
  {% else %}
    <p class="text-muted">
      No results found{% if query %} for "{{ query }}"{% endif %}.
    </p>
  {% endif %}

  <a href="{{ url_for('search.search') }}" class="btn btn-link mt-3">New Search</a>
</div>
{% endblock %}
