    


<?php $__env->startSection('title', 'Registro'); ?>

<?php $__env->startSection('content'); ?>
    <script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: {
                            50: '#fef7ec', 100: '#fdecd3', 200: '#fbd6a5', 300: '#f9ba6d',
                            400: '#F2A922', 500: '#F28705', 600: '#d96d04', 700: '#b45107',
                        },
                        accent: {
                            50: '#f0f9e8', 100: '#ddf2c7', 200: '#bfe592', 300: '#9dd458',
                            400: '#6fb82f', 500: '#3B7312', 600: '#2f5d0d', 700: '#254809',
                        }
                    }
                }
            }
        }
    </script>
    <style>
        @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
        body { font-family: 'Inter', sans-serif; }
       
        .gradient-bg { background: linear-gradient(135deg, #F28705 0%, #F2A922 100%); }
        .accent-gradient { background: linear-gradient(135deg, #3B7312 0%, #6fb82f 100%); }
        .card-hover { transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
        .card-hover:hover { transform: translateY(-4px); box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04); }
    </style>

    <div class="min-h-screen  p-4 md:p-6 lg:p-8">
        <div class="max-w-7xl mx-auto space-y-8">

            
            <div class="glass-effect rounded-3xl p-6 md:p-8 shadow-xl border border-white/40">
                <div class="flex flex-col lg:flex-row justify-between items-start lg:items-center gap-8">
                    <div class="space-y-4 flex-1">
                        
                        <div class="flex flex-col sm:flex-row sm:items-center gap-4">
                            <div class="inline-flex items-center gap-3 px-4 py-2 bg-white rounded-2xl shadow-sm border border-orange-100">
                                <i class="fas fa-sliders-h text-primary-500"></i>
                                <span class="text-sm font-bold text-gray-700">Modo de Gestión:</span>
                                <div class="relative min-w-[200px]">
                                    <select onchange="window.location.href = '<?php echo e(route('productos.empresas')); ?>?gestion_por=' + this.value" 
                                            class="appearance-none w-full bg-transparent pr-8 py-1 text-sm font-bold text-primary-600 outline-none cursor-pointer">
                                        <option value="empresas" <?php echo e($gestionPor === 'empresas' ? 'selected' : ''); ?>>🏛️ Por Empresas</option>
                                        <option value="productos" <?php echo e($gestionPor === 'productos' ? 'selected' : ''); ?>>📦 Por Lotes</option>
                                    </select>
                                    <div class="pointer-events-none absolute inset-y-0 right-0 flex items-center pr-1 text-primary-400">
                                        <i class="fas fa-chevron-down text-[10px]"></i>
                                    </div>
                                </div>
                            </div>
                            
                            <div class="inline-flex items-center gap-2 px-3 py-1.5 bg-accent-50 rounded-full border border-accent-100">
                                <span class="w-1.5 h-1.5 bg-accent-500 rounded-full animate-pulse"></span>
                                <span class="text-[10px] font-bold text-accent-700 uppercase tracking-wider">
                                    <?php echo e($gestionPor === 'empresas' ? 'Vista de Empresas' : 'Vista de Lotes'); ?>

                                </span>
                            </div>
                        </div>

                        <div>
                            <h1 class="text-3xl md:text-4xl font-black text-gray-900 leading-tight mb-2">
                                <?php echo e($gestionPor === 'empresas' ? 'Registro por Empresa' : 'Registro por Lotes'); ?>

                            </h1>
                            <p class="text-gray-500 text-sm md:text-base max-w-2xl leading-relaxed">
                                <?php echo e($gestionPor === 'empresas' 
                                    ? 'Selecciona una empresa para gestionar sus productos específicos según sus últimos ingresos.' 
                                    : 'Visualiza y gestiona todos los lotes de productos que aún no han sido registrados formalmente en el sistema.'); ?>

                            </p>
                        </div>
                        
                        <div class="flex items-center gap-3">
                            <div class="px-4 py-2 bg-white border border-gray-100 rounded-xl shadow-sm flex items-center gap-2">
                                <span class="w-2h-2 bg-primary-500 rounded-full"></span>
                                <span class="text-xs font-bold text-gray-700">
                                    <?php if($gestionPor === 'empresas'): ?>
                                        <?php echo e($total); ?> Empresas registradas
                                    <?php else: ?>
                                        <?php echo e($total); ?> Lotes pendientes
                                    <?php endif; ?>
                                </span>
                            </div>
                        </div>
                    </div>

                    <a href="<?php echo e(route('ingresos.create')); ?>" class="inline-flex items-center gap-2 px-6 py-4 gradient-bg text-white font-bold rounded-2xl shadow-lg hover:shadow-2xl hover:scale-[1.02] transform transition-all group">
                        <div class="w-8 h-8 bg-white/20 rounded-lg flex items-center justify-center group-hover:rotate-90 transition-transform">
                            <i class="fas fa-plus"></i>
                        </div>
                        <span>Registrar Nuevo Lote</span>
                    </a>
                </div>
            </div>

            
            <div class="glass-effect rounded-3xl p-6 shadow-lg border border-white/40">
                <?php if($gestionPor === 'empresas'): ?>
                    <form action="<?php echo e(route('productos.empresas')); ?>" method="GET" class="space-y-6">
                        <input type="hidden" name="gestion_por" value="empresas">
                        <div class="grid grid-cols-1 lg:grid-cols-12 gap-6 items-end">
                            
                            <div class="lg:col-span-8 group">
                                <label class="block text-[10px] font-bold text-gray-400 uppercase tracking-widest mb-2 ml-1">Buscar Empresa</label>
                                <div class="relative">
                                    <div class="absolute inset-y-0 left-0 pl-4 flex items-center pointer-events-none text-gray-400 group-focus-within:text-primary-500 transition-colors">
                                        <i class="fas fa-search"></i>
                                    </div>
                                    <input type="text" name="search" id="buscador" value="<?php echo e(request('search')); ?>"
                                           class="block w-full pl-12 pr-4 py-3.5 bg-gray-50/50 border-2 border-gray-100 rounded-2xl focus:bg-white focus:border-primary-400 outline-none transition-all font-semibold text-gray-700"
                                           placeholder="Escribe el nombre de la empresa...">
                                    
                                    
                                    <div id="resultados-busqueda" class="absolute z-50 w-full mt-2 bg-white rounded-2xl shadow-2xl border border-gray-100 hidden max-h-64 overflow-y-auto overflow-x-hidden"></div>
                                </div>
                            </div>

                            
                            <div class="lg:col-span-4 group">
                                <label class="block text-[10px] font-bold text-gray-400 uppercase tracking-widest mb-2 ml-1">Ordenar por</label>
                                <div class="relative">
                                    <div class="absolute inset-y-0 left-0 pl-4 flex items-center pointer-events-none text-gray-400 group-focus-within:text-primary-500 transition-colors">
                                        <i class="fas fa-sort-amount-down"></i>
                                    </div>
                                    <select name="sort" onchange="this.form.submit()" 
                                            class="appearance-none block w-full pl-12 pr-10 py-3.5 bg-gray-50/50 border-2 border-gray-100 rounded-2xl focus:bg-white focus:border-primary-400 outline-none transition-all font-semibold text-gray-700 cursor-pointer">
                                        <option value="desc" <?php echo e(request('sort') == 'desc' ? 'selected' : ''); ?>>Más reciente</option>
                                        <option value="asc" <?php echo e(request('sort') == 'asc' ? 'selected' : ''); ?>>Más antiguo</option>
                                    </select>
                                    <div class="absolute inset-y-0 right-0 flex items-center pr-4 pointer-events-none text-gray-400">
                                        <i class="fas fa-chevron-down text-xs"></i>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="flex flex-wrap gap-3">
                            <button type="submit" class="inline-flex items-center gap-2 px-6 py-3 gradient-bg text-white font-bold rounded-xl shadow-md hover:shadow-xl hover:-translate-y-0.5 transition-all">
                                <i class="fas fa-filter text-xs"></i>
                                Aplicar Filtros
                            </button>
                            
                            <?php if(request('search') || request('sort')): ?>
                                <a href="<?php echo e(route('productos.empresas')); ?>?gestion_por=empresas" 
                                   class="inline-flex items-center gap-2 px-6 py-3 bg-white border-2 border-gray-100 text-gray-500 font-bold rounded-xl hover:bg-gray-50 hover:border-gray-200 transition-all">
                                    <i class="fas fa-undo text-xs"></i>
                                    Restablecer
                                </a>
                            <?php endif; ?>
                        </div>
                    </form>
                <?php else: ?>
                    
                    <form method="GET" action="<?php echo e(route('productos.empresas')); ?>" class="space-y-6">
                        <input type="hidden" name="gestion_por" value="productos">
                        
                        <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
                            <div class="group">
                                <label class="block text-[10px] font-bold text-gray-400 uppercase tracking-widest mb-2 ml-1">Lote / Producto</label>
                                <div class="relative">
                                    <div class="absolute inset-y-0 left-0 pl-4 flex items-center pointer-events-none text-gray-400 group-focus-within:text-primary-500 transition-colors">
                                        <i class="fas fa-box"></i>
                                    </div>
                                    <input type="text" name="nombre_producto" value="<?php echo e(request('nombre_producto')); ?>"
                                           class="block w-full pl-12 pr-4 py-3 bg-gray-50/50 border-2 border-gray-100 rounded-2xl focus:bg-white focus:border-primary-400 outline-none transition-all font-semibold text-gray-700"
                                           placeholder="Nombre...">
                                </div>
                            </div>

                            <div class="group">
                                <label class="block text-[10px] font-bold text-gray-400 uppercase tracking-widest mb-2 ml-1">Código Lote</label>
                                <div class="relative">
                                    <div class="absolute inset-y-0 left-0 pl-4 flex items-center pointer-events-none text-gray-400 group-focus-within:text-primary-500 transition-colors">
                                        <i class="fas fa-tag"></i>
                                    </div>
                                    <input type="text" name="codigo_lote" value="<?php echo e(request('codigo_lote')); ?>"
                                           class="block w-full pl-12 pr-4 py-3 bg-gray-50/50 border-2 border-gray-100 rounded-2xl focus:bg-white focus:border-primary-400 outline-none transition-all font-semibold text-gray-700"
                                           placeholder="LOTE-000">
                                </div>
                            </div>

                            <div class="group">
                                <label class="block text-[10px] font-bold text-gray-400 uppercase tracking-widest mb-2 ml-1">Periodo</label>
                                <div class="relative">
                                    <select name="filtro_periodo" class="appearance-none block w-full px-4 py-3 bg-gray-50/50 border-2 border-gray-100 rounded-2xl focus:bg-white focus:border-primary-400 outline-none transition-all font-semibold text-gray-700 cursor-pointer">
                                        <option value="">Cualquier fecha</option>
                                        <option value="esta_semana" <?php echo e(request('filtro_periodo') === 'esta_semana' ? 'selected' : ''); ?>>Esta Semana</option>
                                        <option value="este_mes" <?php echo e(request('filtro_periodo') === 'este_mes' ? 'selected' : ''); ?>>Este Mes</option>
                                    </select>
                                    <div class="absolute inset-y-0 right-0 flex items-center pr-4 pointer-events-none text-gray-400">
                                        <i class="fas fa-calendar-alt text-xs"></i>
                                    </div>
                                </div>
                            </div>

                            <div class="group">
                                <label class="block text-[10px] font-bold text-gray-400 uppercase tracking-widest mb-2 ml-1">Ordenar por</label>
                                <select name="sort" onchange="this.form.submit()" 
                                        class="appearance-none block w-full px-4 py-3 bg-gray-50/50 border-2 border-gray-100 rounded-2xl focus:bg-white focus:border-primary-400 outline-none transition-all font-semibold text-gray-700 cursor-pointer">
                                    <option value="desc" <?php echo e(request('sort') == 'desc' ? 'selected' : ''); ?>>Más reciente</option>
                                    <option value="asc" <?php echo e(request('sort') == 'asc' ? 'selected' : ''); ?>>Más antiguo</option>
                                </select>
                            </div>
                        </div>

                        <div class="flex flex-wrap gap-3">
                            <button type="submit" class="inline-flex items-center gap-2 px-6 py-3 accent-gradient text-white font-bold rounded-xl shadow-md hover:shadow-xl transition-all">
                                <i class="fas fa-search-plus text-xs"></i>
                                Buscar Lotes
                            </button>
                            <a href="<?php echo e(route('productos.empresas')); ?>?gestion_por=productos" class="px-6 py-3 bg-white border-2 border-gray-100 text-gray-500 font-bold rounded-xl hover:bg-gray-50 transition-all">
                                Limpiar Filtros
                            </a>
                        </div>
                    </form>
                <?php endif; ?>
            </div>
            
            <div class="grid grid-cols-1 gap-6">
                <?php if($gestionPor === 'empresas'): ?>
                    <?php $__empty_1 = true; $__currentLoopData = $proveedores; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $proveedor): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <div class="glass-effect rounded-3xl p-6 shadow-lg border border-white hover:border-primary-300 transition-all duration-300 group/card bg-white/60">
                            <div class="flex flex-col md:flex-row justify-between items-center gap-6">
                                <div class="flex items-center gap-6 flex-1">
                                    <div class="w-16 h-16 gradient-bg rounded-2xl flex items-center justify-center text-white text-2xl shadow-lg shadow-orange-200 group-hover/card:scale-110 transition-transform">
                                        <i class="fas fa-building"></i>
                                    </div>
                                    <div>
                                        <h3 class="text-xl font-extrabold text-gray-900 group-hover/card:text-primary-600 transition-colors uppercase tracking-tight">
                                            <?php echo e($proveedor->nombre_empresa); ?>

                                        </h3>
                                        <div class="flex flex-wrap gap-4 mt-2">
                                            <div class="flex items-center gap-2 text-sm text-gray-500 font-medium">
                                                <i class="far fa-calendar-check text-primary-500"></i>
                                                Último Lote: 
                                                <span class="text-gray-900 font-bold">
                                                    <?php echo e($proveedor->ingresos->isNotEmpty() ? $proveedor->ingresos->first()->fecha_ingreso->format('d/m/Y') : 'Sin registros'); ?>

                                                </span>
                                            </div>
                                            <div class="flex items-center gap-2 text-sm text-gray-500 font-medium">
                                                <i class="fas fa-boxes text-primary-500"></i>
                                                Total Lotes: 
                                                <span class="text-gray-900 font-bold"><?php echo e($proveedor->ingresos_count ?? $proveedor->ingresos->count()); ?></span>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="flex items-center gap-3">
                                    <a href="<?php echo e(route('proveedores.productos.index', $proveedor)); ?>" 
                                       class="inline-flex items-center gap-2 px-6 py-3 gradient-bg text-white font-bold rounded-xl shadow-lg hover:shadow-2xl hover:scale-105 transition-all">
                                        Explorar Productos
                                        <i class="fas fa-arrow-right text-xs"></i>
                                    </a>
                                </div>
                            </div>
                        </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                        <div class="glass-effect rounded-3xl p-12 text-center border-2 border-dashed border-gray-200 bg-white/40">
                            <div class="w-20 h-20 bg-gray-50 rounded-full flex items-center justify-center mx-auto mb-4 text-gray-400">
                                <i class="fas fa-search-minus text-3xl"></i>
                            </div>
                            <h3 class="text-xl font-bold text-gray-900">No hay resultados</h3>
                            <p class="text-gray-500 max-w-sm mx-auto">Vuelve a intentar con otros términos o registra un nuevo proveedor.</p>
                        </div>
                    <?php endif; ?>

                    <div class="mt-8">
                        <?php echo e($proveedores->links()); ?>

                    </div>
                <?php else: ?>
                    
                    <?php $__empty_1 = true; $__currentLoopData = $ingresos; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ingreso): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <div class="glass-effect rounded-3xl p-1 border border-white/60 shadow-xl card-hover overflow-hidden bg-white/70 mb-6">
                            <div class="p-6 md:p-8">
                                <div class="flex flex-col xl:flex-row justify-between gap-8">
                                    <div class="flex-1 space-y-6">
                                        <div class="flex items-start gap-5">
                                            <div class="w-16 h-16 bg-gradient-to-br from-blue-500 to-blue-700 rounded-2xl flex items-center justify-center text-white text-2xl shadow-xl shadow-blue-100">
                                                <i class="fas fa-cube"></i>
                                            </div>
                                            <div>
                                                <div class="flex items-center gap-3 mb-1">
                                                    <h3 class="text-2xl font-black text-gray-900 uppercase"><?php echo e($ingreso->nombre_producto); ?></h3>
                                                    <?php if($ingreso->codigo_lote): ?>
                                                        <span class="px-3 py-1 bg-blue-50 text-blue-600 text-[10px] font-black rounded-full border border-blue-100 uppercase tracking-tighter shadow-sm">
                                                            ID: <?php echo e($ingreso->codigo_lote); ?>

                                                        </span>
                                                    <?php endif; ?>
                                                </div>
                                                <p class="text-gray-500 font-bold flex items-center gap-2">
                                                    <i class="fas fa-store text-blue-400"></i>
                                                    <?php echo e($ingreso->proveedor->nombre_empresa); ?>

                                                </p>
                                            </div>
                                        </div>

                                        <div class="grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-4 gap-4">
                                            <div class="bg-white/80 p-4 rounded-2xl border border-gray-50 shadow-sm group/stat flex items-center gap-3">
                                                <div class="w-10 h-10 bg-green-50 rounded-xl flex items-center justify-center text-green-500 group-hover/stat:bg-green-500 group-hover/stat:text-white transition-colors">
                                                    <i class="fas fa-layer-group"></i>
                                                </div>
                                                <div>
                                                    <p class="text-[10px] text-gray-400 font-bold uppercase tracking-widest">Cantidad</p>
                                                    <p class="text-sm font-black text-gray-900"><?php echo e(number_format($ingreso->cantidad_inicial, 0)); ?> <span class="text-gray-400 font-normal"><?php echo e($ingreso->unidad_medida); ?></span></p>
                                                </div>
                                            </div>
                                            
                                            <div class="bg-white/80 p-4 rounded-2xl border border-gray-50 shadow-sm group/stat flex items-center gap-3">
                                                <div class="w-10 h-10 bg-blue-50 rounded-xl flex items-center justify-center text-blue-500 group-hover/stat:bg-blue-500 group-hover/stat:text-white transition-colors">
                                                    <i class="fas fa-calendar-day"></i>
                                                </div>
                                                <div>
                                                    <p class="text-[10px] text-gray-400 font-bold uppercase tracking-widest">Ingreso</p>
                                                    <p class="text-sm font-black text-gray-900"><?php echo e($ingreso->fecha_ingreso->format('d/m/Y')); ?></p>
                                                </div>
                                            </div>

                                            <div class="bg-white/80 p-4 rounded-2xl border border-gray-50 shadow-sm group/stat flex items-center gap-3">
                                                <div class="w-10 h-10 bg-red-50 rounded-xl flex items-center justify-center text-red-500 group-hover/stat:bg-red-500 group-hover/stat:text-white transition-colors">
                                                    <i class="fas fa-hourglass-end"></i>
                                                </div>
                                                <div>
                                                    <p class="text-[10px] text-gray-400 font-bold uppercase tracking-widest">Vencimiento</p>
                                                    <p class="text-sm font-black text-gray-900"><?php echo e($ingreso->fecha_vencimiento_lote ? $ingreso->fecha_vencimiento_lote->format('d/m/Y') : 'PERMANENTE'); ?></p>
                                                </div>
                                            </div>

                                            <div class="bg-white/80 p-4 rounded-2xl border border-gray-50 shadow-sm group/stat flex items-center gap-3">
                                                <div class="w-10 h-10 bg-amber-50 rounded-xl flex items-center justify-center text-amber-500 group-hover/stat:bg-amber-500 group-hover/stat:text-white transition-colors">
                                                    <i class="fas fa-dollar-sign"></i>
                                                </div>
                                                <div>
                                                    <p class="text-[10px] text-gray-400 font-bold uppercase tracking-widest">Inversión</p>
                                                    <p class="text-sm font-black text-gray-900">Bs <?php echo e(number_format($ingreso->costo_total, 2)); ?></p>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="xl:w-64 flex flex-col justify-center gap-3 pl-0 xl:pl-8 xl:border-l border-gray-100">
                                        <a href="<?php echo e(route('productos.create', ['ingreso_id' => $ingreso->id])); ?>" 
                                           class="flex items-center justify-center gap-2 px-6 py-4 accent-gradient text-white font-black rounded-2xl shadow-lg hover:shadow-2xl hover:scale-105 transition-all text-sm uppercase tracking-wider">
                                            <i class="fas fa-plus-circle"></i>
                                            Registrar Producto
                                        </a>
                                        <a href="<?php echo e(route('ingresos.show', $ingreso->id)); ?>" 
                                           class="flex items-center justify-center gap-2 px-6 py-3 bg-white border-2 border-gray-100 text-gray-600 font-bold rounded-2xl hover:border-blue-400 hover:text-blue-500 transition-all text-sm uppercase tracking-wider">
                                            <i class="fas fa-eye"></i>
                                            Ver Detalles
                                        </a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                        <div class="glass-effect rounded-3xl p-16 text-center shadow-inner bg-white/60">
                            <div class="w-24 h-24 bg-accent-50 rounded-full flex items-center justify-center mx-auto mb-6 text-accent-500">
                                <i class="fas fa-check-circle text-4xl"></i>
                            </div>
                            <h3 class="text-2xl font-black text-gray-900 mb-2">¡Todo al día!</h3>
                            <p class="text-gray-500 font-medium max-w-sm mx-auto">No hay lotes pendientes de registro. Buen trabajo gestionando tus existencias.</p>
                        </div>
                    <?php endif; ?>

                    <div class="mt-8">
                        <?php echo e($ingresos->links()); ?>

                    </div>
                <?php endif; ?>
            </div>

        </div>
    </div>


    <script>
        $(document).ready(function() {
            let timeout = null;
            const $buscador = $('#buscador');
            const $resultados = $('#resultados-busqueda');

            $buscador.on('input', function() {
                clearTimeout(timeout);
                const query = $(this).val().trim();

                if (query.length < 2) {
                    $resultados.addClass('hidden').empty();
                    return;
                }

                timeout = setTimeout(() => {
                    $.ajax({
                        url: '<?php echo e(route("productos.buscar.ajax")); ?>',
                        method: 'GET',
                        data: { search: query },
                        success: function(response) {
                            $resultados.empty().removeClass('hidden');

                            if (response.length === 0) {
                                $resultados.append(`
                                    <div class="p-4 text-center text-gray-500 font-medium italic text-xs uppercase tracking-widest">
                                        No se encontraron coincidencias
                                    </div>
                                `);
                            } else {
                                response.forEach(empresa => {
                                    let url = '<?php echo e(route("proveedores.productos.index", ":id")); ?>';
                                    url = url.replace(':id', empresa.id);
                                    
                                    $resultados.append(`
                                        <a href="${url}" 
                                           class="flex items-center gap-4 px-4 py-3 hover:bg-orange-50 transition-colors group">
                                            <div class="w-10 h-10 bg-orange-100 rounded-xl flex items-center justify-center text-orange-600 group-hover:bg-primary-500 group-hover:text-white transition-all">
                                                <i class="fas fa-building text-sm"></i>
                                            </div>
                                            <div class="flex-1 min-w-0">
                                                <div class="text-sm font-black text-gray-900 uppercase truncate">${empresa.nombre_empresa}</div>
                                                <div class="text-[10px] text-gray-400 font-bold uppercase tracking-widest">
                                                    ID: ${empresa.id}
                                                </div>
                                            </div>
                                            <i class="fas fa-arrow-right text-orange-200 group-hover:text-primary-500 transition-colors"></i>
                                        </a>
                                    `);
                                });
                            }
                        }
                    });
                }, 300);
            });

            // Cerrar resultados al hacer clic fuera
            $(document).on('click', function(e) {
                if (!$(e.target).closest('#buscador, #resultados-busqueda').length) {
                    $resultados.addClass('hidden');
                }
            });

            // Reabrir si hay contenido al enfocar
            $buscador.on('focus', function() {
                if ($(this).val().trim().length >= 2 && $resultados.children().length > 0) {
                    $resultados.removeClass('hidden');
                }
            });
        });
    </script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/donjavie/public_html/minimarket/resources/views/administrador/productos/empresas.blade.php ENDPATH**/ ?>