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

{% block title %}Connexion | {{ site_config.nom_plateforme }}{% endblock %}

{% block extra_head %}
    <!-- Google Fonts & Font Awesome (icône Google) -->
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Cinzel:wght@500;700&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
    <!-- Tailwind CSS (CDN) -->
    <script src="https://cdn.tailwindcss.com"></script>
    <style>
        /* Halo doré diffus en arrière-plan */
        body {
            background-color: #000000;
            margin: 0;
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
        }
        body::before {
            content: "";
            position: fixed;
            top: 50%;
            left: 50%;
            width: 80vmax;
            height: 80vmax;
            transform: translate(-50%, -50%);
            background: radial-gradient(circle at center, rgba(212, 175, 55, 0.12) 0%, rgba(0,0,0,0) 70%);
            pointer-events: none;
            z-index: 0;
        }

        /* Carte glassmorphisme */
        .glass-card {
            background: rgba(20, 20, 20, 0.65);
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
            border: 1px solid rgba(212, 175, 55, 0.25);
            border-radius: 2rem;
            box-shadow: 0 20px 40px rgba(0,0,0,0.6), 0 0 0 1px rgba(212,175,55,0.1) inset;
        }

        /* Titre avec dégradé or métallique */
        .gold-text {
            font-family: 'Cinzel', serif;
            font-weight: 700;
            background: linear-gradient(135deg, #F9D976 0%, #E5B84B 30%, #F3E2A7 60%, #C59B3C 100%);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
            text-shadow: 0 2px 10px rgba(212,175,55,0.3);
            letter-spacing: 0.05em;
        }

        /* Bouton Google avec glow doré */
        .google-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 12px;
            background: rgba(10, 10, 10, 0.7);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            border: 1.5px solid #d4af37;
            color: #f0e6d2;
            font-weight: 500;
            padding: 0.9rem 2rem;
            border-radius: 60px;
            transition: all 0.3s ease;
            box-shadow: 0 4px 12px rgba(0,0,0,0.3);
            font-size: 1.1rem;
            width: 100%;
            max-width: 320px;
            margin: 0 auto;
        }
        .google-btn i {
            color: #d4af37;
            font-size: 1.5rem;
            transition: transform 0.2s;
        }
        .google-btn:hover {
            border-color: #f9d976;
            box-shadow: 0 0 18px rgba(212, 175, 55, 0.7), 0 4px 12px rgba(0,0,0,0.4);
            background: rgba(20, 20, 20, 0.9);
            transform: scale(1.02);
        }
        .google-btn:hover i {
            transform: scale(1.1);
        }

        /* Animation fade-in-up */
        @keyframes fadeInUp {
            0% {
                opacity: 0;
                transform: translateY(30px);
            }
            100% {
                opacity: 1;
                transform: translateY(0);
            }
        }
        .animate-fade-in-up {
            animation: fadeInUp 0.9s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
        }

        /* Lien discret */
        .legal-note {
            color: #a0a0a0;
            font-size: 0.8rem;
            border-top: 1px dashed rgba(212,175,55,0.2);
            padding-top: 1.2rem;
            margin-top: 1.2rem;
        }
    </style>
{% endblock %}

{% block content %}
<div class="relative z-10 w-full min-h-screen flex flex-col items-center justify-center px-4 py-8">
    <!-- Header : Logo / Nom du site -->
    <div class="mb-6 text-center animate-fade-in-up" style="animation-delay: 0.1s;">
        <h1 class="text-3xl md:text-4xl gold-text drop-shadow-2xl">
            {{ site_config.nom_plateforme }}
        </h1>
        <div class="h-0.5 w-24 mx-auto mt-2 bg-gradient-to-r from-transparent via-yellow-500/50 to-transparent"></div>
    </div>

    <!-- Carte centrale -->
    <div class="glass-card w-full max-w-md p-8 md:p-10 text-center animate-fade-in-up" style="animation-delay: 0.2s;">
        <!-- Phrase d'accueil -->
        <p class="text-gray-300 text-lg md:text-xl mb-8 font-light tracking-wide">
            Authentifiez-vous pour marquer l'histoire.
        </p>

        <!-- Bouton de connexion Google -->
        <a href="{% provider_login_url 'google' %}" 
           class="google-btn group">
            <i class="fab fa-google"></i>
            <span>Se connecter avec Google</span>
        </a>

        <!-- Note de confiance (anonymat) -->
        <div class="legal-note">
            <i class="fas fa-shield-alt mr-1 text-yellow-600/70"></i>
            <span class="text-gray-400">Votre email est haché (SHA‑256) immédiatement.<br> 
            <strong class="text-yellow-500/80">Anonymat total du vote garanti.</strong></span>
        </div>
    </div>

    <!-- Footer discret (mentions légales éventuelles) -->
    <div class="mt-8 text-xs text-gray-500 animate-fade-in-up" style="animation-delay: 0.3s;">
        <a href="{% url 'awards_vitrine:legal' %}" class="hover:text-yellow-500 transition">Mentions légales</a>
        <span class="mx-2">•</span>
        <span>© {{ site_config.nom_plateforme }}</span>
    </div>
</div>

<!-- Script minimal pour s'assurer que le halo reste parfait -->
<script>
    (function() {
        // Ajustement dynamique du halo (optionnel, mais déjà en CSS fixe)
        console.log("✨ Page de connexion Golden Night chargée.");
    })();
</script>
{% endblock %}