{% extends "base.html" %}

{% block title %}Search Results{% endblock %}

{% block content %}
<style>
    /* Add styles for the search results */
    #search-results {
        margin: 20px;
        width: 100%;
    }
    .search-result {
        border: 1px solid #e1e1e1;
        border-radius: 5px;
        padding: 10px;
        margin-bottom: 10px;
        width: 100%;
    }
</style>

<div id="search-results">
    {% if error %}
        <div class="search-result">{{ error }}</div>
    {% elif results %}
        {% for result in results %}
            <div class="search-result">
                <a href="/chat/{{ result.room_name }}?username={{ username }}">
                    <b>{{ result.room_name }}</b><br/>
                    {{ result.room_title or "No title" }}</br>
                    <b>Score:</b> {{ result.score }}
                </a>
            </div>
            <br/>
        {% endfor %}
    {% else %}
        <div class="search-result">No results found.</div>
    {% endif %}
</div>
{% endblock %}

