{% extends 'base.html' %}
{% load static %}

{% block title %}Messages - Gatsby{% endblock %}

{% block content %}
<div class="row">
    <div class="col-md-12">
        <h2 class="fw-bold mb-4 text-gradient">Your Chats</h2>
        
        <div class="card glass-card">
            <div class="list-group list-group-flush bg-transparent">
                {% for partner in chat_partners %}
                <a href="{% url 'chat_detail' partner.pk %}" class="list-group-item list-group-item-action bg-transparent p-4 border-bottom border-secondary-subtle">
                    <div class="d-flex align-items-center">
                        <div class="rounded-circle bg-dark p-3 text-white fw-bold me-3 shadow-sm border border-secondary" style="width: 50px; height: 50px; display: flex; align-items: center; justify-content: center;">
                            {{ partner.user.username|first|upper }}
                        </div>
                        <div class="flex-grow-1">
                            <h5 class="mb-1 text-white fw-bold">{{ partner.user.username }}</h5>
                            <p class="mb-0 text-secondary small">{{ partner.university }} · {{ partner.role|title }}</p>
                        </div>
                        <div class="text-secondary small">
                            <i class="bi bi-chevron-right"></i>
                        </div>
                    </div>
                </a>
                {% empty %}
                <div class="p-5 text-center">
                    <div class="p-3 mb-4 rounded-circle bg-dark-subtle d-inline-block">
                        <i class="bi bi-chat-dots-fill text-secondary" style="font-size: 2rem;"></i>
                    </div>
                    <h5 class="text-white">No messages yet</h5>
                    <p class="text-secondary">Start a conversation with a founder or partner from the <a href="{% url 'partners' %}" class="text-primary">Discover</a> page.</p>
                </div>
                {% endfor %}
            </div>
        </div>
    </div>
</div>
{% endblock %}
