{{-- 
    PAGE DE DÉMONSTRATION DES MODALS
    Cette page montre tous les types de modals disponibles
    URL : /demo-modals (à ajouter dans web.php si nécessaire)
--}}

@extends('layouts.app')

@section('title', 'Démonstration des Modals')
@section('page-title', 'Démonstration des Modals')

@section('content')
<div class="space-y-8">
    <!-- En-tête -->
    <div class="bg-gradient-to-r from-blue-600 to-blue-700 rounded-xl p-8 text-white">
        <h1 class="text-3xl font-bold mb-2">Système de Modals Réutilisables</h1>
        <p class="text-blue-100">Cliquez sur les boutons ci-dessous pour voir les différents modals en action</p>
    </div>

    <!-- Section 1 : Modals de différentes tailles -->
    <div class="bg-white rounded-xl shadow-sm border border-gray-200 p-6">
        <h2 class="text-xl font-bold text-gray-900 mb-4">1. Tailles de Modal</h2>
        <p class="text-gray-600 mb-6">Les modals sont disponibles en 5 tailles différentes</p>
        
        <div class="flex flex-wrap gap-3">
            <button type="button" data-modal-toggle="modal-size-sm" 
                class="px-4 py-2 bg-gray-600 hover:bg-gray-700 text-white rounded-lg transition-all">
                Small (sm)
            </button>
            <button type="button" data-modal-toggle="modal-size-md" 
                class="px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-all">
                Medium (md) - Par défaut
            </button>
            <button type="button" data-modal-toggle="modal-size-lg" 
                class="px-4 py-2 bg-indigo-600 hover:bg-indigo-700 text-white rounded-lg transition-all">
                Large (lg)
            </button>
            <button type="button" data-modal-toggle="modal-size-xl" 
                class="px-4 py-2 bg-purple-600 hover:bg-purple-700 text-white rounded-lg transition-all">
                Extra Large (xl)
            </button>
            <button type="button" data-modal-toggle="modal-size-2xl" 
                class="px-4 py-2 bg-pink-600 hover:bg-pink-700 text-white rounded-lg transition-all">
                2X Large (2xl)
            </button>
        </div>
    </div>

    <!-- Section 2 : Modals fonctionnels -->
    <div class="bg-white rounded-xl shadow-sm border border-gray-200 p-6">
        <h2 class="text-xl font-bold text-gray-900 mb-4">2. Modals Fonctionnels</h2>
        <p class="text-gray-600 mb-6">Exemples de modals pour différentes actions</p>
        
        <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
            <!-- Produit -->
            <div class="border border-gray-200 rounded-lg p-4">
                <div class="flex items-center mb-3">
                    <div class="w-10 h-10 bg-blue-100 rounded-lg flex items-center justify-center mr-3">
                        <svg class="w-5 h-5 text-blue-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4" />
                        </svg>
                    </div>
                    <h3 class="font-semibold text-gray-900">Produit</h3>
                </div>
                <p class="text-sm text-gray-600 mb-4">Ajouter un nouveau produit avec catégorie, unité et fournisseur</p>
                <button type="button" data-modal-toggle="modal-demo-product" 
                    class="w-full px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white text-sm rounded-lg transition-all">
                    Ouvrir le modal
                </button>
            </div>

            <!-- Catégorie -->
            <div class="border border-gray-200 rounded-lg p-4">
                <div class="flex items-center mb-3">
                    <div class="w-10 h-10 bg-green-100 rounded-lg flex items-center justify-center mr-3">
                        <svg class="w-5 h-5 text-green-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z" />
                        </svg>
                    </div>
                    <h3 class="font-semibold text-gray-900">Catégorie</h3>
                </div>
                <p class="text-sm text-gray-600 mb-4">Créer une nouvelle catégorie avec nom et description</p>
                <button type="button" data-modal-toggle="modal-demo-category" 
                    class="w-full px-4 py-2 bg-green-600 hover:bg-green-700 text-white text-sm rounded-lg transition-all">
                    Ouvrir le modal
                </button>
            </div>

            <!-- Stock -->
            <div class="border border-gray-200 rounded-lg p-4">
                <div class="flex items-center mb-3">
                    <div class="w-10 h-10 bg-orange-100 rounded-lg flex items-center justify-center mr-3">
                        <svg class="w-5 h-5 text-orange-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2" />
                        </svg>
                    </div>
                    <h3 class="font-semibold text-gray-900">Entrée Stock</h3>
                </div>
                <p class="text-sm text-gray-600 mb-4">Enregistrer une entrée de stock avec détails complets</p>
                <button type="button" data-modal-toggle="modal-demo-stock" 
                    class="w-full px-4 py-2 bg-orange-600 hover:bg-orange-700 text-white text-sm rounded-lg transition-all">
                    Ouvrir le modal
                </button>
            </div>
        </div>
    </div>

    <!-- Section 3 : Différentes méthodes HTTP -->
    <div class="bg-white rounded-xl shadow-sm border border-gray-200 p-6">
        <h2 class="text-xl font-bold text-gray-900 mb-4">3. Méthodes HTTP</h2>
        <p class="text-gray-600 mb-6">Les modals supportent toutes les méthodes HTTP</p>
        
        <div class="flex flex-wrap gap-3">
            <button type="button" data-modal-toggle="modal-method-post" 
                class="px-4 py-2 bg-green-600 hover:bg-green-700 text-white rounded-lg transition-all">
                POST (Créer)
            </button>
            <button type="button" data-modal-toggle="modal-method-put" 
                class="px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-all">
                PUT (Modifier)
            </button>
            <button type="button" data-modal-toggle="modal-method-delete" 
                class="px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg transition-all">
                DELETE (Supprimer)
            </button>
        </div>
    </div>

    <!-- Section 4 : Code d'exemple -->
    <div class="bg-gray-900 rounded-xl shadow-sm p-6 text-white">
        <h2 class="text-xl font-bold mb-4">4. Utilisation Simple</h2>
        <div class="bg-gray-800 rounded-lg p-4 overflow-x-auto">
            <pre class="text-sm"><code class="text-green-400">&lt;!-- 1. Bouton pour ouvrir --&gt;</code>
