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

{% block title %}Members | {{ group.name }}{% endblock %}

{% block content %}
<div class="container py-5">
    <div class="dashboard-section mb-5">
        <nav aria-label="breadcrumb">
            <ol class="breadcrumb">
                <li class="breadcrumb-item"><a href="{% url 'groups:hub' %}" class="text-decoration-none">Groups</a></li>
                <li class="breadcrumb-item"><a href="{% url 'groups:detail' group.pk %}" class="text-decoration-none">{{ group.name }}</a></li>
                <li class="breadcrumb-item active">Members</li>
            </ol>
        </nav>
        <h1 class="welcome-header">Community Members</h1>
    </div>

    <div class="row g-4">
        {% for membership in group.memberships.all %}
        <div class="col-md-6 col-lg-4">
            <div class="card border-0 shadow-soft p-4" style="border-radius: 16px;">
                <div class="d-flex align-items-center">
                    <img src="{{ membership.user.profile.get_avatar_url }}" class="rounded-circle me-3" width="64" height="64" style="object-fit: cover;">
                    <div>
                        <h3 class="h6 mb-1 fw-bold">{{ membership.user.get_full_name|default:membership.user.username }}</h3>
                        <p class="extra-small text-muted mb-2">{{ membership.user.profile.professional_headline|default:"Member" }}</p>
                        <span class="badge {% if membership.role == 'owner' %}bg- cg-slate{% else %}bg-light text-muted{% endif %} extra-small rounded-pill">
                            {{ membership.get_role_display }}
                        </span>
                    </div>
                </div>
            </div>
        </div>
        {% endfor %}
    </div>
</div>
{% endblock %}
