{% extends "base.html" %}
{% block content %}
<div class="max-w-xl">
  <div class="card">
    <h1>Team Invitation</h1>
    <p>You've been invited to join <strong>{{ team_name }}</strong>.</p>

    {% if 'user_id' in session %}
    <form method="POST" action="{{ url_for('invites.accept_invite_action', token=token) }}" style="margin-top:1rem;">
      <p>Your account ({{ email }}) matches this invitation.</p>
      <button type="submit" class="btn">Accept Invitation</button>
    </form>
    {% else %}
    <div style="margin-top:1rem;">
      <p>Log in with {{ email }} to accept this invitation.</p>
      <div style="display:flex;gap:0.5rem;margin-top:0.75rem;">
        <a href="{{ url_for('auth.login', next=request.url) }}" class="btn">Log In</a>
        <a href="{{ url_for('auth.register', next=request.url) }}" class="btn btn-outline">Create Account</a>
      </div>
    </div>
    {% endif %}

    <p class="text-muted" style="margin-top:1rem;">
      <a href="{{ url_for('auth.dashboard') }}">Decline invitation</a>
    </p>
  </div>
</div>
{% endblock %}