<div>
    
    <div class="w-full flex items-center mb-8">
        <a href="<?php echo e(route('products.show', $product)); ?>"
            class="flex rounded-lg bg-white border border-gray-200 px-4 py-2 text-gray-700 hover:bg-gray-100 font-bold">
            <img src="<?php echo e(asset('vendor/blade-untitledui-icons/arrow-narrow-left.svg')); ?>" alt="Volver" class="w-6 h-6">
            <span class="ml-2">Volver</span>
        </a>
    </div>

    
    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(session()->has('success')): ?>
        <div class="mb-4 rounded bg-green-100 px-4 py-2 text-green-700">
            <?php echo e(session('success')); ?>

        </div>
    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

    <?php if(session()->has('error')): ?>
        <div class="mb-4 rounded bg-red-100 px-4 py-2 text-red-700">
            <?php echo e(session('error')); ?>

        </div>
    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

    
    <div class="w-full flex flex-wrap items-center justify-between rounded-lg bg-white border border-gray-200 px-8 py-4 mb-6">
        <div class="w-full flex items-center justify-between">
            <div class="flex items-center gap-4">
                
                <div class="flex items-center justify-center w-16 h-16 rounded-lg bg-white border border-gray-200 p-2">
                    <img src="<?php echo e($product->image_url ?? asset('images/placeholder.png')); ?>" alt="<?php echo e($product->name); ?>"
                        class="w-full h-full object-contain">
                </div>
                <div>
                    <h1 class="text-4xl font-bold">Versiones de Features - <?php echo e($product->name); ?></h1>
                </div>
            </div>
        </div>
    </div>

    
    <div class="mb-6 rounded-lg bg-white border border-gray-200 px-6 py-4">
        <div class="flex items-center justify-between gap-4">
            <div class="flex items-center gap-4 flex-1">
                <div class="w-64">
                    <input
                        type="text"
                        wire:model.live.debounce.300ms="search"
                        placeholder="Buscar versión o descripción..."
                        class="w-full rounded-lg border border-gray-200 px-4 py-2 focus:outline-none focus:ring-2 focus:ring-orange-300"
                    >
                </div>

                <div class="w-48">
                    <input
                        type="text"
                        wire:model.live.debounce.300ms="versionFilter"
                        placeholder="Filtrar por versión..."
                        class="w-full rounded-lg border border-gray-200 px-4 py-2 focus:outline-none focus:ring-2 focus:ring-orange-300"
                    >
                </div>
            </div>

            <button wire:click="createNewVersion"
                    class="flex items-center rounded-lg bg-orange-600 px-4 py-2 text-white hover:bg-orange-700 font-semibold">
                <img src="<?php echo e(asset('vendor/blade-untitledui-icons/plus.svg')); ?>" alt="Crear" class="w-5 h-5 mr-2 svg-fill-white">
                Crear versión de Features
            </button>
        </div>
    </div>

    
    <div class="rounded-lg bg-white border border-gray-200 overflow-hidden">
        <div class="overflow-x-auto">
            <table class="min-w-full text-sm">
                <thead class="bg-gray-100 text-xs uppercase text-gray-600">
                <tr>
                    <th class="px-4 py-3 text-left">Versión</th>
                    <th class="px-4 py-3 text-left">Features</th>
                    <th class="px-4 py-3 text-left">Descripción</th>
                    <th class="px-4 py-3 text-left">Creado por</th>
                    <th class="px-4 py-3 text-left">Fecha</th>
                    <th class="px-4 py-3 text-right">Acciones</th>
                </tr>
                </thead>

                <tbody class="divide-y">
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__empty_1 = true; $__currentLoopData = $featureVersions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $featureVersion): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                    <tr class="hover:bg-gray-50">
                        <td class="px-4 py-3 font-mono font-semibold"><?php echo e($featureVersion->version); ?></td>
                        <td class="px-4 py-3">
                            <span class="px-2 py-1 bg-blue-100 text-blue-800 rounded text-xs font-semibold">
                                <?php echo e($featureVersion->features_count); ?> feature(s)
                            </span>
                        </td>
                        <td class="px-4 py-3 text-gray-700">
                            <?php echo e($featureVersion->description ? Str::limit($featureVersion->description, 50) : '—'); ?>

                        </td>
                        <td class="px-4 py-3 text-gray-700">
                            <?php echo e($featureVersion->creator?->name ?? 'N/A'); ?>

                        </td>
                        <td class="px-4 py-3 text-gray-700"><?php echo e($featureVersion->created_at->format('Y-m-d H:i')); ?></td>

                        <td class="px-4 py-3 text-right">
                            <div class="flex items-center justify-end gap-2">
                                <a href="<?php echo e(route('products.features.version.show', [$product, $featureVersion])); ?>"
                                   class="text-indigo-600 hover:text-indigo-800 text-xs font-semibold">
                                    Ver features →
                                </a>
                                <button wire:click="duplicate(<?php echo e($featureVersion->id); ?>)"
                                        wire:confirm="¿Seguro que deseas duplicar esta versión? Se creará una nueva versión con todas las features."
                                        class="text-green-600 hover:text-green-800 text-xs font-semibold">
                                    Duplicar
                                </button>
                                <a href="<?php echo e(route('products.features.version.edit', [$product, $featureVersion])); ?>"
                                   class="text-orange-600 hover:text-orange-800 text-xs font-semibold">
                                    Editar
                                </a>
                            </div>
                        </td>
                    </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                    <tr>
                        <td colspan="6" class="px-4 py-8 text-center text-gray-500">
                            <div class="flex flex-col items-center">
                                <p class="text-sm">No hay versiones de Features.</p>
                                <button wire:click="createNewVersion"
                                        class="mt-4 rounded-lg bg-orange-600 px-4 py-2 text-sm text-white hover:bg-orange-700 font-semibold">
                                    Crear la primera versión
                                </button>
                            </div>
                        </td>
                    </tr>
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                </tbody>
            </table>
        </div>
    </div>

    
    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($featureVersions->hasPages()): ?>
        <div class="mt-6">
            <?php echo e($featureVersions->links()); ?>

        </div>
    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
</div><?php /**PATH /var/www/html/resources/views/livewire/features/index.blade.php ENDPATH**/ ?>