<div>
    
    <div class="fixed top-0 left-0 right-0 w-full bg-white flex items-center justify-between p-4 z-50 border-b border-gray-200">
        <div class="flex items-center">
            <div class="w-10 h-10 bg-red-500 rounded flex items-center justify-center mr-3">
                <span class="text-white font-bold text-sm">3I.</span>
            </div>
            <h1 class="text-2xl font-bold">Cargar archivos SCSS</h1>
        </div>
        <div class="flex items-center gap-3">
            <a href="<?php echo e(route('products.scss.version.show', [$product, $scssVersion])); ?>"
                class="text-gray-700 hover:text-gray-900 px-4 py-2">
                Cancelar
            </a>
            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(!empty($fileData)): ?>
                <button wire:click="confirmUpload"
                        wire:loading.attr="disabled"
                        class="bg-3ip hover:bg-3ip-light text-white px-4 py-2 rounded-lg disabled:opacity-50 disabled:cursor-not-allowed">
                    <span wire:loading.remove>Confirmar y crear archivos</span>
                    <span wire:loading>Guardando...</span>
                </button>
            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
        </div>
    </div>

    
    <div class="w-full px-20 pt-24 pb-8">
        <div class="mx-auto max-w-4xl">
            
            <?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 rounded-lg bg-white border border-gray-200 px-8 py-6 mb-6">
                <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                    <div>
                        <label class="block text-xs text-gray-500 mb-1">Producto</label>
                        <p class="font-semibold text-gray-900"><?php echo e($product->name); ?></p>
                        <p class="text-xs text-gray-600 font-mono"><?php echo e($product->slug); ?></p>
                    </div>
                    <div>
                        <label class="block text-xs text-gray-500 mb-1">Versión</label>
                        <p class="font-mono font-semibold text-gray-900"><?php echo e($scssVersion->version); ?></p>
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($scssVersion->description): ?>
                            <p class="text-sm text-gray-600 mt-1"><?php echo e($scssVersion->description); ?></p>
                        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    </div>
                </div>
            </div>

            
            <div class="w-full rounded-lg bg-white border border-gray-200 px-8 py-6 mb-6">
                <h3 class="text-lg font-semibold mb-4">Cargar archivos</h3>
                
                <div x-data="{ 
                    isDragging: false,
                    handleFiles(files) {
                        if (files.length > 0) {
                            const fileInput = document.getElementById('file-input-scss');
                            const dataTransfer = new DataTransfer();
                            Array.from(files).forEach(file => {
                                dataTransfer.items.add(file);
                            });
                            fileInput.files = dataTransfer.files;
                            fileInput.dispatchEvent(new Event('change', { bubbles: true }));
                        }
                    }
                }"
                @dragover.prevent="isDragging = true"
                @dragleave.prevent="isDragging = false"
                @drop.prevent="isDragging = false; handleFiles($event.dataTransfer.files)"
                class="border-2 border-dashed rounded-lg p-12 text-center transition-colors"
                :class="isDragging ? 'border-blue-500 bg-blue-50' : 'border-gray-300'">
                    <input type="file"
                           wire:model="uploadedFiles"
                           multiple
                           accept=".scss,.sass"
                           id="file-input-scss"
                           class="hidden">
                    <label for="file-input-scss" class="cursor-pointer">
                        <img src="<?php echo e(asset('vendor/blade-untitledui-icons/upload-cloud.svg')); ?>" alt="Subir" class="mx-auto h-16 w-16 mb-4 svg-fill-gray">
                        <p class="text-gray-700 mb-2">
                            <span class="font-semibold text-blue-600">Haz clic para seleccionar</span> o arrastra archivos aquí
                        </p>
                        <p class="text-sm text-gray-500">
                            Archivos .scss o .sass (máximo 10 archivos, 2MB por archivo)
                        </p>
                    </label>
                </div>

                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__errorArgs = ['uploadedFiles'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                    <p class="text-red-600 text-sm mt-2"><?php echo e($message); ?></p>
                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
            </div>

            
            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(!empty($validationErrors)): ?>
                <div class="mb-6 rounded-lg bg-red-100 border border-red-200 px-6 py-4">
                    <h4 class="font-semibold text-red-800 mb-2">Errores de validación:</h4>
                    <ul class="list-disc list-inside text-red-700 text-sm">
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $validationErrors; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $error): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <li><?php echo e($error); ?></li>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    </ul>
                </div>
            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

            
            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(!empty($fileData)): ?>
                <div class="w-full rounded-lg bg-white border border-gray-200 overflow-hidden">
                    <div class="px-6 py-4 border-b border-gray-200 bg-gray-50">
                        <h3 class="text-lg font-semibold">Archivos cargados (<?php echo e(count($fileData)); ?>)</h3>
                    </div>
                    <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">Archivo original</th>
                                    <th class="px-4 py-3 text-left">Nombre a usar</th>
                                    <th class="px-4 py-3 text-left">Tamaño</th>
                                    <th class="px-4 py-3 text-left">Estado</th>
                                    <th class="px-4 py-3 text-left">Acción</th>
                                    <th class="px-4 py-3 text-right">Eliminar</th>
                                </tr>
                            </thead>
                            <tbody class="divide-y">
                                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $fileData; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index => $file): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <tr class="hover:bg-gray-50">
                                        <td class="px-4 py-3 font-mono text-xs text-gray-900"><?php echo e($file['originalName']); ?></td>
                                        <td class="px-4 py-3 font-mono font-semibold text-gray-900"><?php echo e($file['filename']); ?></td>
                                        <td class="px-4 py-3 text-gray-700"><?php echo e(number_format($file['size'] / 1024, 2)); ?> KB</td>
                                        <td class="px-4 py-3">
                                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($file['isDuplicate']): ?>
                                                <span class="inline-flex items-center px-2 py-1 rounded-full text-xs font-semibold bg-yellow-100 text-yellow-800">
                                                    Duplicado
                                                </span>
                                            <?php else: ?>
                                                <span class="inline-flex items-center px-2 py-1 rounded-full text-xs font-semibold bg-green-100 text-green-800">
                                                    Nuevo
                                                </span>
                                            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                        </td>
                                        <td class="px-4 py-3">
                                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($file['isDuplicate']): ?>
                                                <div class="flex gap-3">
                                                    <label class="flex items-center cursor-pointer">
                                                        <input type="radio"
                                                               name="action_<?php echo e($index); ?>"
                                                               value="overwrite"
                                                               wire:click="setDuplicateAction(<?php echo e($index); ?>, 'overwrite')"
                                                               <?php if($file['action'] === 'overwrite'): ?> checked <?php endif; ?>
                                                               class="mr-2">
                                                        <span class="text-xs">Sobrescribir</span>
                                                    </label>
                                                    <label class="flex items-center cursor-pointer">
                                                        <input type="radio"
                                                               name="action_<?php echo e($index); ?>"
                                                               value="skip"
                                                               wire:click="setDuplicateAction(<?php echo e($index); ?>, 'skip')"
                                                               <?php if($file['action'] === 'skip'): ?> checked <?php endif; ?>
                                                               class="mr-2">
                                                        <span class="text-xs">Saltar</span>
                                                    </label>
                                                </div>
                                            <?php else: ?>
                                                <span class="text-xs text-gray-500">Se creará</span>
                                            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                        </td>
                                        <td class="px-4 py-3 text-right">
                                            <button wire:click="removeFile(<?php echo e($index); ?>)"
                                                    class="text-red-600 hover:text-red-800 text-xs font-semibold">
                                                Eliminar
                                            </button>
                                        </td>
                                    </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
        </div>
    </div>
</div><?php /**PATH /var/www/html/resources/views/livewire/scss/file-upload.blade.php ENDPATH**/ ?>