<code class="text-gray-300">&lt;button type="button" data-modal-toggle="modal-new-product"&gt;
    Nouveau produit
&lt;/button&gt;</code>

<code class="text-green-400">&lt;!-- 2. Le modal --&gt;</code>
<code class="text-yellow-300">&lt;x-form-modal</code> <code class="text-blue-300">id</code>=<code class="text-orange-300">"modal-new-product"</code> <code class="text-blue-300">title</code>=<code class="text-orange-300">"Nouveau produit"</code><code class="text-yellow-300">&gt;</code>
    <code class="text-yellow-300">&lt;x-forms.product-form /&gt;</code>
<code class="text-yellow-300">&lt;/x-form-modal&gt;</code></pre>
        </div>
    </div>

    {{-- =========================================
         MODALS - Section Tailles
         ========================================= --}}

    <!-- Modal Small -->
    <x-form-modal id="modal-size-sm" title="Modal Small (sm)" action="#" size="sm">
        <div class="text-center py-8">
            <div class="w-16 h-16 bg-gray-100 rounded-full mx-auto mb-4 flex items-center justify-center">
                <svg class="w-8 h-8 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
                </svg>
            </div>
            <h3 class="text-lg font-semibold text-gray-900 mb-2">Petit Modal</h3>
            <p class="text-sm text-gray-600">Idéal pour des formulaires très simples avec 2-3 champs</p>
        </div>
    </x-form-modal>

    <!-- Modal Medium -->
    <x-form-modal id="modal-size-md" title="Modal Medium (md) - Par défaut" action="#" size="md">
        <div class="text-center py-8">
            <div class="w-16 h-16 bg-blue-100 rounded-full mx-auto mb-4 flex items-center justify-center">
                <svg class="w-8 h-8 text-blue-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
                </svg>
            </div>
            <h3 class="text-lg font-semibold text-gray-900 mb-2">Modal Moyen</h3>
            <p class="text-sm text-gray-600">Taille par défaut, parfaite pour la plupart des formulaires</p>
        </div>
    </x-form-modal>

    <!-- Modal Large -->
    <x-form-modal id="modal-size-lg" title="Modal Large (lg)" action="#" size="lg">
        <div class="text-center py-8">
            <div class="w-16 h-16 bg-indigo-100 rounded-full mx-auto mb-4 flex items-center justify-center">
                <svg class="w-8 h-8 text-indigo-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
                </svg>
            </div>
            <h3 class="text-lg font-semibold text-gray-900 mb-2">Grand Modal</h3>
            <p class="text-sm text-gray-600">Pour des formulaires avec plus de champs ou des grilles</p>
        </div>
    </x-form-modal>

    <!-- Modal XL -->
    <x-form-modal id="modal-size-xl" title="Modal Extra Large (xl)" action="#" size="xl">
        <div class="text-center py-8">
            <div class="w-16 h-16 bg-purple-100 rounded-full mx-auto mb-4 flex items-center justify-center">
                <svg class="w-8 h-8 text-purple-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
                </svg>
            </div>
            <h3 class="text-lg font-semibold text-gray-900 mb-2">Modal Extra Large</h3>
            <p class="text-sm text-gray-600">Pour des formulaires complexes avec plusieurs sections</p>
        </div>
    </x-form-modal>

    <!-- Modal 2XL -->
    <x-form-modal id="modal-size-2xl" title="Modal 2X Large (2xl)" action="#" size="2xl">
        <div class="text-center py-8">
            <div class="w-16 h-16 bg-pink-100 rounded-full mx-auto mb-4 flex items-center justify-center">
                <svg class="w-8 h-8 text-pink-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
                </svg>
            </div>
            <h3 class="text-lg font-semibold text-gray-900 mb-2">Modal Très Large</h3>
            <p class="text-sm text-gray-600">Pour des formulaires très larges ou avec beaucoup de contenu</p>
        </div>
    </x-form-modal>

    {{-- =========================================
         MODALS - Section Fonctionnels
         ========================================= --}}

    <!-- Modal Produit -->
    <x-form-modal id="modal-demo-product" title="Nouveau produit" action="#" size="md">
        <x-forms.product-form />
    </x-form-modal>

    <!-- Modal Catégorie -->
    <x-form-modal id="modal-demo-category" title="Nouvelle catégorie" action="#" size="sm">
        <x-forms.category-form />
    </x-form-modal>

    <!-- Modal Stock -->
    <x-form-modal id="modal-demo-stock" title="Entrée de stock" action="#" size="lg">
        <x-forms.stock-entry-form :products="[]" />
    </x-form-modal>

    {{-- =========================================
         MODALS - Section Méthodes HTTP
         ========================================= --}}

    <!-- Modal POST -->
    <x-form-modal id="modal-method-post" title="Créer (POST)" action="#" method="POST" size="md">
        <div class="bg-green-50 border border-green-200 rounded-lg p-4">
            <div class="flex items-start">
                <div class="flex-shrink-0">
                    <svg class="w-5 h-5 text-green-600" fill="currentColor" viewBox="0 0 20 20">
                        <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" />
                    </svg>
                </div>
                <div class="ml-3">
                    <h3 class="text-sm font-medium text-green-800">Méthode POST</h3>
                    <p class="mt-1 text-sm text-green-700">Utilisée pour créer de nouvelles ressources</p>
                    <code class="mt-2 block text-xs bg-green-100 text-green-800 px-2 py-1 rounded">method="POST"</code>
                </div>
            </div>
        </div>
    </x-form-modal>

    <!-- Modal PUT -->
    <x-form-modal id="modal-method-put" title="Modifier (PUT)" action="#" method="PUT" size="md">
        <div class="bg-blue-50 border border-blue-200 rounded-lg p-4">
            <div class="flex items-start">
                <div class="flex-shrink-0">
                    <svg class="w-5 h-5 text-blue-600" fill="currentColor" viewBox="0 0 20 20">
                        <path d="M13.586 3.586a2 2 0 112.828 2.828l-.793.793-2.828-2.828.793-.793zM11.379 5.793L3 14.172V17h2.828l8.38-8.379-2.83-2.828z" />
                    </svg>
                </div>
                <div class="ml-3">
                    <h3 class="text-sm font-medium text-blue-800">Méthode PUT</h3>
                    <p class="mt-1 text-sm text-blue-700">Utilisée pour mettre à jour des ressources existantes</p>
                    <code class="mt-2 block text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded">method="PUT"</code>
                </div>
            </div>
        </div>
    </x-form-modal>

    <!-- Modal DELETE -->
    <x-form-modal id="modal-method-delete" title="Supprimer (DELETE)" action="#" method="DELETE" size="md">
        <div class="bg-red-50 border border-red-200 rounded-lg p-4">
            <div class="flex items-start">
                <div class="flex-shrink-0">
                    <svg class="w-5 h-5 text-red-600" fill="currentColor" viewBox="0 0 20 20">
                        <path fill-rule="evenodd" d="M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 100-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z" clip-rule="evenodd" />
                    </svg>
                </div>
                <div class="ml-3">
                    <h3 class="text-sm font-medium text-red-800">Méthode DELETE</h3>
                    <p class="mt-1 text-sm text-red-700">Utilisée pour supprimer des ressources</p>
                    <code class="mt-2 block text-xs bg-red-100 text-red-800 px-2 py-1 rounded">method="DELETE"</code>
                </div>
            </div>
        </div>
    </x-form-modal>
</div>
@endsection
