{# File: plugins/user/templates/user/profile.html #}
{% extends 'core/base.html' %}
{% block title %}{{ user.username }}'s Profile – Nature In Pots{% endblock %}

{% block content %}
<div class="row">
  <div class="col-md-4">
    <div class="card mb-4">
      <div class="card-body text-center">
        <img src="{{ url_for('static', filename='images/avatar-placeholder.png') }}"
             alt="Avatar"
             class="rounded-circle mb-3"
             width="120" height="120">
        <h3 class="mb-1">
          {{ user.username }}
          {% if is_self %}
            <small class="text-muted">(You)</small>
          {% endif %}
        </h3>
        <div>
          {% if user.is_verified %}
            <span class="badge bg-success me-1">Verified</span>
          {% endif %}
          {% if user.role == 'admin' %}
            <span class="badge bg-danger">Admin</span>
          {% else %}
            <span class="badge bg-primary">User</span>
          {% endif %}
        </div>
      </div>
    </div>

    <div class="card">
      <div class="card-header">
        Quick Stats
      </div>
      <ul class="list-group list-group-flush">
        <li class="list-group-item">
          <i class="bi bi-calendar2-date me-2"></i>
          <strong>Joined:</strong> {{ user.created_at.strftime('%Y-%m-%d') }}
        </li>
        <li class="list-group-item">
          <i class="bi bi-envelope me-2"></i>
          <strong>Email:</strong> {{ user.email }}
        </li>
        <li class="list-group-item">
          <i class="bi bi-person-plus me-2"></i>
          <strong>Invites Left:</strong>
          <a href="{{ url_for('auth.send_invite') }}">
            {{ user.invites_remaining }}
          </a>
        </li>
      </ul>
    </div>
  </div>

  <div class="col-md-8">
    <div class="card mb-4">
      <div class="card-header">
        Account Details
      </div>
      <div class="card-body">
        <p><strong>Role:</strong> {{ user.role.title() }}</p>
        {% if user.is_banned %}
          <p><strong>Status:</strong> <span class="text-danger">Banned</span></p>
        {% elif user.suspended_until %}
          <p>
            <strong>Status:</strong>
            <span class="text-warning">
              Suspended until {{ user.suspended_until.strftime('%Y-%m-%d') }}
            </span>
          </p>
        {% else %}
          <p><strong>Status:</strong> <span class="text-success">Active</span></p>
        {% endif %}
        {# Future: Show recent activity, plants added, etc. #}
      </div>
    </div>
  </div>
</div>
{% endblock %}
