{% extends "_types/social_lite/index.html" %}

{% block title %}Search — Rose Ash{% endblock %}

{% block social_content %}
<h1 class="text-2xl font-bold mb-6">Search</h1>

<form method="get" action="{{ url_for('ap_social.search') }}" class="mb-6"
      sx-get="{{ url_for('ap_social.search_page') }}"
      sx-target="#search-results"
      sx-push-url="{{ url_for('ap_social.search') }}">
  <div class="flex gap-2">
    <input type="text" name="q" value="{{ query }}"
      class="flex-1 border border-stone-300 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-stone-500"
      placeholder="Search users or @user@instance.tld">
    <button type="submit"
      class="bg-stone-800 text-white px-6 py-2 rounded hover:bg-stone-700">
      Search
    </button>
  </div>
</form>

{% if query and total %}
  <p class="text-sm text-stone-500 mb-4">{{ total }} result{{ 's' if total != 1 }} for <strong>{{ query }}</strong></p>
{% elif query %}
  <p class="text-stone-500 mb-4">No results found for <strong>{{ query }}</strong></p>
{% endif %}

<div id="search-results">
  {% include "social/_search_results.html" %}
</div>
{% endblock %}
