{% extends "base.html" %}

{% block title %}Finalisation de votre commande | BilletFest{% endblock %}

{% block extrahead %}
    {{ block.super }}
    {# Font Awesome pour l'icône WhatsApp (optionnel mais plus propre) #}
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
{% endblock %}

{% block content %}
<style>
    /* ============================================
       STYLES SPÉCIFIQUES PAGE WHATSAPP INSTRUCTION
       Thème Festif & Chaleureux - Mobile-First
       ============================================ */
    .checkout-container {
        max-width: 700px;
        margin: 1rem auto;
        padding: 0.5rem;
    }

    .summary-card {
        background: white;
        border-radius: 32px;
        padding: 2rem 1.5rem;
        box-shadow: 0 20px 40px rgba(255, 140, 66, 0.12);
        border: 1px solid rgba(255, 140, 66, 0.2);
        margin-bottom: 2rem;
        text-align: center;
    }

    .event-name {
        color: var(--warm-anthracite);
        font-family: 'Poppins', sans-serif;
        font-size: 1.4rem;
        font-weight: 600;
        margin-bottom: 0.5rem;
    }

    .ticket-type {
        background: rgba(255, 140, 66, 0.1);
        display: inline-block;
        padding: 0.4rem 1.5rem;
        border-radius: 40px;
        color: var(--sunset-start);
        font-weight: 600;
        margin: 0.8rem 0;
        font-size: 1.1rem;
    }

    .total-price {
        font-size: 3.2rem;
        font-weight: 800;
        color: var(--warm-anthracite);
        margin: 1rem 0 0.5rem;
        line-height: 1.2;
    }

    .total-price small {
        font-size: 1rem;
        font-weight: 500;
        color: #6b6b6b;
    }

    .order-detail {
        color: #5a5a5a;
        border-top: 1px dashed rgba(255,140,66,0.3);
        padding-top: 1.2rem;
        margin-top: 0.5rem;
    }

    /* Étapes visuelles */
    .steps-section {
        background: rgba(255, 140, 66, 0.03);
        border-radius: 28px;
        padding: 2rem 1.5rem;
        margin-bottom: 2rem;
        border: 1px solid rgba(255, 140, 66, 0.1);
    }

    .steps-title {
        font-family: 'Poppins', sans-serif;
        text-align: center;
        color: var(--warm-anthracite);
        margin-bottom: 1.8rem;
        font-size: 1.5rem;
    }

    .steps-list {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }

    .step-item {
        display: flex;
        align-items: center;
        gap: 1rem;
    }

    .step-icon {
        width: 50px;
        height: 50px;
        background: var(--amber);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 700;
        font-size: 1.4rem;
        color: var(--warm-anthracite);
        flex-shrink: 0;
        box-shadow: 0 6px 12px rgba(242, 175, 41, 0.2);
    }

    .step-text {
        font-weight: 500;
        color: var(--warm-anthracite);
    }

    .step-text strong {
        display: block;
        font-size: 1.1rem;
        margin-bottom: 0.2rem;
    }

    /* Bouton CTA Royal */
    .whatsapp-btn {
        display: block;
        background: linear-gradient(145deg, #25D366, #128C7E);
        color: white;
        text-align: center;
        padding: 1.3rem 2rem;
        border-radius: 100px;
        font-weight: 800;
        font-size: 1.3rem;
        text-decoration: none;
        margin: 1.5rem 0 1rem;
        box-shadow: 0 15px 25px rgba(37, 211, 102, 0.3);
        transition: all 0.3s ease;
        border: 2px solid rgba(255,255,255,0.3);
        animation: softPulse 2s infinite;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 12px;
    }

    .whatsapp-btn i {
        font-size: 1.8rem;
    }

    .whatsapp-btn:hover {
        transform: scale(1.02);
        box-shadow: 0 20px 30px rgba(37, 211, 102, 0.4);
        animation: none;
    }

    @keyframes softPulse {
        0% { box-shadow: 0 15px 25px rgba(37, 211, 102, 0.3); }
        50% { box-shadow: 0 15px 25px rgba(37, 211, 102, 0.6); }
        100% { box-shadow: 0 15px 25px rgba(37, 211, 102, 0.3); }
    }

    /* Lien retour */
    .back-link {
        display: inline-block;
        margin-top: 1.2rem;
        color: var(--sunset-start);
        text-decoration: none;
        font-weight: 500;
        transition: transform 0.2s;
    }

    .back-link:hover {
        transform: translateX(-6px);
        text-decoration: underline;
    }

    /* Responsive */
    @media (min-width: 640px) {
        .steps-list {
            flex-direction: row;
            justify-content: space-around;
        }
        .step-item {
            flex-direction: column;
            text-align: center;
        }
        .step-text strong {
            margin-top: 0.5rem;
        }
    }

    @media (min-width: 768px) {
        .summary-card {
            padding: 2.5rem 2rem;
        }
        .total-price {
            font-size: 4rem;
        }
    }

    /* Message rassurant */
    .security-note {
        text-align: center;
        color: #6b6b6b;
        font-size: 0.85rem;
        margin-top: 1.5rem;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
    }
</style>

<div class="checkout-container">
    {# Carte Récapitulatif #}
    <div class="summary-card">
        <div class="event-name">{{ type_ticket.evenement.nom }}</div>
        <span class="ticket-type">{{ type_ticket.nom }}</span>
        <div class="total-price">
            {{ type_ticket.prix|floatformat:0 }} <small>FCFA</small>
        </div>
        <div class="order-detail">
            📅 {{ type_ticket.evenement.date|date:"d E Y à H:i" }}
        </div>
    </div>

    {# Section Étapes #}
    <div class="steps-section">
        <h3 class="steps-title">Comment finaliser votre commande ?</h3>
        <div class="steps-list">
            <div class="step-item">
                <div class="step-icon">1</div>
                <div class="step-text">
                    <strong>Cliquez sur le bouton</strong>
                    <span>Ouvrez WhatsApp avec votre commande pré-remplie.</span>
                </div>
            </div>
            <div class="step-item">
                <div class="step-icon">2</div>
                <div class="step-text">
                    <strong>Message prêt</strong>
                    <span>Envoyez simplement le message à notre équipe.</span>
                </div>
            </div>
            <div class="step-item">
                <div class="step-icon">3</div>
                <div class="step-text">
                    <strong>Recevez les infos</strong>
                    <span>Obtenez les coordonnées de paiement et votre ticket.</span>
                </div>
            </div>
        </div>
    </div>

    {# Bouton WhatsApp avec numéro en placeholder (à remplacer) #}
    <a href="https://wa.me/22969439610?text={{ whatsapp_message_encoded }}" 
       class="whatsapp-btn" 
       target="_blank" 
       rel="noopener noreferrer">
        <i class="fab fa-whatsapp"></i> 
        Ouvrir WhatsApp et commander
        <i class="fas fa-arrow-right" style="font-size: 1.2rem;"></i>
    </a>

    {# Note de sécurité rassurante #}
    <div class="security-note">
        <i class="fas fa-lock" style="color: var(--success-emerald);"></i>
        Paiement sécurisé • Échange direct avec notre équipe
    </div>

    {# Lien retour discret #}
    <a href="{% url 'vitrine:event_detail' type_ticket.evenement.pk %}" class="back-link">
        ← Modifier mon choix
    </a>
</div>

{# Aucun JS supplémentaire nécessaire #}
{% endblock %}