{% extends "base/base.html" %}
{% load i18n %}
{% load account socialaccount %}
{% load static %}

{% block title %}Login - ThrillWiki{% endblock %}

{% block content %}
<div class="flex items-center justify-center py-8 md:py-12">
  <div class="w-full max-w-lg px-4">
    <div class="auth-card">
      <h1 class="auth-title">{% trans "Welcome Back" %}</h1>

      {% get_providers as socialaccount_providers %}
      {% if socialaccount_providers %}
      <div class="space-y-3">
        {% for provider in socialaccount_providers %}
        <a
          href="{% provider_login_url provider.id process='login' %}"
          class="btn-social {% if provider.id == 'discord' %}btn-discord{% elif provider.id == 'google' %}btn-google{% endif %}"
          role="button"
          tabindex="0"
          onkeydown="if(event.key === 'Enter' || event.key === ' ') { this.click(); event.preventDefault(); }"
        >
          {% if provider.id == 'google' %}
          <img
            src="{% static 'images/google-icon.svg' %}"
            alt="Google"
            class="w-5 h-5 mr-3"
          />
          <span>Continue with Google</span>
          {% elif provider.id == 'discord' %}
          <img
            src="{% static 'images/discord-icon.svg' %}"
            alt="Discord"
            class="w-5 h-5 mr-3"
          />
          <span>Continue with Discord</span>
          {% endif %}
        </a>
        {% endfor %}
      </div>

      <div class="auth-divider">
        <span>Or continue with email</span>
      </div>
      {% endif %}

      {% include "account/partials/login_form.html" %}

      <div class="mt-6 text-sm text-center">
        <p class="text-gray-600 dark:text-gray-400">
          {% trans "Don't have an account?" %}
          <a
            href="{% url 'account_signup' %}"
            class="ml-1 font-medium transition-colors text-primary hover:text-primary/80 focus:outline-hidden focus:underline"
          >
            {% trans "Sign up" %}
          </a>
        </p>
      </div>
    </div>
  </div>
</div>
{% endblock %}
