{% macro contacts(recent_contacts) %}
<div class="masonry-card">
  <div class="card shadow-sm">
    <div class="card-body">
      <div class="d-flex justify-content-between align-items-center mb-3">
        <h5 class="card-title mb-0"><i class="fas fa-address-book me-2"></i>Recent Contacts</h5>
        <div>
          <a href="{{ url_for('contacts.contacts_list') }}" class="btn btn-primary btn-sm me-2">View All</a>
        </div>
      </div>
      {% if recent_contacts %}
      <ul class="list-unstyled mb-3">
        {% for contact in recent_contacts %}
        <li class="mb-2">
          <div class="fw-semibold">{{ contact.username }} {{ contact.last_name }}</div>
          <div class="flex flex-wrap gap-2 mt-1">
            <a href="mailto:{{ contact.email }}"
               class="contact-link inline-flex items-center px-2 py-0.5 rounded text-sm font-normal">
              <i class="fas fa-envelope mr-1" style="font-size: 0.85em; opacity: 0.7;"></i>{{ contact.email }}
            </a>
            {% if contact.phone %}
            <a href="tel:{{ contact.phone }}"
               class="contact-link inline-flex items-center px-2 py-0.5 rounded text-sm font-normal">
              <i class="fas fa-phone mr-1" style="font-size: 0.85em; opacity: 0.7;"></i>{{ contact.phone }}
            </a>
            {% endif %}
          </div>
        </li>
        {% endfor %}
      </ul>
      {% else %}
      <div class="text-muted small">No contacts yet.</div>
      {% endif %}
    </div>
  </div>
</div>
{% endmacro %} 