// Usar jQuery para hacer la solicitud
                ruta = "{{ url('eliminar-pdf') }}/"+archivoId;
                $.get(ruta, function(response){
                    if (response.status === 'success') {
                        // Eliminar el elemento del DOM
                        if (archivoElement) {
                            archivoElement.remove();
                        }

                        // Mostrar mensaje de éxito
                        showNotification(response.message || 'Archivo eliminado correctamente', 'success');

                        // Verificar si quedan archivos
                        const container = document.getElementById(`archivos-${tipoDocumentoId}`);
                        if (container && container.children.length === 0) {
                            container.innerHTML = '<div class="text-muted small">No hay archivos cargados.</div>';
                        }
                    } else {
                        // Restaurar elemento
                        if (archivoElement) {
                            archivoElement.innerHTML = originalContent;
                            archivoElement.style.animation = 'shake 0.5s';
                        }
                        showNotification(response.message || 'Error al eliminar el archivo', 'error');
                    }


                }, 'json').fail(function (xhr, status, error){
                    console.error('Error:', error);
                    // Restaurar elemento
                    if (archivoElement) {
                        archivoElement.innerHTML = originalContent;
                    }
                    showNotification('Error de conexión al eliminar el archivo', 'error');
                });